geoblacklight_admin 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +18 -0
  3. data/.gitignore +75 -0
  4. data/.standard.yml +4 -0
  5. data/Gemfile +59 -0
  6. data/LICENSE +21 -0
  7. data/README.md +84 -0
  8. data/Rakefile +72 -0
  9. data/app/assets/images/.keep +0 -0
  10. data/app/assets/images/aerial_photo.jpg +0 -0
  11. data/app/assets/images/archive-solid.svg +1 -0
  12. data/app/assets/images/bookmark-regular.svg +1 -0
  13. data/app/assets/images/bookmark-solid.svg +1 -0
  14. data/app/assets/images/btaa-logo.jpg +0 -0
  15. data/app/assets/images/cloud-download-alt-solid.svg +1 -0
  16. data/app/assets/images/file-import-solid.svg +1 -0
  17. data/app/assets/images/trash-alt-solid.svg +1 -0
  18. data/app/assets/javascripts/geoblacklight_admin/chosen.js +4 -0
  19. data/app/assets/javascripts/geoblacklight_admin/date_range_picker.js +173 -0
  20. data/app/assets/javascripts/geoblacklight_admin/datepicker.js +22 -0
  21. data/app/assets/javascripts/geoblacklight_admin/elements.js +38 -0
  22. data/app/assets/javascripts/geoblacklight_admin/exports.js +3 -0
  23. data/app/assets/javascripts/geoblacklight_admin/fields.js +11 -0
  24. data/app/assets/javascripts/geoblacklight_admin/geoblacklight_admin.js +2 -0
  25. data/app/assets/javascripts/geoblacklight_admin/inputmask.js +4 -0
  26. data/app/assets/javascripts/geoblacklight_admin/locale.js +5 -0
  27. data/app/assets/javascripts/geoblacklight_admin/sortable.js +2544 -0
  28. data/app/assets/javascripts/geoblacklight_admin/tooltips.js +3 -0
  29. data/app/assets/javascripts/geoblacklight_admin/truncate.js +4 -0
  30. data/app/assets/javascripts/geoblacklight_admin.js +40 -0
  31. data/app/assets/stylesheets/geoblacklight_admin/_core.scss +47 -0
  32. data/app/assets/stylesheets/geoblacklight_admin/modules/_autocomplete.scss +32 -0
  33. data/app/assets/stylesheets/geoblacklight_admin/modules/_blazer.scss +3 -0
  34. data/app/assets/stylesheets/geoblacklight_admin/modules/_code.scss +3 -0
  35. data/app/assets/stylesheets/geoblacklight_admin/modules/_datepicker.scss +477 -0
  36. data/app/assets/stylesheets/geoblacklight_admin/modules/_elements.scss +3 -0
  37. data/app/assets/stylesheets/geoblacklight_admin/modules/_forms.scss +28 -0
  38. data/app/assets/stylesheets/geoblacklight_admin/modules/_icons.scss +15 -0
  39. data/app/assets/stylesheets/geoblacklight_admin/modules/_nav.scss +9 -0
  40. data/app/assets/stylesheets/geoblacklight_admin/modules/_tables.scss +4 -0
  41. data/app/assets/stylesheets/geoblacklight_admin/modules/_toasts.scss +7 -0
  42. data/app/assets/stylesheets/geoblacklight_admin/modules/_visibility.scss +3 -0
  43. data/app/assets/stylesheets/geoblacklight_admin/settings/_variables.scss +1 -0
  44. data/app/channels/export_channel.rb +12 -0
  45. data/app/controllers/admin/admin_controller.rb +16 -0
  46. data/app/controllers/admin/advanced_search_controller.rb +365 -0
  47. data/app/controllers/admin/api_controller.rb +386 -0
  48. data/app/controllers/admin/bookmarks_controller.rb +68 -0
  49. data/app/controllers/admin/bulk_actions_controller.rb +94 -0
  50. data/app/controllers/admin/concerns/.keep +0 -0
  51. data/app/controllers/admin/concerns/upload_util.rb +8 -0
  52. data/app/controllers/admin/document_accesses_controller.rb +125 -0
  53. data/app/controllers/admin/document_assets_controller.rb +198 -0
  54. data/app/controllers/admin/document_downloads_controller.rb +127 -0
  55. data/app/controllers/admin/documents_controller.rb +219 -0
  56. data/app/controllers/admin/elements_controller.rb +81 -0
  57. data/app/controllers/admin/form_elements_controller.rb +81 -0
  58. data/app/controllers/admin/ids_controller.rb +379 -0
  59. data/app/controllers/admin/import_documents_controller.rb +18 -0
  60. data/app/controllers/admin/imports_controller.rb +105 -0
  61. data/app/controllers/admin/mappings_controller.rb +95 -0
  62. data/app/controllers/admin/notifications_controller.rb +51 -0
  63. data/app/controllers/admin/search_controller.rb +10 -0
  64. data/app/controllers/admin/users_controller.rb +10 -0
  65. data/app/helpers/bulk_actions_helper.rb +9 -0
  66. data/app/helpers/document_helper.rb +60 -0
  67. data/app/helpers/form_input_helper.rb +73 -0
  68. data/app/helpers/geoblacklight_admin_helper.rb +118 -0
  69. data/app/helpers/import_documents_helper.rb +5 -0
  70. data/app/helpers/mappings_helper.rb +27 -0
  71. data/app/indexers/document_indexer.rb +34 -0
  72. data/app/jobs/bulk_action_revert_document_job.rb +49 -0
  73. data/app/jobs/bulk_action_revert_job.rb +25 -0
  74. data/app/jobs/bulk_action_run_document_job.rb +42 -0
  75. data/app/jobs/bulk_action_run_job.rb +27 -0
  76. data/app/jobs/export_job.rb +72 -0
  77. data/app/jobs/export_json_job.rb +120 -0
  78. data/app/jobs/import_document_job.rb +25 -0
  79. data/app/jobs/import_run_job.rb +33 -0
  80. data/app/models/active_storage_attachment.rb +5 -0
  81. data/app/models/active_storage_blob.rb +5 -0
  82. data/app/models/api_search_builder.rb +12 -0
  83. data/app/models/application_record.rb +6 -0
  84. data/app/models/blacklight_api.rb +93 -0
  85. data/app/models/blacklight_api_facets.rb +15 -0
  86. data/app/models/blacklight_api_ids.rb +103 -0
  87. data/app/models/bookmark.rb +17 -0
  88. data/app/models/bulk_action.rb +88 -0
  89. data/app/models/bulk_action_document.rb +22 -0
  90. data/app/models/bulk_action_document_state_machine.rb +16 -0
  91. data/app/models/bulk_action_document_transition.rb +19 -0
  92. data/app/models/bulk_action_state_machine.rb +16 -0
  93. data/app/models/bulk_action_transition.rb +26 -0
  94. data/app/models/concerns/.keep +0 -0
  95. data/app/models/document/bbox_validator.rb +70 -0
  96. data/app/models/document/controlled_lists.rb +104 -0
  97. data/app/models/document/date_range_validator.rb +63 -0
  98. data/app/models/document/geom_validator.rb +117 -0
  99. data/app/models/document/reference.rb +107 -0
  100. data/app/models/document.rb +264 -0
  101. data/app/models/document_access.rb +35 -0
  102. data/app/models/document_download.rb +35 -0
  103. data/app/models/document_state_machine.rb +14 -0
  104. data/app/models/document_transition.rb +26 -0
  105. data/app/models/element.rb +90 -0
  106. data/app/models/form_control.rb +2 -0
  107. data/app/models/form_element.rb +19 -0
  108. data/app/models/form_feature.rb +2 -0
  109. data/app/models/form_group.rb +2 -0
  110. data/app/models/form_header.rb +2 -0
  111. data/app/models/geoblacklight_admin/field_mappings_btaa_aardvark.rb +379 -0
  112. data/app/models/geoblacklight_admin/field_mappings_gblv1.rb +344 -0
  113. data/app/models/geoblacklight_admin/iso_language_codes.rb +515 -0
  114. data/app/models/geoblacklight_admin/schema.rb +194 -0
  115. data/app/models/geoblacklight_admin.rb +3 -0
  116. data/app/models/import/csv_duplicates_validator.rb +36 -0
  117. data/app/models/import/csv_header_validator.rb +24 -0
  118. data/app/models/import.rb +186 -0
  119. data/app/models/import_btaa.rb +91 -0
  120. data/app/models/import_btaa_aardvark.rb +109 -0
  121. data/app/models/import_document.rb +34 -0
  122. data/app/models/import_document_state_machine.rb +12 -0
  123. data/app/models/import_document_transition.rb +19 -0
  124. data/app/models/import_gblv1.rb +92 -0
  125. data/app/models/import_state_machine.rb +16 -0
  126. data/app/models/import_transition.rb +26 -0
  127. data/app/models/mapping.rb +10 -0
  128. data/app/models/notification.rb +9 -0
  129. data/app/models/user.rb +26 -0
  130. data/app/notifications/export_notification.rb +30 -0
  131. data/app/services/export_csv_document_access_links_service.rb +47 -0
  132. data/app/services/export_csv_document_downloads_service.rb +47 -0
  133. data/app/services/export_csv_service.rb +44 -0
  134. data/app/services/export_json_service.rb +35 -0
  135. data/app/services/zip_file_generator.rb +56 -0
  136. data/app/views/admin/advanced_search/facets.json.jbuilder +80 -0
  137. data/app/views/admin/advanced_search/index.json.jbuilder +90 -0
  138. data/app/views/admin/api/_field.json.jbuilder +10 -0
  139. data/app/views/admin/api/fetch.json.jbuilder +86 -0
  140. data/app/views/admin/api/index.json.jbuilder +90 -0
  141. data/app/views/admin/bookmarks/_bookmark.json.jbuilder +4 -0
  142. data/app/views/admin/bookmarks/create.js.erb +7 -0
  143. data/app/views/admin/bookmarks/destroy.js.erb +7 -0
  144. data/app/views/admin/bookmarks/index.html.erb +21 -0
  145. data/app/views/admin/bookmarks/index.json.jbuilder +3 -0
  146. data/app/views/admin/bulk_actions/_bulk_action.json.jbuilder +4 -0
  147. data/app/views/admin/bulk_actions/_form.html.erb +17 -0
  148. data/app/views/admin/bulk_actions/edit.html.erb +6 -0
  149. data/app/views/admin/bulk_actions/index.html.erb +54 -0
  150. data/app/views/admin/bulk_actions/index.json.jbuilder +3 -0
  151. data/app/views/admin/bulk_actions/new.html.erb +5 -0
  152. data/app/views/admin/bulk_actions/show.html.erb +100 -0
  153. data/app/views/admin/bulk_actions/show.json.jbuilder +3 -0
  154. data/app/views/admin/devise/confirmations/new.html.erb +16 -0
  155. data/app/views/admin/devise/invitations/edit.html.erb +15 -0
  156. data/app/views/admin/devise/invitations/new.html.erb +15 -0
  157. data/app/views/admin/devise/mailer/invitation_instructions.html.erb +11 -0
  158. data/app/views/admin/devise/mailer/invitation_instructions.text.erb +11 -0
  159. data/app/views/admin/devise/passwords/edit.html.erb +26 -0
  160. data/app/views/admin/devise/passwords/new.html.erb +16 -0
  161. data/app/views/admin/devise/registrations/edit.html.erb +35 -0
  162. data/app/views/admin/devise/registrations/new.html.erb +30 -0
  163. data/app/views/admin/devise/sessions/new.html.erb +28 -0
  164. data/app/views/admin/devise/shared/_links.html.erb +27 -0
  165. data/app/views/admin/devise/unlocks/new.html.erb +16 -0
  166. data/app/views/admin/document_accesses/_document_access.json.jbuilder +4 -0
  167. data/app/views/admin/document_accesses/_form.html.erb +17 -0
  168. data/app/views/admin/document_accesses/destroy_all.html.erb +70 -0
  169. data/app/views/admin/document_accesses/edit.html.erb +5 -0
  170. data/app/views/admin/document_accesses/import.html.erb +70 -0
  171. data/app/views/admin/document_accesses/index.html.erb +74 -0
  172. data/app/views/admin/document_accesses/index.json.jbuilder +3 -0
  173. data/app/views/admin/document_accesses/new.html.erb +6 -0
  174. data/app/views/admin/document_accesses/show.html.erb +19 -0
  175. data/app/views/admin/document_accesses/show.json.jbuilder +3 -0
  176. data/app/views/admin/document_assets/display_attach_form.html.erb +44 -0
  177. data/app/views/admin/document_assets/index.html.erb +65 -0
  178. data/app/views/admin/document_downloads/_document_download.json.jbuilder +4 -0
  179. data/app/views/admin/document_downloads/_form.html.erb +15 -0
  180. data/app/views/admin/document_downloads/destroy_all.html.erb +70 -0
  181. data/app/views/admin/document_downloads/edit.html.erb +6 -0
  182. data/app/views/admin/document_downloads/import.html.erb +74 -0
  183. data/app/views/admin/document_downloads/index.html.erb +70 -0
  184. data/app/views/admin/document_downloads/index.json.jbuilder +3 -0
  185. data/app/views/admin/document_downloads/new.html.erb +5 -0
  186. data/app/views/admin/document_downloads/show.html.erb +24 -0
  187. data/app/views/admin/document_downloads/show.json.jbuilder +3 -0
  188. data/app/views/admin/documents/_document.html.erb +29 -0
  189. data/app/views/admin/documents/_document_bookmark.html.erb +17 -0
  190. data/app/views/admin/documents/_document_fields.html.erb +24 -0
  191. data/app/views/admin/documents/_form.html.erb +49 -0
  192. data/app/views/admin/documents/_form_control.html.erb +86 -0
  193. data/app/views/admin/documents/_form_group.html.erb +1 -0
  194. data/app/views/admin/documents/_form_header.html.erb +1 -0
  195. data/app/views/admin/documents/_form_nav.html.erb +21 -0
  196. data/app/views/admin/documents/_json_aardvark.jbuilder +47 -0
  197. data/app/views/admin/documents/_json_btaa_aardvark.jbuilder +16 -0
  198. data/app/views/admin/documents/_json_gbl_v1.jbuilder +32 -0
  199. data/app/views/admin/documents/_result_facets.html.erb +35 -0
  200. data/app/views/admin/documents/_result_pagination.html.erb +21 -0
  201. data/app/views/admin/documents/_result_selected_options.html.erb +54 -0
  202. data/app/views/admin/documents/_result_selection_options.html.erb +10 -0
  203. data/app/views/admin/documents/_result_toggle.html.erb +13 -0
  204. data/app/views/admin/documents/edit.html.erb +7 -0
  205. data/app/views/admin/documents/features/_assets.html.erb +3 -0
  206. data/app/views/admin/documents/features/_institutional_access_links.html.erb +3 -0
  207. data/app/views/admin/documents/features/_multiple_download_links.html.erb +27 -0
  208. data/app/views/admin/documents/fetch.json_aardvark.jbuilder +9 -0
  209. data/app/views/admin/documents/fetch.json_btaa_aardvark.jbuilder +9 -0
  210. data/app/views/admin/documents/fetch.json_gbl_v1.jbuilder +9 -0
  211. data/app/views/admin/documents/index.html.erb +49 -0
  212. data/app/views/admin/documents/index.json_aardvark.jbuilder +9 -0
  213. data/app/views/admin/documents/index.json_btaa_aardvark.jbuilder +9 -0
  214. data/app/views/admin/documents/index.json_gbl_v1.jbuilder +9 -0
  215. data/app/views/admin/documents/show.json_aardvark.jbuilder +3 -0
  216. data/app/views/admin/documents/show.json_btaa_aardvark.jbuilder +3 -0
  217. data/app/views/admin/documents/show.json_gbl_v1.jbuilder +3 -0
  218. data/app/views/admin/documents/versions.html.erb +110 -0
  219. data/app/views/admin/elements/_element.json.jbuilder +2 -0
  220. data/app/views/admin/elements/_form.html.erb +45 -0
  221. data/app/views/admin/elements/edit.html.erb +6 -0
  222. data/app/views/admin/elements/index.html.erb +68 -0
  223. data/app/views/admin/elements/index.json.jbuilder +1 -0
  224. data/app/views/admin/elements/new.html.erb +5 -0
  225. data/app/views/admin/elements/show.html.erb +121 -0
  226. data/app/views/admin/elements/show.json.jbuilder +1 -0
  227. data/app/views/admin/form_elements/_form.html.erb +46 -0
  228. data/app/views/admin/form_elements/_form_element.json.jbuilder +2 -0
  229. data/app/views/admin/form_elements/edit.html.erb +6 -0
  230. data/app/views/admin/form_elements/index.html.erb +49 -0
  231. data/app/views/admin/form_elements/index.json.jbuilder +1 -0
  232. data/app/views/admin/form_elements/new.html.erb +5 -0
  233. data/app/views/admin/form_elements/show.html.erb +19 -0
  234. data/app/views/admin/form_elements/show.json.jbuilder +1 -0
  235. data/app/views/admin/ids/fetch.json.jbuilder +86 -0
  236. data/app/views/admin/ids/index.json.jbuilder +41 -0
  237. data/app/views/admin/import_documents/show.html.haml +20 -0
  238. data/app/views/admin/imports/_form.html.erb +27 -0
  239. data/app/views/admin/imports/_import.json.jbuilder +4 -0
  240. data/app/views/admin/imports/_show_failed_tab.html.erb +37 -0
  241. data/app/views/admin/imports/_show_success_tab.html.erb +31 -0
  242. data/app/views/admin/imports/edit.html.erb +8 -0
  243. data/app/views/admin/imports/index.html.erb +56 -0
  244. data/app/views/admin/imports/index.json.jbuilder +3 -0
  245. data/app/views/admin/imports/new.html.erb +7 -0
  246. data/app/views/admin/imports/show.html.erb +123 -0
  247. data/app/views/admin/imports/show.json.jbuilder +3 -0
  248. data/app/views/admin/layouts/application.html.erb +30 -0
  249. data/app/views/admin/layouts/blazer/application.html.erb +23 -0
  250. data/app/views/admin/layouts/mailer.html.erb +13 -0
  251. data/app/views/admin/layouts/mailer.text.erb +1 -0
  252. data/app/views/admin/mappings/_form.html.erb +17 -0
  253. data/app/views/admin/mappings/_mapping.json.jbuilder +4 -0
  254. data/app/views/admin/mappings/edit.html.erb +6 -0
  255. data/app/views/admin/mappings/index.html.erb +37 -0
  256. data/app/views/admin/mappings/index.json.jbuilder +3 -0
  257. data/app/views/admin/mappings/new.html.erb +5 -0
  258. data/app/views/admin/mappings/show.html.erb +27 -0
  259. data/app/views/admin/mappings/show.json.jbuilder +3 -0
  260. data/app/views/admin/notifications/_notification.html.haml +31 -0
  261. data/app/views/admin/notifications/index.html.erb +54 -0
  262. data/app/views/admin/notifications/update.js.erb +7 -0
  263. data/app/views/admin/search/index.html.erb +38 -0
  264. data/app/views/admin/shared/_flash_messages.html.erb +5 -0
  265. data/app/views/admin/shared/_footer.html.erb +56 -0
  266. data/app/views/admin/shared/_js_behaviors.html.erb +147 -0
  267. data/app/views/admin/shared/_navbar.html.erb +78 -0
  268. data/app/views/admin/shared/_navbar_blazer.html.erb +42 -0
  269. data/app/views/admin/shared/_schema_timestamp.html.erb +16 -0
  270. data/app/views/admin/shared/_toast.html.erb +13 -0
  271. data/app/views/admin/users/index.html.erb +21 -0
  272. data/config/authorities/formats.yml +25 -0
  273. data/config/authorities/languages.yml +50 -0
  274. data/config/authorities/resource_type.yml +82 -0
  275. data/config/blazer.yml +79 -0
  276. data/config/gbl_v1_schema.json +118 -0
  277. data/config/geomg_aardvark_schema.json +211 -0
  278. data/config/geomg_schema.json +123 -0
  279. data/config/locales/devise.en.yml +65 -0
  280. data/config/locales/devise_invitable.en.yml +31 -0
  281. data/config/locales/documents.en.yml +189 -0
  282. data/config/locales/en.yml +51 -0
  283. data/config/locales/geoblacklight.en.yml +178 -0
  284. data/config/locales/simple_form.en.yml +31 -0
  285. data/config/routes.rb +162 -0
  286. data/db/migrate/20230316183001_add_geoblacklight_admin.rb +399 -0
  287. data/db/seeds.rb +26 -0
  288. data/db/seeds_elements.csv +56 -0
  289. data/db/seeds_elements.numbers +0 -0
  290. data/db/seeds_form_elements.csv +71 -0
  291. data/db/seeds_form_elements.numbers +0 -0
  292. data/db/structure.sql +816 -0
  293. data/geoblacklight_admin.gemspec +67 -0
  294. data/lib/generators/geoblacklight_admin/config_generator.rb +336 -0
  295. data/lib/generators/geoblacklight_admin/example_docs_generator.rb +18 -0
  296. data/lib/generators/geoblacklight_admin/helpers_generator.rb +18 -0
  297. data/lib/generators/geoblacklight_admin/install_generator.rb +60 -0
  298. data/lib/generators/geoblacklight_admin/jobs_generator.rb +21 -0
  299. data/lib/generators/geoblacklight_admin/models_generator.rb +23 -0
  300. data/lib/generators/geoblacklight_admin/templates/.env.development.example +28 -0
  301. data/lib/generators/geoblacklight_admin/templates/.solr_wrapper.yml +7 -0
  302. data/lib/generators/geoblacklight_admin/templates/_user_util_links.html.erb +30 -0
  303. data/lib/generators/geoblacklight_admin/templates/config/database.yml +18 -0
  304. data/lib/generators/geoblacklight_admin/templates/config/geomg_aardvark_schema.json +211 -0
  305. data/lib/generators/geoblacklight_admin/templates/config/initializers/geoblacklight_admin.rb +25 -0
  306. data/lib/generators/geoblacklight_admin/templates/config/initializers/kithe.rb +31 -0
  307. data/lib/generators/geoblacklight_admin/templates/config/initializers/pagy.rb +158 -0
  308. data/lib/generators/geoblacklight_admin/templates/config/initializers/statesman.rb +7 -0
  309. data/lib/generators/geoblacklight_admin/templates/javascript/channels/consumer.js +6 -0
  310. data/lib/generators/geoblacklight_admin/templates/javascript/channels/export_channel.js +30 -0
  311. data/lib/generators/geoblacklight_admin/templates/javascript/channels/index.js +5 -0
  312. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/application_controller.js +17 -0
  313. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/document_controller.js +26 -0
  314. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/index.js +10 -0
  315. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/results_controller.js +310 -0
  316. data/lib/generators/geoblacklight_admin/templates/javascript/packs/application.js +23 -0
  317. data/lib/generators/geoblacklight_admin/templates/javascript/src/js/admin/qa_autocomplete.js +1134 -0
  318. data/lib/generators/geoblacklight_admin/templates/package.json +32 -0
  319. data/lib/generators/geoblacklight_admin/templates/solr/README-geoblacklight-solr-development.txt +3 -0
  320. data/lib/generators/geoblacklight_admin/templates/solr/conf/_rest_managed.json +3 -0
  321. data/lib/generators/geoblacklight_admin/templates/solr/conf/admin-extra.html +31 -0
  322. data/lib/generators/geoblacklight_admin/templates/solr/conf/core.properties +5 -0
  323. data/lib/generators/geoblacklight_admin/templates/solr/conf/elevate.xml +36 -0
  324. data/lib/generators/geoblacklight_admin/templates/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  325. data/lib/generators/geoblacklight_admin/templates/solr/conf/protwords.txt +21 -0
  326. data/lib/generators/geoblacklight_admin/templates/solr/conf/schema.xml +229 -0
  327. data/lib/generators/geoblacklight_admin/templates/solr/conf/scripts.conf +24 -0
  328. data/lib/generators/geoblacklight_admin/templates/solr/conf/solrconfig.xml +266 -0
  329. data/lib/generators/geoblacklight_admin/templates/solr/conf/spellings.txt +2 -0
  330. data/lib/generators/geoblacklight_admin/templates/solr/conf/stopwords.txt +58 -0
  331. data/lib/generators/geoblacklight_admin/templates/solr/conf/stopwords_en.txt +58 -0
  332. data/lib/generators/geoblacklight_admin/templates/solr/conf/synonyms.txt +43 -0
  333. data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/example.xsl +132 -0
  334. data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/example_atom.xsl +67 -0
  335. data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/example_rss.xsl +66 -0
  336. data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/luke.xsl +337 -0
  337. data/lib/generators/geoblacklight_admin/templates/solr/snapshots/.keep +0 -0
  338. data/lib/generators/geoblacklight_admin/views_generator.rb +19 -0
  339. data/lib/geoblacklight_admin/engine.rb +20 -0
  340. data/lib/geoblacklight_admin/version.rb +5 -0
  341. data/lib/geoblacklight_admin.rb +7 -0
  342. data/lib/tasks/.keep +0 -0
  343. data/lib/tasks/geoblacklight_admin.rake +209 -0
  344. data/spec/test_app_templates/lib/generators/test_app_generator.rb +35 -0
  345. data/template.rb +16 -0
  346. metadata +1037 -0
@@ -0,0 +1,2544 @@
1
+ /*! jQuery UI - v1.12.0 - 2016-08-08
2
+ * http://jqueryui.com
3
+ * Includes: widget.js, data.js, scroll-parent.js, widgets/sortable.js, widgets/mouse.js
4
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ (function( factory ) {
7
+ if ( typeof define === "function" && define.amd ) {
8
+
9
+ // AMD. Register as an anonymous module.
10
+ define([ "jquery" ], factory );
11
+ } else {
12
+
13
+ // Browser globals
14
+ factory( jQuery );
15
+ }
16
+ }(function( $ ) {
17
+
18
+ $.ui = $.ui || {};
19
+
20
+ var version = $.ui.version = "1.12.0";
21
+
22
+
23
+ /*!
24
+ * jQuery UI Widget 1.12.0
25
+ * http://jqueryui.com
26
+ *
27
+ * Copyright jQuery Foundation and other contributors
28
+ * Released under the MIT license.
29
+ * http://jquery.org/license
30
+ */
31
+
32
+ //>>label: Widget
33
+ //>>group: Core
34
+ //>>description: Provides a factory for creating stateful widgets with a common API.
35
+ //>>docs: http://api.jqueryui.com/jQuery.widget/
36
+ //>>demos: http://jqueryui.com/widget/
37
+
38
+
39
+
40
+ var widgetUuid = 0;
41
+ var widgetSlice = Array.prototype.slice;
42
+
43
+ $.cleanData = ( function( orig ) {
44
+ return function( elems ) {
45
+ var events, elem, i;
46
+ for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
47
+ try {
48
+
49
+ // Only trigger remove when necessary to save time
50
+ events = $._data( elem, "events" );
51
+ if ( events && events.remove ) {
52
+ $( elem ).triggerHandler( "remove" );
53
+ }
54
+
55
+ // Http://bugs.jquery.com/ticket/8235
56
+ } catch ( e ) {}
57
+ }
58
+ orig( elems );
59
+ };
60
+ } )( $.cleanData );
61
+
62
+ $.widget = function( name, base, prototype ) {
63
+ var existingConstructor, constructor, basePrototype;
64
+
65
+ // ProxiedPrototype allows the provided prototype to remain unmodified
66
+ // so that it can be used as a mixin for multiple widgets (#8876)
67
+ var proxiedPrototype = {};
68
+
69
+ var namespace = name.split( "." )[ 0 ];
70
+ name = name.split( "." )[ 1 ];
71
+ var fullName = namespace + "-" + name;
72
+
73
+ if ( !prototype ) {
74
+ prototype = base;
75
+ base = $.Widget;
76
+ }
77
+
78
+ if ( $.isArray( prototype ) ) {
79
+ prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
80
+ }
81
+
82
+ // Create selector for plugin
83
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
84
+ return !!$.data( elem, fullName );
85
+ };
86
+
87
+ $[ namespace ] = $[ namespace ] || {};
88
+ existingConstructor = $[ namespace ][ name ];
89
+ constructor = $[ namespace ][ name ] = function( options, element ) {
90
+
91
+ // Allow instantiation without "new" keyword
92
+ if ( !this._createWidget ) {
93
+ return new constructor( options, element );
94
+ }
95
+
96
+ // Allow instantiation without initializing for simple inheritance
97
+ // must use "new" keyword (the code above always passes args)
98
+ if ( arguments.length ) {
99
+ this._createWidget( options, element );
100
+ }
101
+ };
102
+
103
+ // Extend with the existing constructor to carry over any static properties
104
+ $.extend( constructor, existingConstructor, {
105
+ version: prototype.version,
106
+
107
+ // Copy the object used to create the prototype in case we need to
108
+ // redefine the widget later
109
+ _proto: $.extend( {}, prototype ),
110
+
111
+ // Track widgets that inherit from this widget in case this widget is
112
+ // redefined after a widget inherits from it
113
+ _childConstructors: []
114
+ } );
115
+
116
+ basePrototype = new base();
117
+
118
+ // We need to make the options hash a property directly on the new instance
119
+ // otherwise we'll modify the options hash on the prototype that we're
120
+ // inheriting from
121
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
122
+ $.each( prototype, function( prop, value ) {
123
+ if ( !$.isFunction( value ) ) {
124
+ proxiedPrototype[ prop ] = value;
125
+ return;
126
+ }
127
+ proxiedPrototype[ prop ] = ( function() {
128
+ function _super() {
129
+ return base.prototype[ prop ].apply( this, arguments );
130
+ }
131
+
132
+ function _superApply( args ) {
133
+ return base.prototype[ prop ].apply( this, args );
134
+ }
135
+
136
+ return function() {
137
+ var __super = this._super;
138
+ var __superApply = this._superApply;
139
+ var returnValue;
140
+
141
+ this._super = _super;
142
+ this._superApply = _superApply;
143
+
144
+ returnValue = value.apply( this, arguments );
145
+
146
+ this._super = __super;
147
+ this._superApply = __superApply;
148
+
149
+ return returnValue;
150
+ };
151
+ } )();
152
+ } );
153
+ constructor.prototype = $.widget.extend( basePrototype, {
154
+
155
+ // TODO: remove support for widgetEventPrefix
156
+ // always use the name + a colon as the prefix, e.g., draggable:start
157
+ // don't prefix for widgets that aren't DOM-based
158
+ widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
159
+ }, proxiedPrototype, {
160
+ constructor: constructor,
161
+ namespace: namespace,
162
+ widgetName: name,
163
+ widgetFullName: fullName
164
+ } );
165
+
166
+ // If this widget is being redefined then we need to find all widgets that
167
+ // are inheriting from it and redefine all of them so that they inherit from
168
+ // the new version of this widget. We're essentially trying to replace one
169
+ // level in the prototype chain.
170
+ if ( existingConstructor ) {
171
+ $.each( existingConstructor._childConstructors, function( i, child ) {
172
+ var childPrototype = child.prototype;
173
+
174
+ // Redefine the child widget using the same prototype that was
175
+ // originally used, but inherit from the new version of the base
176
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
177
+ child._proto );
178
+ } );
179
+
180
+ // Remove the list of existing child constructors from the old constructor
181
+ // so the old child constructors can be garbage collected
182
+ delete existingConstructor._childConstructors;
183
+ } else {
184
+ base._childConstructors.push( constructor );
185
+ }
186
+
187
+ $.widget.bridge( name, constructor );
188
+
189
+ return constructor;
190
+ };
191
+
192
+ $.widget.extend = function( target ) {
193
+ var input = widgetSlice.call( arguments, 1 );
194
+ var inputIndex = 0;
195
+ var inputLength = input.length;
196
+ var key;
197
+ var value;
198
+
199
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
200
+ for ( key in input[ inputIndex ] ) {
201
+ value = input[ inputIndex ][ key ];
202
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
203
+
204
+ // Clone objects
205
+ if ( $.isPlainObject( value ) ) {
206
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
207
+ $.widget.extend( {}, target[ key ], value ) :
208
+
209
+ // Don't extend strings, arrays, etc. with objects
210
+ $.widget.extend( {}, value );
211
+
212
+ // Copy everything else by reference
213
+ } else {
214
+ target[ key ] = value;
215
+ }
216
+ }
217
+ }
218
+ }
219
+ return target;
220
+ };
221
+
222
+ $.widget.bridge = function( name, object ) {
223
+ var fullName = object.prototype.widgetFullName || name;
224
+ $.fn[ name ] = function( options ) {
225
+ var isMethodCall = typeof options === "string";
226
+ var args = widgetSlice.call( arguments, 1 );
227
+ var returnValue = this;
228
+
229
+ if ( isMethodCall ) {
230
+ this.each( function() {
231
+ var methodValue;
232
+ var instance = $.data( this, fullName );
233
+
234
+ if ( options === "instance" ) {
235
+ returnValue = instance;
236
+ return false;
237
+ }
238
+
239
+ if ( !instance ) {
240
+ return $.error( "cannot call methods on " + name +
241
+ " prior to initialization; " +
242
+ "attempted to call method '" + options + "'" );
243
+ }
244
+
245
+ if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
246
+ return $.error( "no such method '" + options + "' for " + name +
247
+ " widget instance" );
248
+ }
249
+
250
+ methodValue = instance[ options ].apply( instance, args );
251
+
252
+ if ( methodValue !== instance && methodValue !== undefined ) {
253
+ returnValue = methodValue && methodValue.jquery ?
254
+ returnValue.pushStack( methodValue.get() ) :
255
+ methodValue;
256
+ return false;
257
+ }
258
+ } );
259
+ } else {
260
+
261
+ // Allow multiple hashes to be passed on init
262
+ if ( args.length ) {
263
+ options = $.widget.extend.apply( null, [ options ].concat( args ) );
264
+ }
265
+
266
+ this.each( function() {
267
+ var instance = $.data( this, fullName );
268
+ if ( instance ) {
269
+ instance.option( options || {} );
270
+ if ( instance._init ) {
271
+ instance._init();
272
+ }
273
+ } else {
274
+ $.data( this, fullName, new object( options, this ) );
275
+ }
276
+ } );
277
+ }
278
+
279
+ return returnValue;
280
+ };
281
+ };
282
+
283
+ $.Widget = function( /* options, element */ ) {};
284
+ $.Widget._childConstructors = [];
285
+
286
+ $.Widget.prototype = {
287
+ widgetName: "widget",
288
+ widgetEventPrefix: "",
289
+ defaultElement: "<div>",
290
+
291
+ options: {
292
+ classes: {},
293
+ disabled: false,
294
+
295
+ // Callbacks
296
+ create: null
297
+ },
298
+
299
+ _createWidget: function( options, element ) {
300
+ element = $( element || this.defaultElement || this )[ 0 ];
301
+ this.element = $( element );
302
+ this.uuid = widgetUuid++;
303
+ this.eventNamespace = "." + this.widgetName + this.uuid;
304
+
305
+ this.bindings = $();
306
+ this.hoverable = $();
307
+ this.focusable = $();
308
+ this.classesElementLookup = {};
309
+
310
+ if ( element !== this ) {
311
+ $.data( element, this.widgetFullName, this );
312
+ this._on( true, this.element, {
313
+ remove: function( event ) {
314
+ if ( event.target === element ) {
315
+ this.destroy();
316
+ }
317
+ }
318
+ } );
319
+ this.document = $( element.style ?
320
+
321
+ // Element within the document
322
+ element.ownerDocument :
323
+
324
+ // Element is window or document
325
+ element.document || element );
326
+ this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
327
+ }
328
+
329
+ this.options = $.widget.extend( {},
330
+ this.options,
331
+ this._getCreateOptions(),
332
+ options );
333
+
334
+ this._create();
335
+
336
+ if ( this.options.disabled ) {
337
+ this._setOptionDisabled( this.options.disabled );
338
+ }
339
+
340
+ this._trigger( "create", null, this._getCreateEventData() );
341
+ this._init();
342
+ },
343
+
344
+ _getCreateOptions: function() {
345
+ return {};
346
+ },
347
+
348
+ _getCreateEventData: $.noop,
349
+
350
+ _create: $.noop,
351
+
352
+ _init: $.noop,
353
+
354
+ destroy: function() {
355
+ var that = this;
356
+
357
+ this._destroy();
358
+ $.each( this.classesElementLookup, function( key, value ) {
359
+ that._removeClass( value, key );
360
+ } );
361
+
362
+ // We can probably remove the unbind calls in 2.0
363
+ // all event bindings should go through this._on()
364
+ this.element
365
+ .off( this.eventNamespace )
366
+ .removeData( this.widgetFullName );
367
+ this.widget()
368
+ .off( this.eventNamespace )
369
+ .removeAttr( "aria-disabled" );
370
+
371
+ // Clean up events and states
372
+ this.bindings.off( this.eventNamespace );
373
+ },
374
+
375
+ _destroy: $.noop,
376
+
377
+ widget: function() {
378
+ return this.element;
379
+ },
380
+
381
+ option: function( key, value ) {
382
+ var options = key;
383
+ var parts;
384
+ var curOption;
385
+ var i;
386
+
387
+ if ( arguments.length === 0 ) {
388
+
389
+ // Don't return a reference to the internal hash
390
+ return $.widget.extend( {}, this.options );
391
+ }
392
+
393
+ if ( typeof key === "string" ) {
394
+
395
+ // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
396
+ options = {};
397
+ parts = key.split( "." );
398
+ key = parts.shift();
399
+ if ( parts.length ) {
400
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
401
+ for ( i = 0; i < parts.length - 1; i++ ) {
402
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
403
+ curOption = curOption[ parts[ i ] ];
404
+ }
405
+ key = parts.pop();
406
+ if ( arguments.length === 1 ) {
407
+ return curOption[ key ] === undefined ? null : curOption[ key ];
408
+ }
409
+ curOption[ key ] = value;
410
+ } else {
411
+ if ( arguments.length === 1 ) {
412
+ return this.options[ key ] === undefined ? null : this.options[ key ];
413
+ }
414
+ options[ key ] = value;
415
+ }
416
+ }
417
+
418
+ this._setOptions( options );
419
+
420
+ return this;
421
+ },
422
+
423
+ _setOptions: function( options ) {
424
+ var key;
425
+
426
+ for ( key in options ) {
427
+ this._setOption( key, options[ key ] );
428
+ }
429
+
430
+ return this;
431
+ },
432
+
433
+ _setOption: function( key, value ) {
434
+ if ( key === "classes" ) {
435
+ this._setOptionClasses( value );
436
+ }
437
+
438
+ this.options[ key ] = value;
439
+
440
+ if ( key === "disabled" ) {
441
+ this._setOptionDisabled( value );
442
+ }
443
+
444
+ return this;
445
+ },
446
+
447
+ _setOptionClasses: function( value ) {
448
+ var classKey, elements, currentElements;
449
+
450
+ for ( classKey in value ) {
451
+ currentElements = this.classesElementLookup[ classKey ];
452
+ if ( value[ classKey ] === this.options.classes[ classKey ] ||
453
+ !currentElements ||
454
+ !currentElements.length ) {
455
+ continue;
456
+ }
457
+
458
+ // We are doing this to create a new jQuery object because the _removeClass() call
459
+ // on the next line is going to destroy the reference to the current elements being
460
+ // tracked. We need to save a copy of this collection so that we can add the new classes
461
+ // below.
462
+ elements = $( currentElements.get() );
463
+ this._removeClass( currentElements, classKey );
464
+
465
+ // We don't use _addClass() here, because that uses this.options.classes
466
+ // for generating the string of classes. We want to use the value passed in from
467
+ // _setOption(), this is the new value of the classes option which was passed to
468
+ // _setOption(). We pass this value directly to _classes().
469
+ elements.addClass( this._classes( {
470
+ element: elements,
471
+ keys: classKey,
472
+ classes: value,
473
+ add: true
474
+ } ) );
475
+ }
476
+ },
477
+
478
+ _setOptionDisabled: function( value ) {
479
+ this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
480
+
481
+ // If the widget is becoming disabled, then nothing is interactive
482
+ if ( value ) {
483
+ this._removeClass( this.hoverable, null, "ui-state-hover" );
484
+ this._removeClass( this.focusable, null, "ui-state-focus" );
485
+ }
486
+ },
487
+
488
+ enable: function() {
489
+ return this._setOptions( { disabled: false } );
490
+ },
491
+
492
+ disable: function() {
493
+ return this._setOptions( { disabled: true } );
494
+ },
495
+
496
+ _classes: function( options ) {
497
+ var full = [];
498
+ var that = this;
499
+
500
+ options = $.extend( {
501
+ element: this.element,
502
+ classes: this.options.classes || {}
503
+ }, options );
504
+
505
+ function processClassString( classes, checkOption ) {
506
+ var current, i;
507
+ for ( i = 0; i < classes.length; i++ ) {
508
+ current = that.classesElementLookup[ classes[ i ] ] || $();
509
+ if ( options.add ) {
510
+ current = $( $.unique( current.get().concat( options.element.get() ) ) );
511
+ } else {
512
+ current = $( current.not( options.element ).get() );
513
+ }
514
+ that.classesElementLookup[ classes[ i ] ] = current;
515
+ full.push( classes[ i ] );
516
+ if ( checkOption && options.classes[ classes[ i ] ] ) {
517
+ full.push( options.classes[ classes[ i ] ] );
518
+ }
519
+ }
520
+ }
521
+
522
+ if ( options.keys ) {
523
+ processClassString( options.keys.match( /\S+/g ) || [], true );
524
+ }
525
+ if ( options.extra ) {
526
+ processClassString( options.extra.match( /\S+/g ) || [] );
527
+ }
528
+
529
+ return full.join( " " );
530
+ },
531
+
532
+ _removeClass: function( element, keys, extra ) {
533
+ return this._toggleClass( element, keys, extra, false );
534
+ },
535
+
536
+ _addClass: function( element, keys, extra ) {
537
+ return this._toggleClass( element, keys, extra, true );
538
+ },
539
+
540
+ _toggleClass: function( element, keys, extra, add ) {
541
+ add = ( typeof add === "boolean" ) ? add : extra;
542
+ var shift = ( typeof element === "string" || element === null ),
543
+ options = {
544
+ extra: shift ? keys : extra,
545
+ keys: shift ? element : keys,
546
+ element: shift ? this.element : element,
547
+ add: add
548
+ };
549
+ options.element.toggleClass( this._classes( options ), add );
550
+ return this;
551
+ },
552
+
553
+ _on: function( suppressDisabledCheck, element, handlers ) {
554
+ var delegateElement;
555
+ var instance = this;
556
+
557
+ // No suppressDisabledCheck flag, shuffle arguments
558
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
559
+ handlers = element;
560
+ element = suppressDisabledCheck;
561
+ suppressDisabledCheck = false;
562
+ }
563
+
564
+ // No element argument, shuffle and use this.element
565
+ if ( !handlers ) {
566
+ handlers = element;
567
+ element = this.element;
568
+ delegateElement = this.widget();
569
+ } else {
570
+ element = delegateElement = $( element );
571
+ this.bindings = this.bindings.add( element );
572
+ }
573
+
574
+ $.each( handlers, function( event, handler ) {
575
+ function handlerProxy() {
576
+
577
+ // Allow widgets to customize the disabled handling
578
+ // - disabled as an array instead of boolean
579
+ // - disabled class as method for disabling individual parts
580
+ if ( !suppressDisabledCheck &&
581
+ ( instance.options.disabled === true ||
582
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
583
+ return;
584
+ }
585
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
586
+ .apply( instance, arguments );
587
+ }
588
+
589
+ // Copy the guid so direct unbinding works
590
+ if ( typeof handler !== "string" ) {
591
+ handlerProxy.guid = handler.guid =
592
+ handler.guid || handlerProxy.guid || $.guid++;
593
+ }
594
+
595
+ var match = event.match( /^([\w:-]*)\s*(.*)$/ );
596
+ var eventName = match[ 1 ] + instance.eventNamespace;
597
+ var selector = match[ 2 ];
598
+
599
+ if ( selector ) {
600
+ delegateElement.on( eventName, selector, handlerProxy );
601
+ } else {
602
+ element.on( eventName, handlerProxy );
603
+ }
604
+ } );
605
+ },
606
+
607
+ _off: function( element, eventName ) {
608
+ eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
609
+ this.eventNamespace;
610
+ element.off( eventName ).off( eventName );
611
+
612
+ // Clear the stack to avoid memory leaks (#10056)
613
+ this.bindings = $( this.bindings.not( element ).get() );
614
+ this.focusable = $( this.focusable.not( element ).get() );
615
+ this.hoverable = $( this.hoverable.not( element ).get() );
616
+ },
617
+
618
+ _delay: function( handler, delay ) {
619
+ function handlerProxy() {
620
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
621
+ .apply( instance, arguments );
622
+ }
623
+ var instance = this;
624
+ return setTimeout( handlerProxy, delay || 0 );
625
+ },
626
+
627
+ _hoverable: function( element ) {
628
+ this.hoverable = this.hoverable.add( element );
629
+ this._on( element, {
630
+ mouseenter: function( event ) {
631
+ this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
632
+ },
633
+ mouseleave: function( event ) {
634
+ this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
635
+ }
636
+ } );
637
+ },
638
+
639
+ _focusable: function( element ) {
640
+ this.focusable = this.focusable.add( element );
641
+ this._on( element, {
642
+ focusin: function( event ) {
643
+ this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
644
+ },
645
+ focusout: function( event ) {
646
+ this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
647
+ }
648
+ } );
649
+ },
650
+
651
+ _trigger: function( type, event, data ) {
652
+ var prop, orig;
653
+ var callback = this.options[ type ];
654
+
655
+ data = data || {};
656
+ event = $.Event( event );
657
+ event.type = ( type === this.widgetEventPrefix ?
658
+ type :
659
+ this.widgetEventPrefix + type ).toLowerCase();
660
+
661
+ // The original event may come from any element
662
+ // so we need to reset the target on the new event
663
+ event.target = this.element[ 0 ];
664
+
665
+ // Copy original event properties over to the new event
666
+ orig = event.originalEvent;
667
+ if ( orig ) {
668
+ for ( prop in orig ) {
669
+ if ( !( prop in event ) ) {
670
+ event[ prop ] = orig[ prop ];
671
+ }
672
+ }
673
+ }
674
+
675
+ this.element.trigger( event, data );
676
+ return !( $.isFunction( callback ) &&
677
+ callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
678
+ event.isDefaultPrevented() );
679
+ }
680
+ };
681
+
682
+ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
683
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
684
+ if ( typeof options === "string" ) {
685
+ options = { effect: options };
686
+ }
687
+
688
+ var hasOptions;
689
+ var effectName = !options ?
690
+ method :
691
+ options === true || typeof options === "number" ?
692
+ defaultEffect :
693
+ options.effect || defaultEffect;
694
+
695
+ options = options || {};
696
+ if ( typeof options === "number" ) {
697
+ options = { duration: options };
698
+ }
699
+
700
+ hasOptions = !$.isEmptyObject( options );
701
+ options.complete = callback;
702
+
703
+ if ( options.delay ) {
704
+ element.delay( options.delay );
705
+ }
706
+
707
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
708
+ element[ method ]( options );
709
+ } else if ( effectName !== method && element[ effectName ] ) {
710
+ element[ effectName ]( options.duration, options.easing, callback );
711
+ } else {
712
+ element.queue( function( next ) {
713
+ $( this )[ method ]();
714
+ if ( callback ) {
715
+ callback.call( element[ 0 ] );
716
+ }
717
+ next();
718
+ } );
719
+ }
720
+ };
721
+ } );
722
+
723
+ var widget = $.widget;
724
+
725
+
726
+ /*!
727
+ * jQuery UI :data 1.12.0
728
+ * http://jqueryui.com
729
+ *
730
+ * Copyright jQuery Foundation and other contributors
731
+ * Released under the MIT license.
732
+ * http://jquery.org/license
733
+ */
734
+
735
+ //>>label: :data Selector
736
+ //>>group: Core
737
+ //>>description: Selects elements which have data stored under the specified key.
738
+ //>>docs: http://api.jqueryui.com/data-selector/
739
+
740
+
741
+ var data = $.extend( $.expr[ ":" ], {
742
+ data: $.expr.createPseudo ?
743
+ $.expr.createPseudo( function( dataName ) {
744
+ return function( elem ) {
745
+ return !!$.data( elem, dataName );
746
+ };
747
+ } ) :
748
+
749
+ // Support: jQuery <1.8
750
+ function( elem, i, match ) {
751
+ return !!$.data( elem, match[ 3 ] );
752
+ }
753
+ } );
754
+
755
+ /*!
756
+ * jQuery UI Scroll Parent 1.12.0
757
+ * http://jqueryui.com
758
+ *
759
+ * Copyright jQuery Foundation and other contributors
760
+ * Released under the MIT license.
761
+ * http://jquery.org/license
762
+ */
763
+
764
+ //>>label: scrollParent
765
+ //>>group: Core
766
+ //>>description: Get the closest ancestor element that is scrollable.
767
+ //>>docs: http://api.jqueryui.com/scrollParent/
768
+
769
+
770
+
771
+ var scrollParent = $.fn.scrollParent = function( includeHidden ) {
772
+ var position = this.css( "position" ),
773
+ excludeStaticParent = position === "absolute",
774
+ overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
775
+ scrollParent = this.parents().filter( function() {
776
+ var parent = $( this );
777
+ if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
778
+ return false;
779
+ }
780
+ return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
781
+ parent.css( "overflow-x" ) );
782
+ } ).eq( 0 );
783
+
784
+ return position === "fixed" || !scrollParent.length ?
785
+ $( this[ 0 ].ownerDocument || document ) :
786
+ scrollParent;
787
+ };
788
+
789
+
790
+
791
+
792
+ // This file is deprecated
793
+ var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
794
+
795
+ /*!
796
+ * jQuery UI Mouse 1.12.0
797
+ * http://jqueryui.com
798
+ *
799
+ * Copyright jQuery Foundation and other contributors
800
+ * Released under the MIT license.
801
+ * http://jquery.org/license
802
+ */
803
+
804
+ //>>label: Mouse
805
+ //>>group: Widgets
806
+ //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
807
+ //>>docs: http://api.jqueryui.com/mouse/
808
+
809
+
810
+
811
+ var mouseHandled = false;
812
+ $( document ).on( "mouseup", function() {
813
+ mouseHandled = false;
814
+ } );
815
+
816
+ var widgetsMouse = $.widget( "ui.mouse", {
817
+ version: "1.12.0",
818
+ options: {
819
+ cancel: "input, textarea, button, select, option",
820
+ distance: 1,
821
+ delay: 0
822
+ },
823
+ _mouseInit: function() {
824
+ var that = this;
825
+
826
+ this.element
827
+ .on( "mousedown." + this.widgetName, function( event ) {
828
+ return that._mouseDown( event );
829
+ } )
830
+ .on( "click." + this.widgetName, function( event ) {
831
+ if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
832
+ $.removeData( event.target, that.widgetName + ".preventClickEvent" );
833
+ event.stopImmediatePropagation();
834
+ return false;
835
+ }
836
+ } );
837
+
838
+ this.started = false;
839
+ },
840
+
841
+ // TODO: make sure destroying one instance of mouse doesn't mess with
842
+ // other instances of mouse
843
+ _mouseDestroy: function() {
844
+ this.element.off( "." + this.widgetName );
845
+ if ( this._mouseMoveDelegate ) {
846
+ this.document
847
+ .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
848
+ .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
849
+ }
850
+ },
851
+
852
+ _mouseDown: function( event ) {
853
+
854
+ // don't let more than one widget handle mouseStart
855
+ if ( mouseHandled ) {
856
+ return;
857
+ }
858
+
859
+ this._mouseMoved = false;
860
+
861
+ // We may have missed mouseup (out of window)
862
+ ( this._mouseStarted && this._mouseUp( event ) );
863
+
864
+ this._mouseDownEvent = event;
865
+
866
+ var that = this,
867
+ btnIsLeft = ( event.which === 1 ),
868
+
869
+ // event.target.nodeName works around a bug in IE 8 with
870
+ // disabled inputs (#7620)
871
+ elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
872
+ $( event.target ).closest( this.options.cancel ).length : false );
873
+ if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
874
+ return true;
875
+ }
876
+
877
+ this.mouseDelayMet = !this.options.delay;
878
+ if ( !this.mouseDelayMet ) {
879
+ this._mouseDelayTimer = setTimeout( function() {
880
+ that.mouseDelayMet = true;
881
+ }, this.options.delay );
882
+ }
883
+
884
+ if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
885
+ this._mouseStarted = ( this._mouseStart( event ) !== false );
886
+ if ( !this._mouseStarted ) {
887
+ event.preventDefault();
888
+ return true;
889
+ }
890
+ }
891
+
892
+ // Click event may never have fired (Gecko & Opera)
893
+ if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
894
+ $.removeData( event.target, this.widgetName + ".preventClickEvent" );
895
+ }
896
+
897
+ // These delegates are required to keep context
898
+ this._mouseMoveDelegate = function( event ) {
899
+ return that._mouseMove( event );
900
+ };
901
+ this._mouseUpDelegate = function( event ) {
902
+ return that._mouseUp( event );
903
+ };
904
+
905
+ this.document
906
+ .on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
907
+ .on( "mouseup." + this.widgetName, this._mouseUpDelegate );
908
+
909
+ event.preventDefault();
910
+
911
+ mouseHandled = true;
912
+ return true;
913
+ },
914
+
915
+ _mouseMove: function( event ) {
916
+
917
+ // Only check for mouseups outside the document if you've moved inside the document
918
+ // at least once. This prevents the firing of mouseup in the case of IE<9, which will
919
+ // fire a mousemove event if content is placed under the cursor. See #7778
920
+ // Support: IE <9
921
+ if ( this._mouseMoved ) {
922
+
923
+ // IE mouseup check - mouseup happened when mouse was out of window
924
+ if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
925
+ !event.button ) {
926
+ return this._mouseUp( event );
927
+
928
+ // Iframe mouseup check - mouseup occurred in another document
929
+ } else if ( !event.which ) {
930
+
931
+ // Support: Safari <=8 - 9
932
+ // Safari sets which to 0 if you press any of the following keys
933
+ // during a drag (#14461)
934
+ if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
935
+ event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
936
+ this.ignoreMissingWhich = true;
937
+ } else if ( !this.ignoreMissingWhich ) {
938
+ return this._mouseUp( event );
939
+ }
940
+ }
941
+ }
942
+
943
+ if ( event.which || event.button ) {
944
+ this._mouseMoved = true;
945
+ }
946
+
947
+ if ( this._mouseStarted ) {
948
+ this._mouseDrag( event );
949
+ return event.preventDefault();
950
+ }
951
+
952
+ if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
953
+ this._mouseStarted =
954
+ ( this._mouseStart( this._mouseDownEvent, event ) !== false );
955
+ ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
956
+ }
957
+
958
+ return !this._mouseStarted;
959
+ },
960
+
961
+ _mouseUp: function( event ) {
962
+ this.document
963
+ .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
964
+ .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
965
+
966
+ if ( this._mouseStarted ) {
967
+ this._mouseStarted = false;
968
+
969
+ if ( event.target === this._mouseDownEvent.target ) {
970
+ $.data( event.target, this.widgetName + ".preventClickEvent", true );
971
+ }
972
+
973
+ this._mouseStop( event );
974
+ }
975
+
976
+ if ( this._mouseDelayTimer ) {
977
+ clearTimeout( this._mouseDelayTimer );
978
+ delete this._mouseDelayTimer;
979
+ }
980
+
981
+ this.ignoreMissingWhich = false;
982
+ mouseHandled = false;
983
+ event.preventDefault();
984
+ },
985
+
986
+ _mouseDistanceMet: function( event ) {
987
+ return ( Math.max(
988
+ Math.abs( this._mouseDownEvent.pageX - event.pageX ),
989
+ Math.abs( this._mouseDownEvent.pageY - event.pageY )
990
+ ) >= this.options.distance
991
+ );
992
+ },
993
+
994
+ _mouseDelayMet: function( /* event */ ) {
995
+ return this.mouseDelayMet;
996
+ },
997
+
998
+ // These are placeholder methods, to be overriden by extending plugin
999
+ _mouseStart: function( /* event */ ) {},
1000
+ _mouseDrag: function( /* event */ ) {},
1001
+ _mouseStop: function( /* event */ ) {},
1002
+ _mouseCapture: function( /* event */ ) { return true; }
1003
+ } );
1004
+
1005
+
1006
+ /*!
1007
+ * jQuery UI Sortable 1.12.0
1008
+ * http://jqueryui.com
1009
+ *
1010
+ * Copyright jQuery Foundation and other contributors
1011
+ * Released under the MIT license.
1012
+ * http://jquery.org/license
1013
+ */
1014
+
1015
+ //>>label: Sortable
1016
+ //>>group: Interactions
1017
+ //>>description: Enables items in a list to be sorted using the mouse.
1018
+ //>>docs: http://api.jqueryui.com/sortable/
1019
+ //>>demos: http://jqueryui.com/sortable/
1020
+ //>>css.structure: ../../themes/base/sortable.css
1021
+
1022
+
1023
+
1024
+ var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, {
1025
+ version: "1.12.0",
1026
+ widgetEventPrefix: "sort",
1027
+ ready: false,
1028
+ options: {
1029
+ appendTo: "parent",
1030
+ axis: false,
1031
+ connectWith: false,
1032
+ containment: false,
1033
+ cursor: "auto",
1034
+ cursorAt: false,
1035
+ dropOnEmpty: true,
1036
+ forcePlaceholderSize: false,
1037
+ forceHelperSize: false,
1038
+ grid: false,
1039
+ handle: false,
1040
+ helper: "original",
1041
+ items: "> *",
1042
+ opacity: false,
1043
+ placeholder: false,
1044
+ revert: false,
1045
+ scroll: true,
1046
+ scrollSensitivity: 20,
1047
+ scrollSpeed: 20,
1048
+ scope: "default",
1049
+ tolerance: "intersect",
1050
+ zIndex: 1000,
1051
+
1052
+ // Callbacks
1053
+ activate: null,
1054
+ beforeStop: null,
1055
+ change: null,
1056
+ deactivate: null,
1057
+ out: null,
1058
+ over: null,
1059
+ receive: null,
1060
+ remove: null,
1061
+ sort: null,
1062
+ start: null,
1063
+ stop: null,
1064
+ update: null
1065
+ },
1066
+
1067
+ _isOverAxis: function( x, reference, size ) {
1068
+ return ( x >= reference ) && ( x < ( reference + size ) );
1069
+ },
1070
+
1071
+ _isFloating: function( item ) {
1072
+ return ( /left|right/ ).test( item.css( "float" ) ) ||
1073
+ ( /inline|table-cell/ ).test( item.css( "display" ) );
1074
+ },
1075
+
1076
+ _create: function() {
1077
+ this.containerCache = {};
1078
+ this._addClass( "ui-sortable" );
1079
+
1080
+ //Get the items
1081
+ this.refresh();
1082
+
1083
+ //Let's determine the parent's offset
1084
+ this.offset = this.element.offset();
1085
+
1086
+ //Initialize mouse events for interaction
1087
+ this._mouseInit();
1088
+
1089
+ this._setHandleClassName();
1090
+
1091
+ //We're ready to go
1092
+ this.ready = true;
1093
+
1094
+ },
1095
+
1096
+ _setOption: function( key, value ) {
1097
+ this._super( key, value );
1098
+
1099
+ if ( key === "handle" ) {
1100
+ this._setHandleClassName();
1101
+ }
1102
+ },
1103
+
1104
+ _setHandleClassName: function() {
1105
+ var that = this;
1106
+ this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );
1107
+ $.each( this.items, function() {
1108
+ that._addClass(
1109
+ this.instance.options.handle ?
1110
+ this.item.find( this.instance.options.handle ) :
1111
+ this.item,
1112
+ "ui-sortable-handle"
1113
+ );
1114
+ } );
1115
+ },
1116
+
1117
+ _destroy: function() {
1118
+ this._mouseDestroy();
1119
+
1120
+ for ( var i = this.items.length - 1; i >= 0; i-- ) {
1121
+ this.items[ i ].item.removeData( this.widgetName + "-item" );
1122
+ }
1123
+
1124
+ return this;
1125
+ },
1126
+
1127
+ _mouseCapture: function( event, overrideHandle ) {
1128
+ var currentItem = null,
1129
+ validHandle = false,
1130
+ that = this;
1131
+
1132
+ if ( this.reverting ) {
1133
+ return false;
1134
+ }
1135
+
1136
+ if ( this.options.disabled || this.options.type === "static" ) {
1137
+ return false;
1138
+ }
1139
+
1140
+ //We have to refresh the items data once first
1141
+ this._refreshItems( event );
1142
+
1143
+ //Find out if the clicked node (or one of its parents) is a actual item in this.items
1144
+ $( event.target ).parents().each( function() {
1145
+ if ( $.data( this, that.widgetName + "-item" ) === that ) {
1146
+ currentItem = $( this );
1147
+ return false;
1148
+ }
1149
+ } );
1150
+ if ( $.data( event.target, that.widgetName + "-item" ) === that ) {
1151
+ currentItem = $( event.target );
1152
+ }
1153
+
1154
+ if ( !currentItem ) {
1155
+ return false;
1156
+ }
1157
+ if ( this.options.handle && !overrideHandle ) {
1158
+ $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {
1159
+ if ( this === event.target ) {
1160
+ validHandle = true;
1161
+ }
1162
+ } );
1163
+ if ( !validHandle ) {
1164
+ return false;
1165
+ }
1166
+ }
1167
+
1168
+ this.currentItem = currentItem;
1169
+ this._removeCurrentsFromItems();
1170
+ return true;
1171
+
1172
+ },
1173
+
1174
+ _mouseStart: function( event, overrideHandle, noActivation ) {
1175
+
1176
+ var i, body,
1177
+ o = this.options;
1178
+
1179
+ this.currentContainer = this;
1180
+
1181
+ //We only need to call refreshPositions, because the refreshItems call has been moved to
1182
+ // mouseCapture
1183
+ this.refreshPositions();
1184
+
1185
+ //Create and append the visible helper
1186
+ this.helper = this._createHelper( event );
1187
+
1188
+ //Cache the helper size
1189
+ this._cacheHelperProportions();
1190
+
1191
+ /*
1192
+ * - Position generation -
1193
+ * This block generates everything position related - it's the core of draggables.
1194
+ */
1195
+
1196
+ //Cache the margins of the original element
1197
+ this._cacheMargins();
1198
+
1199
+ //Get the next scrolling parent
1200
+ this.scrollParent = this.helper.scrollParent();
1201
+
1202
+ //The element's absolute position on the page minus margins
1203
+ this.offset = this.currentItem.offset();
1204
+ this.offset = {
1205
+ top: this.offset.top - this.margins.top,
1206
+ left: this.offset.left - this.margins.left
1207
+ };
1208
+
1209
+ $.extend( this.offset, {
1210
+ click: { //Where the click happened, relative to the element
1211
+ left: event.pageX - this.offset.left,
1212
+ top: event.pageY - this.offset.top
1213
+ },
1214
+ parent: this._getParentOffset(),
1215
+
1216
+ // This is a relative to absolute position minus the actual position calculation -
1217
+ // only used for relative positioned helper
1218
+ relative: this._getRelativeOffset()
1219
+ } );
1220
+
1221
+ // Only after we got the offset, we can change the helper's position to absolute
1222
+ // TODO: Still need to figure out a way to make relative sorting possible
1223
+ this.helper.css( "position", "absolute" );
1224
+ this.cssPosition = this.helper.css( "position" );
1225
+
1226
+ //Generate the original position
1227
+ this.originalPosition = this._generatePosition( event );
1228
+ this.originalPageX = event.pageX;
1229
+ this.originalPageY = event.pageY;
1230
+
1231
+ //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
1232
+ ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
1233
+
1234
+ //Cache the former DOM position
1235
+ this.domPosition = {
1236
+ prev: this.currentItem.prev()[ 0 ],
1237
+ parent: this.currentItem.parent()[ 0 ]
1238
+ };
1239
+
1240
+ // If the helper is not the original, hide the original so it's not playing any role during
1241
+ // the drag, won't cause anything bad this way
1242
+ if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
1243
+ this.currentItem.hide();
1244
+ }
1245
+
1246
+ //Create the placeholder
1247
+ this._createPlaceholder();
1248
+
1249
+ //Set a containment if given in the options
1250
+ if ( o.containment ) {
1251
+ this._setContainment();
1252
+ }
1253
+
1254
+ if ( o.cursor && o.cursor !== "auto" ) { // cursor option
1255
+ body = this.document.find( "body" );
1256
+
1257
+ // Support: IE
1258
+ this.storedCursor = body.css( "cursor" );
1259
+ body.css( "cursor", o.cursor );
1260
+
1261
+ this.storedStylesheet =
1262
+ $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
1263
+ }
1264
+
1265
+ if ( o.opacity ) { // opacity option
1266
+ if ( this.helper.css( "opacity" ) ) {
1267
+ this._storedOpacity = this.helper.css( "opacity" );
1268
+ }
1269
+ this.helper.css( "opacity", o.opacity );
1270
+ }
1271
+
1272
+ if ( o.zIndex ) { // zIndex option
1273
+ if ( this.helper.css( "zIndex" ) ) {
1274
+ this._storedZIndex = this.helper.css( "zIndex" );
1275
+ }
1276
+ this.helper.css( "zIndex", o.zIndex );
1277
+ }
1278
+
1279
+ //Prepare scrolling
1280
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
1281
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
1282
+ this.overflowOffset = this.scrollParent.offset();
1283
+ }
1284
+
1285
+ //Call callbacks
1286
+ this._trigger( "start", event, this._uiHash() );
1287
+
1288
+ //Recache the helper size
1289
+ if ( !this._preserveHelperProportions ) {
1290
+ this._cacheHelperProportions();
1291
+ }
1292
+
1293
+ //Post "activate" events to possible containers
1294
+ if ( !noActivation ) {
1295
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {
1296
+ this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
1297
+ }
1298
+ }
1299
+
1300
+ //Prepare possible droppables
1301
+ if ( $.ui.ddmanager ) {
1302
+ $.ui.ddmanager.current = this;
1303
+ }
1304
+
1305
+ if ( $.ui.ddmanager && !o.dropBehaviour ) {
1306
+ $.ui.ddmanager.prepareOffsets( this, event );
1307
+ }
1308
+
1309
+ this.dragging = true;
1310
+
1311
+ this._addClass( this.helper, "ui-sortable-helper" );
1312
+
1313
+ // Execute the drag once - this causes the helper not to be visiblebefore getting its
1314
+ // correct position
1315
+ this._mouseDrag( event );
1316
+ return true;
1317
+
1318
+ },
1319
+
1320
+ _mouseDrag: function( event ) {
1321
+ var i, item, itemElement, intersection,
1322
+ o = this.options,
1323
+ scrolled = false;
1324
+
1325
+ //Compute the helpers position
1326
+ this.position = this._generatePosition( event );
1327
+ this.positionAbs = this._convertPositionTo( "absolute" );
1328
+
1329
+ if ( !this.lastPositionAbs ) {
1330
+ this.lastPositionAbs = this.positionAbs;
1331
+ }
1332
+
1333
+ //Do scrolling
1334
+ if ( this.options.scroll ) {
1335
+ if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
1336
+ this.scrollParent[ 0 ].tagName !== "HTML" ) {
1337
+
1338
+ if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
1339
+ event.pageY < o.scrollSensitivity ) {
1340
+ this.scrollParent[ 0 ].scrollTop =
1341
+ scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
1342
+ } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
1343
+ this.scrollParent[ 0 ].scrollTop =
1344
+ scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
1345
+ }
1346
+
1347
+ if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
1348
+ event.pageX < o.scrollSensitivity ) {
1349
+ this.scrollParent[ 0 ].scrollLeft = scrolled =
1350
+ this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
1351
+ } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
1352
+ this.scrollParent[ 0 ].scrollLeft = scrolled =
1353
+ this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
1354
+ }
1355
+
1356
+ } else {
1357
+
1358
+ if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
1359
+ scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
1360
+ } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
1361
+ o.scrollSensitivity ) {
1362
+ scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
1363
+ }
1364
+
1365
+ if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
1366
+ scrolled = this.document.scrollLeft(
1367
+ this.document.scrollLeft() - o.scrollSpeed
1368
+ );
1369
+ } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
1370
+ o.scrollSensitivity ) {
1371
+ scrolled = this.document.scrollLeft(
1372
+ this.document.scrollLeft() + o.scrollSpeed
1373
+ );
1374
+ }
1375
+
1376
+ }
1377
+
1378
+ if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
1379
+ $.ui.ddmanager.prepareOffsets( this, event );
1380
+ }
1381
+ }
1382
+
1383
+ //Regenerate the absolute position used for position checks
1384
+ this.positionAbs = this._convertPositionTo( "absolute" );
1385
+
1386
+ //Set the helper position
1387
+ if ( !this.options.axis || this.options.axis !== "y" ) {
1388
+ this.helper[ 0 ].style.left = this.position.left + "px";
1389
+ }
1390
+ if ( !this.options.axis || this.options.axis !== "x" ) {
1391
+ this.helper[ 0 ].style.top = this.position.top + "px";
1392
+ }
1393
+
1394
+ //Rearrange
1395
+ for ( i = this.items.length - 1; i >= 0; i-- ) {
1396
+
1397
+ //Cache variables and intersection, continue if no intersection
1398
+ item = this.items[ i ];
1399
+ itemElement = item.item[ 0 ];
1400
+ intersection = this._intersectsWithPointer( item );
1401
+ if ( !intersection ) {
1402
+ continue;
1403
+ }
1404
+
1405
+ // Only put the placeholder inside the current Container, skip all
1406
+ // items from other containers. This works because when moving
1407
+ // an item from one container to another the
1408
+ // currentContainer is switched before the placeholder is moved.
1409
+ //
1410
+ // Without this, moving items in "sub-sortables" can cause
1411
+ // the placeholder to jitter between the outer and inner container.
1412
+ if ( item.instance !== this.currentContainer ) {
1413
+ continue;
1414
+ }
1415
+
1416
+ // Cannot intersect with itself
1417
+ // no useless actions that have been done before
1418
+ // no action if the item moved is the parent of the item checked
1419
+ if ( itemElement !== this.currentItem[ 0 ] &&
1420
+ this.placeholder[ intersection === 1 ? "next" : "prev" ]()[ 0 ] !== itemElement &&
1421
+ !$.contains( this.placeholder[ 0 ], itemElement ) &&
1422
+ ( this.options.type === "semi-dynamic" ?
1423
+ !$.contains( this.element[ 0 ], itemElement ) :
1424
+ true
1425
+ )
1426
+ ) {
1427
+
1428
+ this.direction = intersection === 1 ? "down" : "up";
1429
+
1430
+ if ( this.options.tolerance === "pointer" || this._intersectsWithSides( item ) ) {
1431
+ this._rearrange( event, item );
1432
+ } else {
1433
+ break;
1434
+ }
1435
+
1436
+ this._trigger( "change", event, this._uiHash() );
1437
+ break;
1438
+ }
1439
+ }
1440
+
1441
+ //Post events to containers
1442
+ this._contactContainers( event );
1443
+
1444
+ //Interconnect with droppables
1445
+ if ( $.ui.ddmanager ) {
1446
+ $.ui.ddmanager.drag( this, event );
1447
+ }
1448
+
1449
+ //Call callbacks
1450
+ this._trigger( "sort", event, this._uiHash() );
1451
+
1452
+ this.lastPositionAbs = this.positionAbs;
1453
+ return false;
1454
+
1455
+ },
1456
+
1457
+ _mouseStop: function( event, noPropagation ) {
1458
+
1459
+ if ( !event ) {
1460
+ return;
1461
+ }
1462
+
1463
+ //If we are using droppables, inform the manager about the drop
1464
+ if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
1465
+ $.ui.ddmanager.drop( this, event );
1466
+ }
1467
+
1468
+ if ( this.options.revert ) {
1469
+ var that = this,
1470
+ cur = this.placeholder.offset(),
1471
+ axis = this.options.axis,
1472
+ animation = {};
1473
+
1474
+ if ( !axis || axis === "x" ) {
1475
+ animation.left = cur.left - this.offset.parent.left - this.margins.left +
1476
+ ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
1477
+ 0 :
1478
+ this.offsetParent[ 0 ].scrollLeft
1479
+ );
1480
+ }
1481
+ if ( !axis || axis === "y" ) {
1482
+ animation.top = cur.top - this.offset.parent.top - this.margins.top +
1483
+ ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
1484
+ 0 :
1485
+ this.offsetParent[ 0 ].scrollTop
1486
+ );
1487
+ }
1488
+ this.reverting = true;
1489
+ $( this.helper ).animate(
1490
+ animation,
1491
+ parseInt( this.options.revert, 10 ) || 500,
1492
+ function() {
1493
+ that._clear( event );
1494
+ }
1495
+ );
1496
+ } else {
1497
+ this._clear( event, noPropagation );
1498
+ }
1499
+
1500
+ return false;
1501
+
1502
+ },
1503
+
1504
+ cancel: function() {
1505
+
1506
+ if ( this.dragging ) {
1507
+
1508
+ this._mouseUp( { target: null } );
1509
+
1510
+ if ( this.options.helper === "original" ) {
1511
+ this.currentItem.css( this._storedCSS );
1512
+ this._removeClass( this.currentItem, "ui-sortable-helper" );
1513
+ } else {
1514
+ this.currentItem.show();
1515
+ }
1516
+
1517
+ //Post deactivating events to containers
1518
+ for ( var i = this.containers.length - 1; i >= 0; i-- ) {
1519
+ this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );
1520
+ if ( this.containers[ i ].containerCache.over ) {
1521
+ this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );
1522
+ this.containers[ i ].containerCache.over = 0;
1523
+ }
1524
+ }
1525
+
1526
+ }
1527
+
1528
+ if ( this.placeholder ) {
1529
+
1530
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
1531
+ // it unbinds ALL events from the original node!
1532
+ if ( this.placeholder[ 0 ].parentNode ) {
1533
+ this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
1534
+ }
1535
+ if ( this.options.helper !== "original" && this.helper &&
1536
+ this.helper[ 0 ].parentNode ) {
1537
+ this.helper.remove();
1538
+ }
1539
+
1540
+ $.extend( this, {
1541
+ helper: null,
1542
+ dragging: false,
1543
+ reverting: false,
1544
+ _noFinalSort: null
1545
+ } );
1546
+
1547
+ if ( this.domPosition.prev ) {
1548
+ $( this.domPosition.prev ).after( this.currentItem );
1549
+ } else {
1550
+ $( this.domPosition.parent ).prepend( this.currentItem );
1551
+ }
1552
+ }
1553
+
1554
+ return this;
1555
+
1556
+ },
1557
+
1558
+ serialize: function( o ) {
1559
+
1560
+ var items = this._getItemsAsjQuery( o && o.connected ),
1561
+ str = [];
1562
+ o = o || {};
1563
+
1564
+ $( items ).each( function() {
1565
+ var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
1566
+ .match( o.expression || ( /(.+)[\-=_](.+)/ ) );
1567
+ if ( res ) {
1568
+ str.push(
1569
+ ( o.key || res[ 1 ] + "[]" ) +
1570
+ "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );
1571
+ }
1572
+ } );
1573
+
1574
+ if ( !str.length && o.key ) {
1575
+ str.push( o.key + "=" );
1576
+ }
1577
+
1578
+ return str.join( "&" );
1579
+
1580
+ },
1581
+
1582
+ toArray: function( o ) {
1583
+
1584
+ var items = this._getItemsAsjQuery( o && o.connected ),
1585
+ ret = [];
1586
+
1587
+ o = o || {};
1588
+
1589
+ items.each( function() {
1590
+ ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );
1591
+ } );
1592
+ return ret;
1593
+
1594
+ },
1595
+
1596
+ /* Be careful with the following core functions */
1597
+ _intersectsWith: function( item ) {
1598
+
1599
+ var x1 = this.positionAbs.left,
1600
+ x2 = x1 + this.helperProportions.width,
1601
+ y1 = this.positionAbs.top,
1602
+ y2 = y1 + this.helperProportions.height,
1603
+ l = item.left,
1604
+ r = l + item.width,
1605
+ t = item.top,
1606
+ b = t + item.height,
1607
+ dyClick = this.offset.click.top,
1608
+ dxClick = this.offset.click.left,
1609
+ isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&
1610
+ ( y1 + dyClick ) < b ),
1611
+ isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&
1612
+ ( x1 + dxClick ) < r ),
1613
+ isOverElement = isOverElementHeight && isOverElementWidth;
1614
+
1615
+ if ( this.options.tolerance === "pointer" ||
1616
+ this.options.forcePointerForContainers ||
1617
+ ( this.options.tolerance !== "pointer" &&
1618
+ this.helperProportions[ this.floating ? "width" : "height" ] >
1619
+ item[ this.floating ? "width" : "height" ] )
1620
+ ) {
1621
+ return isOverElement;
1622
+ } else {
1623
+
1624
+ return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half
1625
+ x2 - ( this.helperProportions.width / 2 ) < r && // Left Half
1626
+ t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half
1627
+ y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half
1628
+
1629
+ }
1630
+ },
1631
+
1632
+ _intersectsWithPointer: function( item ) {
1633
+ var verticalDirection, horizontalDirection,
1634
+ isOverElementHeight = ( this.options.axis === "x" ) ||
1635
+ this._isOverAxis(
1636
+ this.positionAbs.top + this.offset.click.top, item.top, item.height ),
1637
+ isOverElementWidth = ( this.options.axis === "y" ) ||
1638
+ this._isOverAxis(
1639
+ this.positionAbs.left + this.offset.click.left, item.left, item.width ),
1640
+ isOverElement = isOverElementHeight && isOverElementWidth;
1641
+
1642
+ if ( !isOverElement ) {
1643
+ return false;
1644
+ }
1645
+
1646
+ verticalDirection = this._getDragVerticalDirection();
1647
+ horizontalDirection = this._getDragHorizontalDirection();
1648
+
1649
+ return this.floating ?
1650
+ ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 )
1651
+ : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
1652
+
1653
+ },
1654
+
1655
+ _intersectsWithSides: function( item ) {
1656
+
1657
+ var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +
1658
+ this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
1659
+ isOverRightHalf = this._isOverAxis( this.positionAbs.left +
1660
+ this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
1661
+ verticalDirection = this._getDragVerticalDirection(),
1662
+ horizontalDirection = this._getDragHorizontalDirection();
1663
+
1664
+ if ( this.floating && horizontalDirection ) {
1665
+ return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
1666
+ ( horizontalDirection === "left" && !isOverRightHalf ) );
1667
+ } else {
1668
+ return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||
1669
+ ( verticalDirection === "up" && !isOverBottomHalf ) );
1670
+ }
1671
+
1672
+ },
1673
+
1674
+ _getDragVerticalDirection: function() {
1675
+ var delta = this.positionAbs.top - this.lastPositionAbs.top;
1676
+ return delta !== 0 && ( delta > 0 ? "down" : "up" );
1677
+ },
1678
+
1679
+ _getDragHorizontalDirection: function() {
1680
+ var delta = this.positionAbs.left - this.lastPositionAbs.left;
1681
+ return delta !== 0 && ( delta > 0 ? "right" : "left" );
1682
+ },
1683
+
1684
+ refresh: function( event ) {
1685
+ this._refreshItems( event );
1686
+ this._setHandleClassName();
1687
+ this.refreshPositions();
1688
+ return this;
1689
+ },
1690
+
1691
+ _connectWith: function() {
1692
+ var options = this.options;
1693
+ return options.connectWith.constructor === String ?
1694
+ [ options.connectWith ] :
1695
+ options.connectWith;
1696
+ },
1697
+
1698
+ _getItemsAsjQuery: function( connected ) {
1699
+
1700
+ var i, j, cur, inst,
1701
+ items = [],
1702
+ queries = [],
1703
+ connectWith = this._connectWith();
1704
+
1705
+ if ( connectWith && connected ) {
1706
+ for ( i = connectWith.length - 1; i >= 0; i-- ) {
1707
+ cur = $( connectWith[ i ], this.document[ 0 ] );
1708
+ for ( j = cur.length - 1; j >= 0; j-- ) {
1709
+ inst = $.data( cur[ j ], this.widgetFullName );
1710
+ if ( inst && inst !== this && !inst.options.disabled ) {
1711
+ queries.push( [ $.isFunction( inst.options.items ) ?
1712
+ inst.options.items.call( inst.element ) :
1713
+ $( inst.options.items, inst.element )
1714
+ .not( ".ui-sortable-helper" )
1715
+ .not( ".ui-sortable-placeholder" ), inst ] );
1716
+ }
1717
+ }
1718
+ }
1719
+ }
1720
+
1721
+ queries.push( [ $.isFunction( this.options.items ) ?
1722
+ this.options.items
1723
+ .call( this.element, null, { options: this.options, item: this.currentItem } ) :
1724
+ $( this.options.items, this.element )
1725
+ .not( ".ui-sortable-helper" )
1726
+ .not( ".ui-sortable-placeholder" ), this ] );
1727
+
1728
+ function addItems() {
1729
+ items.push( this );
1730
+ }
1731
+ for ( i = queries.length - 1; i >= 0; i-- ) {
1732
+ queries[ i ][ 0 ].each( addItems );
1733
+ }
1734
+
1735
+ return $( items );
1736
+
1737
+ },
1738
+
1739
+ _removeCurrentsFromItems: function() {
1740
+
1741
+ var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );
1742
+
1743
+ this.items = $.grep( this.items, function( item ) {
1744
+ for ( var j = 0; j < list.length; j++ ) {
1745
+ if ( list[ j ] === item.item[ 0 ] ) {
1746
+ return false;
1747
+ }
1748
+ }
1749
+ return true;
1750
+ } );
1751
+
1752
+ },
1753
+
1754
+ _refreshItems: function( event ) {
1755
+
1756
+ this.items = [];
1757
+ this.containers = [ this ];
1758
+
1759
+ var i, j, cur, inst, targetData, _queries, item, queriesLength,
1760
+ items = this.items,
1761
+ queries = [ [ $.isFunction( this.options.items ) ?
1762
+ this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
1763
+ $( this.options.items, this.element ), this ] ],
1764
+ connectWith = this._connectWith();
1765
+
1766
+ //Shouldn't be run the first time through due to massive slow-down
1767
+ if ( connectWith && this.ready ) {
1768
+ for ( i = connectWith.length - 1; i >= 0; i-- ) {
1769
+ cur = $( connectWith[ i ], this.document[ 0 ] );
1770
+ for ( j = cur.length - 1; j >= 0; j-- ) {
1771
+ inst = $.data( cur[ j ], this.widgetFullName );
1772
+ if ( inst && inst !== this && !inst.options.disabled ) {
1773
+ queries.push( [ $.isFunction( inst.options.items ) ?
1774
+ inst.options.items
1775
+ .call( inst.element[ 0 ], event, { item: this.currentItem } ) :
1776
+ $( inst.options.items, inst.element ), inst ] );
1777
+ this.containers.push( inst );
1778
+ }
1779
+ }
1780
+ }
1781
+ }
1782
+
1783
+ for ( i = queries.length - 1; i >= 0; i-- ) {
1784
+ targetData = queries[ i ][ 1 ];
1785
+ _queries = queries[ i ][ 0 ];
1786
+
1787
+ for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {
1788
+ item = $( _queries[ j ] );
1789
+
1790
+ // Data for target checking (mouse manager)
1791
+ item.data( this.widgetName + "-item", targetData );
1792
+
1793
+ items.push( {
1794
+ item: item,
1795
+ instance: targetData,
1796
+ width: 0, height: 0,
1797
+ left: 0, top: 0
1798
+ } );
1799
+ }
1800
+ }
1801
+
1802
+ },
1803
+
1804
+ refreshPositions: function( fast ) {
1805
+
1806
+ // Determine whether items are being displayed horizontally
1807
+ this.floating = this.items.length ?
1808
+ this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
1809
+ false;
1810
+
1811
+ //This has to be redone because due to the item being moved out/into the offsetParent,
1812
+ // the offsetParent's position will change
1813
+ if ( this.offsetParent && this.helper ) {
1814
+ this.offset.parent = this._getParentOffset();
1815
+ }
1816
+
1817
+ var i, item, t, p;
1818
+
1819
+ for ( i = this.items.length - 1; i >= 0; i-- ) {
1820
+ item = this.items[ i ];
1821
+
1822
+ //We ignore calculating positions of all connected containers when we're not over them
1823
+ if ( item.instance !== this.currentContainer && this.currentContainer &&
1824
+ item.item[ 0 ] !== this.currentItem[ 0 ] ) {
1825
+ continue;
1826
+ }
1827
+
1828
+ t = this.options.toleranceElement ?
1829
+ $( this.options.toleranceElement, item.item ) :
1830
+ item.item;
1831
+
1832
+ if ( !fast ) {
1833
+ item.width = t.outerWidth();
1834
+ item.height = t.outerHeight();
1835
+ }
1836
+
1837
+ p = t.offset();
1838
+ item.left = p.left;
1839
+ item.top = p.top;
1840
+ }
1841
+
1842
+ if ( this.options.custom && this.options.custom.refreshContainers ) {
1843
+ this.options.custom.refreshContainers.call( this );
1844
+ } else {
1845
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {
1846
+ p = this.containers[ i ].element.offset();
1847
+ this.containers[ i ].containerCache.left = p.left;
1848
+ this.containers[ i ].containerCache.top = p.top;
1849
+ this.containers[ i ].containerCache.width =
1850
+ this.containers[ i ].element.outerWidth();
1851
+ this.containers[ i ].containerCache.height =
1852
+ this.containers[ i ].element.outerHeight();
1853
+ }
1854
+ }
1855
+
1856
+ return this;
1857
+ },
1858
+
1859
+ _createPlaceholder: function( that ) {
1860
+ that = that || this;
1861
+ var className,
1862
+ o = that.options;
1863
+
1864
+ if ( !o.placeholder || o.placeholder.constructor === String ) {
1865
+ className = o.placeholder;
1866
+ o.placeholder = {
1867
+ element: function() {
1868
+
1869
+ var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(),
1870
+ element = $( "<" + nodeName + ">", that.document[ 0 ] );
1871
+
1872
+ that._addClass( element, "ui-sortable-placeholder",
1873
+ className || that.currentItem[ 0 ].className )
1874
+ ._removeClass( element, "ui-sortable-helper" );
1875
+
1876
+ if ( nodeName === "tbody" ) {
1877
+ that._createTrPlaceholder(
1878
+ that.currentItem.find( "tr" ).eq( 0 ),
1879
+ $( "<tr>", that.document[ 0 ] ).appendTo( element )
1880
+ );
1881
+ } else if ( nodeName === "tr" ) {
1882
+ that._createTrPlaceholder( that.currentItem, element );
1883
+ } else if ( nodeName === "img" ) {
1884
+ element.attr( "src", that.currentItem.attr( "src" ) );
1885
+ }
1886
+
1887
+ if ( !className ) {
1888
+ element.css( "visibility", "hidden" );
1889
+ }
1890
+
1891
+ return element;
1892
+ },
1893
+ update: function( container, p ) {
1894
+
1895
+ // 1. If a className is set as 'placeholder option, we don't force sizes -
1896
+ // the class is responsible for that
1897
+ // 2. The option 'forcePlaceholderSize can be enabled to force it even if a
1898
+ // class name is specified
1899
+ if ( className && !o.forcePlaceholderSize ) {
1900
+ return;
1901
+ }
1902
+
1903
+ //If the element doesn't have a actual height by itself (without styles coming
1904
+ // from a stylesheet), it receives the inline height from the dragged item
1905
+ if ( !p.height() ) {
1906
+ p.height(
1907
+ that.currentItem.innerHeight() -
1908
+ parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
1909
+ parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );
1910
+ }
1911
+ if ( !p.width() ) {
1912
+ p.width(
1913
+ that.currentItem.innerWidth() -
1914
+ parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -
1915
+ parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );
1916
+ }
1917
+ }
1918
+ };
1919
+ }
1920
+
1921
+ //Create the placeholder
1922
+ that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );
1923
+
1924
+ //Append it after the actual current item
1925
+ that.currentItem.after( that.placeholder );
1926
+
1927
+ //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
1928
+ o.placeholder.update( that, that.placeholder );
1929
+
1930
+ },
1931
+
1932
+ _createTrPlaceholder: function( sourceTr, targetTr ) {
1933
+ var that = this;
1934
+
1935
+ sourceTr.children().each( function() {
1936
+ $( "<td>&#160;</td>", that.document[ 0 ] )
1937
+ .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
1938
+ .appendTo( targetTr );
1939
+ } );
1940
+ },
1941
+
1942
+ _contactContainers: function( event ) {
1943
+ var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
1944
+ floating, axis,
1945
+ innermostContainer = null,
1946
+ innermostIndex = null;
1947
+
1948
+ // Get innermost container that intersects with item
1949
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {
1950
+
1951
+ // Never consider a container that's located within the item itself
1952
+ if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {
1953
+ continue;
1954
+ }
1955
+
1956
+ if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {
1957
+
1958
+ // If we've already found a container and it's more "inner" than this, then continue
1959
+ if ( innermostContainer &&
1960
+ $.contains(
1961
+ this.containers[ i ].element[ 0 ],
1962
+ innermostContainer.element[ 0 ] ) ) {
1963
+ continue;
1964
+ }
1965
+
1966
+ innermostContainer = this.containers[ i ];
1967
+ innermostIndex = i;
1968
+
1969
+ } else {
1970
+
1971
+ // container doesn't intersect. trigger "out" event if necessary
1972
+ if ( this.containers[ i ].containerCache.over ) {
1973
+ this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );
1974
+ this.containers[ i ].containerCache.over = 0;
1975
+ }
1976
+ }
1977
+
1978
+ }
1979
+
1980
+ // If no intersecting containers found, return
1981
+ if ( !innermostContainer ) {
1982
+ return;
1983
+ }
1984
+
1985
+ // Move the item into the container if it's not there already
1986
+ if ( this.containers.length === 1 ) {
1987
+ if ( !this.containers[ innermostIndex ].containerCache.over ) {
1988
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
1989
+ this.containers[ innermostIndex ].containerCache.over = 1;
1990
+ }
1991
+ } else {
1992
+
1993
+ // When entering a new container, we will find the item with the least distance and
1994
+ // append our item near it
1995
+ dist = 10000;
1996
+ itemWithLeastDistance = null;
1997
+ floating = innermostContainer.floating || this._isFloating( this.currentItem );
1998
+ posProperty = floating ? "left" : "top";
1999
+ sizeProperty = floating ? "width" : "height";
2000
+ axis = floating ? "pageX" : "pageY";
2001
+
2002
+ for ( j = this.items.length - 1; j >= 0; j-- ) {
2003
+ if ( !$.contains(
2004
+ this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
2005
+ ) {
2006
+ continue;
2007
+ }
2008
+ if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {
2009
+ continue;
2010
+ }
2011
+
2012
+ cur = this.items[ j ].item.offset()[ posProperty ];
2013
+ nearBottom = false;
2014
+ if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
2015
+ nearBottom = true;
2016
+ }
2017
+
2018
+ if ( Math.abs( event[ axis ] - cur ) < dist ) {
2019
+ dist = Math.abs( event[ axis ] - cur );
2020
+ itemWithLeastDistance = this.items[ j ];
2021
+ this.direction = nearBottom ? "up" : "down";
2022
+ }
2023
+ }
2024
+
2025
+ //Check if dropOnEmpty is enabled
2026
+ if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {
2027
+ return;
2028
+ }
2029
+
2030
+ if ( this.currentContainer === this.containers[ innermostIndex ] ) {
2031
+ if ( !this.currentContainer.containerCache.over ) {
2032
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
2033
+ this.currentContainer.containerCache.over = 1;
2034
+ }
2035
+ return;
2036
+ }
2037
+
2038
+ itemWithLeastDistance ?
2039
+ this._rearrange( event, itemWithLeastDistance, null, true ) :
2040
+ this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
2041
+ this._trigger( "change", event, this._uiHash() );
2042
+ this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
2043
+ this.currentContainer = this.containers[ innermostIndex ];
2044
+
2045
+ //Update the placeholder
2046
+ this.options.placeholder.update( this.currentContainer, this.placeholder );
2047
+
2048
+ this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
2049
+ this.containers[ innermostIndex ].containerCache.over = 1;
2050
+ }
2051
+
2052
+ },
2053
+
2054
+ _createHelper: function( event ) {
2055
+
2056
+ var o = this.options,
2057
+ helper = $.isFunction( o.helper ) ?
2058
+ $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
2059
+ ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
2060
+
2061
+ //Add the helper to the DOM if that didn't happen already
2062
+ if ( !helper.parents( "body" ).length ) {
2063
+ $( o.appendTo !== "parent" ?
2064
+ o.appendTo :
2065
+ this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] );
2066
+ }
2067
+
2068
+ if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
2069
+ this._storedCSS = {
2070
+ width: this.currentItem[ 0 ].style.width,
2071
+ height: this.currentItem[ 0 ].style.height,
2072
+ position: this.currentItem.css( "position" ),
2073
+ top: this.currentItem.css( "top" ),
2074
+ left: this.currentItem.css( "left" )
2075
+ };
2076
+ }
2077
+
2078
+ if ( !helper[ 0 ].style.width || o.forceHelperSize ) {
2079
+ helper.width( this.currentItem.width() );
2080
+ }
2081
+ if ( !helper[ 0 ].style.height || o.forceHelperSize ) {
2082
+ helper.height( this.currentItem.height() );
2083
+ }
2084
+
2085
+ return helper;
2086
+
2087
+ },
2088
+
2089
+ _adjustOffsetFromHelper: function( obj ) {
2090
+ if ( typeof obj === "string" ) {
2091
+ obj = obj.split( " " );
2092
+ }
2093
+ if ( $.isArray( obj ) ) {
2094
+ obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
2095
+ }
2096
+ if ( "left" in obj ) {
2097
+ this.offset.click.left = obj.left + this.margins.left;
2098
+ }
2099
+ if ( "right" in obj ) {
2100
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
2101
+ }
2102
+ if ( "top" in obj ) {
2103
+ this.offset.click.top = obj.top + this.margins.top;
2104
+ }
2105
+ if ( "bottom" in obj ) {
2106
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
2107
+ }
2108
+ },
2109
+
2110
+ _getParentOffset: function() {
2111
+
2112
+ //Get the offsetParent and cache its position
2113
+ this.offsetParent = this.helper.offsetParent();
2114
+ var po = this.offsetParent.offset();
2115
+
2116
+ // This is a special case where we need to modify a offset calculated on start, since the
2117
+ // following happened:
2118
+ // 1. The position of the helper is absolute, so it's position is calculated based on the
2119
+ // next positioned parent
2120
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
2121
+ // the document, which means that the scroll is included in the initial calculation of the
2122
+ // offset of the parent, and never recalculated upon drag
2123
+ if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
2124
+ $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
2125
+ po.left += this.scrollParent.scrollLeft();
2126
+ po.top += this.scrollParent.scrollTop();
2127
+ }
2128
+
2129
+ // This needs to be actually done for all browsers, since pageX/pageY includes this
2130
+ // information with an ugly IE fix
2131
+ if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
2132
+ ( this.offsetParent[ 0 ].tagName &&
2133
+ this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
2134
+ po = { top: 0, left: 0 };
2135
+ }
2136
+
2137
+ return {
2138
+ top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
2139
+ left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
2140
+ };
2141
+
2142
+ },
2143
+
2144
+ _getRelativeOffset: function() {
2145
+
2146
+ if ( this.cssPosition === "relative" ) {
2147
+ var p = this.currentItem.position();
2148
+ return {
2149
+ top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
2150
+ this.scrollParent.scrollTop(),
2151
+ left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
2152
+ this.scrollParent.scrollLeft()
2153
+ };
2154
+ } else {
2155
+ return { top: 0, left: 0 };
2156
+ }
2157
+
2158
+ },
2159
+
2160
+ _cacheMargins: function() {
2161
+ this.margins = {
2162
+ left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),
2163
+ top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )
2164
+ };
2165
+ },
2166
+
2167
+ _cacheHelperProportions: function() {
2168
+ this.helperProportions = {
2169
+ width: this.helper.outerWidth(),
2170
+ height: this.helper.outerHeight()
2171
+ };
2172
+ },
2173
+
2174
+ _setContainment: function() {
2175
+
2176
+ var ce, co, over,
2177
+ o = this.options;
2178
+ if ( o.containment === "parent" ) {
2179
+ o.containment = this.helper[ 0 ].parentNode;
2180
+ }
2181
+ if ( o.containment === "document" || o.containment === "window" ) {
2182
+ this.containment = [
2183
+ 0 - this.offset.relative.left - this.offset.parent.left,
2184
+ 0 - this.offset.relative.top - this.offset.parent.top,
2185
+ o.containment === "document" ?
2186
+ this.document.width() :
2187
+ this.window.width() - this.helperProportions.width - this.margins.left,
2188
+ ( o.containment === "document" ?
2189
+ ( this.document.height() || document.body.parentNode.scrollHeight ) :
2190
+ this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
2191
+ ) - this.helperProportions.height - this.margins.top
2192
+ ];
2193
+ }
2194
+
2195
+ if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
2196
+ ce = $( o.containment )[ 0 ];
2197
+ co = $( o.containment ).offset();
2198
+ over = ( $( ce ).css( "overflow" ) !== "hidden" );
2199
+
2200
+ this.containment = [
2201
+ co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
2202
+ ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
2203
+ co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
2204
+ ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
2205
+ co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
2206
+ ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
2207
+ ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
2208
+ this.helperProportions.width - this.margins.left,
2209
+ co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
2210
+ ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
2211
+ ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
2212
+ this.helperProportions.height - this.margins.top
2213
+ ];
2214
+ }
2215
+
2216
+ },
2217
+
2218
+ _convertPositionTo: function( d, pos ) {
2219
+
2220
+ if ( !pos ) {
2221
+ pos = this.position;
2222
+ }
2223
+ var mod = d === "absolute" ? 1 : -1,
2224
+ scroll = this.cssPosition === "absolute" &&
2225
+ !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
2226
+ $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
2227
+ this.offsetParent :
2228
+ this.scrollParent,
2229
+ scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
2230
+
2231
+ return {
2232
+ top: (
2233
+
2234
+ // The absolute mouse position
2235
+ pos.top +
2236
+
2237
+ // Only for relative positioned nodes: Relative offset from element to offset parent
2238
+ this.offset.relative.top * mod +
2239
+
2240
+ // The offsetParent's offset without borders (offset + border)
2241
+ this.offset.parent.top * mod -
2242
+ ( ( this.cssPosition === "fixed" ?
2243
+ -this.scrollParent.scrollTop() :
2244
+ ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )
2245
+ ),
2246
+ left: (
2247
+
2248
+ // The absolute mouse position
2249
+ pos.left +
2250
+
2251
+ // Only for relative positioned nodes: Relative offset from element to offset parent
2252
+ this.offset.relative.left * mod +
2253
+
2254
+ // The offsetParent's offset without borders (offset + border)
2255
+ this.offset.parent.left * mod -
2256
+ ( ( this.cssPosition === "fixed" ?
2257
+ -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
2258
+ scroll.scrollLeft() ) * mod )
2259
+ )
2260
+ };
2261
+
2262
+ },
2263
+
2264
+ _generatePosition: function( event ) {
2265
+
2266
+ var top, left,
2267
+ o = this.options,
2268
+ pageX = event.pageX,
2269
+ pageY = event.pageY,
2270
+ scroll = this.cssPosition === "absolute" &&
2271
+ !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
2272
+ $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
2273
+ this.offsetParent :
2274
+ this.scrollParent,
2275
+ scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
2276
+
2277
+ // This is another very weird special case that only happens for relative elements:
2278
+ // 1. If the css position is relative
2279
+ // 2. and the scroll parent is the document or similar to the offset parent
2280
+ // we have to refresh the relative offset during the scroll so there are no jumps
2281
+ if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
2282
+ this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
2283
+ this.offset.relative = this._getRelativeOffset();
2284
+ }
2285
+
2286
+ /*
2287
+ * - Position constraining -
2288
+ * Constrain the position to a mix of grid, containment.
2289
+ */
2290
+
2291
+ if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options
2292
+
2293
+ if ( this.containment ) {
2294
+ if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {
2295
+ pageX = this.containment[ 0 ] + this.offset.click.left;
2296
+ }
2297
+ if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {
2298
+ pageY = this.containment[ 1 ] + this.offset.click.top;
2299
+ }
2300
+ if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {
2301
+ pageX = this.containment[ 2 ] + this.offset.click.left;
2302
+ }
2303
+ if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {
2304
+ pageY = this.containment[ 3 ] + this.offset.click.top;
2305
+ }
2306
+ }
2307
+
2308
+ if ( o.grid ) {
2309
+ top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /
2310
+ o.grid[ 1 ] ) * o.grid[ 1 ];
2311
+ pageY = this.containment ?
2312
+ ( ( top - this.offset.click.top >= this.containment[ 1 ] &&
2313
+ top - this.offset.click.top <= this.containment[ 3 ] ) ?
2314
+ top :
2315
+ ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
2316
+ top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
2317
+ top;
2318
+
2319
+ left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
2320
+ o.grid[ 0 ] ) * o.grid[ 0 ];
2321
+ pageX = this.containment ?
2322
+ ( ( left - this.offset.click.left >= this.containment[ 0 ] &&
2323
+ left - this.offset.click.left <= this.containment[ 2 ] ) ?
2324
+ left :
2325
+ ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
2326
+ left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
2327
+ left;
2328
+ }
2329
+
2330
+ }
2331
+
2332
+ return {
2333
+ top: (
2334
+
2335
+ // The absolute mouse position
2336
+ pageY -
2337
+
2338
+ // Click offset (relative to the element)
2339
+ this.offset.click.top -
2340
+
2341
+ // Only for relative positioned nodes: Relative offset from element to offset parent
2342
+ this.offset.relative.top -
2343
+
2344
+ // The offsetParent's offset without borders (offset + border)
2345
+ this.offset.parent.top +
2346
+ ( ( this.cssPosition === "fixed" ?
2347
+ -this.scrollParent.scrollTop() :
2348
+ ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )
2349
+ ),
2350
+ left: (
2351
+
2352
+ // The absolute mouse position
2353
+ pageX -
2354
+
2355
+ // Click offset (relative to the element)
2356
+ this.offset.click.left -
2357
+
2358
+ // Only for relative positioned nodes: Relative offset from element to offset parent
2359
+ this.offset.relative.left -
2360
+
2361
+ // The offsetParent's offset without borders (offset + border)
2362
+ this.offset.parent.left +
2363
+ ( ( this.cssPosition === "fixed" ?
2364
+ -this.scrollParent.scrollLeft() :
2365
+ scrollIsRootNode ? 0 : scroll.scrollLeft() ) )
2366
+ )
2367
+ };
2368
+
2369
+ },
2370
+
2371
+ _rearrange: function( event, i, a, hardRefresh ) {
2372
+
2373
+ a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) :
2374
+ i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
2375
+ ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
2376
+
2377
+ //Various things done here to improve the performance:
2378
+ // 1. we create a setTimeout, that calls refreshPositions
2379
+ // 2. on the instance, we have a counter variable, that get's higher after every append
2380
+ // 3. on the local scope, we copy the counter variable, and check in the timeout,
2381
+ // if it's still the same
2382
+ // 4. this lets only the last addition to the timeout stack through
2383
+ this.counter = this.counter ? ++this.counter : 1;
2384
+ var counter = this.counter;
2385
+
2386
+ this._delay( function() {
2387
+ if ( counter === this.counter ) {
2388
+
2389
+ //Precompute after each DOM insertion, NOT on mousemove
2390
+ this.refreshPositions( !hardRefresh );
2391
+ }
2392
+ } );
2393
+
2394
+ },
2395
+
2396
+ _clear: function( event, noPropagation ) {
2397
+
2398
+ this.reverting = false;
2399
+
2400
+ // We delay all events that have to be triggered to after the point where the placeholder
2401
+ // has been removed and everything else normalized again
2402
+ var i,
2403
+ delayedTriggers = [];
2404
+
2405
+ // We first have to update the dom position of the actual currentItem
2406
+ // Note: don't do it if the current item is already removed (by a user), or it gets
2407
+ // reappended (see #4088)
2408
+ if ( !this._noFinalSort && this.currentItem.parent().length ) {
2409
+ this.placeholder.before( this.currentItem );
2410
+ }
2411
+ this._noFinalSort = null;
2412
+
2413
+ if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {
2414
+ for ( i in this._storedCSS ) {
2415
+ if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {
2416
+ this._storedCSS[ i ] = "";
2417
+ }
2418
+ }
2419
+ this.currentItem.css( this._storedCSS );
2420
+ this._removeClass( this.currentItem, "ui-sortable-helper" );
2421
+ } else {
2422
+ this.currentItem.show();
2423
+ }
2424
+
2425
+ if ( this.fromOutside && !noPropagation ) {
2426
+ delayedTriggers.push( function( event ) {
2427
+ this._trigger( "receive", event, this._uiHash( this.fromOutside ) );
2428
+ } );
2429
+ }
2430
+ if ( ( this.fromOutside ||
2431
+ this.domPosition.prev !==
2432
+ this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
2433
+ this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
2434
+
2435
+ // Trigger update callback if the DOM position has changed
2436
+ delayedTriggers.push( function( event ) {
2437
+ this._trigger( "update", event, this._uiHash() );
2438
+ } );
2439
+ }
2440
+
2441
+ // Check if the items Container has Changed and trigger appropriate
2442
+ // events.
2443
+ if ( this !== this.currentContainer ) {
2444
+ if ( !noPropagation ) {
2445
+ delayedTriggers.push( function( event ) {
2446
+ this._trigger( "remove", event, this._uiHash() );
2447
+ } );
2448
+ delayedTriggers.push( ( function( c ) {
2449
+ return function( event ) {
2450
+ c._trigger( "receive", event, this._uiHash( this ) );
2451
+ };
2452
+ } ).call( this, this.currentContainer ) );
2453
+ delayedTriggers.push( ( function( c ) {
2454
+ return function( event ) {
2455
+ c._trigger( "update", event, this._uiHash( this ) );
2456
+ };
2457
+ } ).call( this, this.currentContainer ) );
2458
+ }
2459
+ }
2460
+
2461
+ //Post events to containers
2462
+ function delayEvent( type, instance, container ) {
2463
+ return function( event ) {
2464
+ container._trigger( type, event, instance._uiHash( instance ) );
2465
+ };
2466
+ }
2467
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {
2468
+ if ( !noPropagation ) {
2469
+ delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
2470
+ }
2471
+ if ( this.containers[ i ].containerCache.over ) {
2472
+ delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
2473
+ this.containers[ i ].containerCache.over = 0;
2474
+ }
2475
+ }
2476
+
2477
+ //Do what was originally in plugins
2478
+ if ( this.storedCursor ) {
2479
+ this.document.find( "body" ).css( "cursor", this.storedCursor );
2480
+ this.storedStylesheet.remove();
2481
+ }
2482
+ if ( this._storedOpacity ) {
2483
+ this.helper.css( "opacity", this._storedOpacity );
2484
+ }
2485
+ if ( this._storedZIndex ) {
2486
+ this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );
2487
+ }
2488
+
2489
+ this.dragging = false;
2490
+
2491
+ if ( !noPropagation ) {
2492
+ this._trigger( "beforeStop", event, this._uiHash() );
2493
+ }
2494
+
2495
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
2496
+ // it unbinds ALL events from the original node!
2497
+ this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
2498
+
2499
+ if ( !this.cancelHelperRemoval ) {
2500
+ if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
2501
+ this.helper.remove();
2502
+ }
2503
+ this.helper = null;
2504
+ }
2505
+
2506
+ if ( !noPropagation ) {
2507
+ for ( i = 0; i < delayedTriggers.length; i++ ) {
2508
+
2509
+ // Trigger all delayed events
2510
+ delayedTriggers[ i ].call( this, event );
2511
+ }
2512
+ this._trigger( "stop", event, this._uiHash() );
2513
+ }
2514
+
2515
+ this.fromOutside = false;
2516
+ return !this.cancelHelperRemoval;
2517
+
2518
+ },
2519
+
2520
+ _trigger: function() {
2521
+ if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {
2522
+ this.cancel();
2523
+ }
2524
+ },
2525
+
2526
+ _uiHash: function( _inst ) {
2527
+ var inst = _inst || this;
2528
+ return {
2529
+ helper: inst.helper,
2530
+ placeholder: inst.placeholder || $( [] ),
2531
+ position: inst.position,
2532
+ originalPosition: inst.originalPosition,
2533
+ offset: inst.positionAbs,
2534
+ item: inst.currentItem,
2535
+ sender: _inst ? _inst.element : null
2536
+ };
2537
+ }
2538
+
2539
+ } );
2540
+
2541
+
2542
+
2543
+
2544
+ }));