curation_concerns 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (472) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -9
  3. data/.rspec +1 -1
  4. data/.rubocop.yml +185 -0
  5. data/.travis.yml +0 -10
  6. data/CONTRIBUTING.md +117 -0
  7. data/Gemfile +5 -2
  8. data/README.md +18 -11
  9. data/Rakefile +23 -11
  10. data/VERSION +1 -1
  11. data/app/assets/images/audio.png +0 -0
  12. data/app/assets/images/loading.gif +0 -0
  13. data/app/assets/images/progressbar.gif +0 -0
  14. data/app/assets/javascripts/curation_concerns/application.js +2 -8
  15. data/app/assets/javascripts/curation_concerns/curation_concerns.js +1 -15
  16. data/app/assets/javascripts/curation_concerns/facet_mine.js +4 -10
  17. data/app/assets/javascripts/curation_concerns/fileupload.js +6 -0
  18. data/app/assets/javascripts/curation_concerns/uploader.js +183 -0
  19. data/app/assets/stylesheets/curation_concerns/_curation_concerns.scss +3 -0
  20. data/app/assets/stylesheets/curation_concerns/_positioning.scss +6 -0
  21. data/app/assets/stylesheets/curation_concerns/fileupload/jquery.fileupload-ui.scss +86 -0
  22. data/app/assets/stylesheets/curation_concerns/fileupload/thumbnail-scaling.css +3 -0
  23. data/app/assets/stylesheets/curation_concerns/fileupload.scss +48 -0
  24. data/app/assets/stylesheets/curation_concerns/modules/attributes.scss +10 -0
  25. data/app/assets/stylesheets/curation_concerns/modules/embargoes.scss +1 -1
  26. data/app/assets/stylesheets/curation_concerns/modules/forms.scss +0 -10
  27. data/app/assets/stylesheets/curation_concerns/modules/search_results.scss +7 -8
  28. data/app/controllers/concerns/curation_concerns/api.rb +77 -0
  29. data/app/controllers/concerns/curation_concerns/application_controller_behavior.rb +30 -12
  30. data/app/controllers/concerns/curation_concerns/catalog_controller.rb +9 -276
  31. data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +51 -40
  32. data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +60 -30
  33. data/app/controllers/concerns/curation_concerns/download_behavior.rb +51 -37
  34. data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +29 -29
  35. data/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb +198 -0
  36. data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +27 -20
  37. data/app/controllers/concerns/curation_concerns/manages_embargoes.rb +2 -7
  38. data/app/controllers/concerns/curation_concerns/parent_container.rb +20 -4
  39. data/app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb +48 -0
  40. data/app/controllers/concerns/curation_concerns/single_use_links_viewer_controller_behavior.rb +75 -0
  41. data/app/controllers/concerns/curation_concerns/themed_layout_controller.rb +0 -1
  42. data/app/controllers/concerns/curation_concerns/upload_sets_controller_behavior.rb +38 -0
  43. data/app/controllers/concerns/curation_concerns/welcome_controller_behavior.rb +8 -0
  44. data/app/controllers/concerns/curation_concerns/without_namespace.rb +2 -1
  45. data/app/controllers/curation_concerns/classify_concerns_controller.rb +9 -9
  46. data/app/controllers/curation_concerns/file_sets_controller.rb +5 -0
  47. data/app/controllers/curation_concerns/permissions_controller.rb +2 -3
  48. data/app/controllers/curation_concerns/single_use_links_controller.rb +5 -0
  49. data/app/controllers/curation_concerns/single_use_links_viewer_controller.rb +21 -0
  50. data/app/controllers/downloads_controller.rb +0 -1
  51. data/app/controllers/embargoes_controller.rb +0 -2
  52. data/app/controllers/leases_controller.rb +0 -2
  53. data/app/controllers/registrations_controller.rb +1 -2
  54. data/app/controllers/upload_sets_controller.rb +3 -0
  55. data/app/controllers/welcome_controller.rb +3 -0
  56. data/app/forms/curation_concerns/forms/collection_edit_form.rb +18 -2
  57. data/app/forms/curation_concerns/forms/file_set_edit_form.rb +15 -0
  58. data/app/forms/curation_concerns/forms/work_form.rb +57 -0
  59. data/app/helpers/curation_concerns/ability_helper.rb +24 -24
  60. data/app/helpers/curation_concerns/catalog_helper.rb +9 -8
  61. data/app/helpers/curation_concerns/collections_helper.rb +9 -12
  62. data/app/helpers/curation_concerns/embargo_helper.rb +0 -2
  63. data/app/helpers/curation_concerns/file_set_helper.rb +31 -0
  64. data/app/helpers/curation_concerns/lease_helper.rb +0 -3
  65. data/app/helpers/curation_concerns/main_app_helpers.rb +1 -3
  66. data/app/helpers/curation_concerns/render_constraints_helper.rb +5 -5
  67. data/app/helpers/curation_concerns/search_paths_helper.rb +5 -7
  68. data/app/helpers/curation_concerns/title_helper.rb +3 -7
  69. data/app/helpers/curation_concerns/url_helper.rb +4 -6
  70. data/app/inputs/multifile_input.rb +8 -0
  71. data/app/jobs/visibility_copy_job.rb +22 -0
  72. data/app/presenters/curation_concerns/collection_presenter.rb +14 -32
  73. data/app/presenters/curation_concerns/embargo_presenter.rb +26 -0
  74. data/app/presenters/curation_concerns/file_set_presenter.rb +34 -0
  75. data/app/presenters/curation_concerns/lease_presenter.rb +30 -0
  76. data/app/presenters/curation_concerns/model_proxy.rb +27 -0
  77. data/app/presenters/curation_concerns/permission_badge.rb +61 -0
  78. data/app/presenters/curation_concerns/presenter_factory.rb +45 -0
  79. data/app/presenters/curation_concerns/presents_attributes.rb +25 -0
  80. data/app/presenters/curation_concerns/version_list_presenter.rb +18 -0
  81. data/app/presenters/curation_concerns/version_presenter.rb +27 -0
  82. data/app/presenters/curation_concerns/work_show_presenter.rb +33 -0
  83. data/app/renderers/curation_concerns/attribute_renderer.rb +75 -0
  84. data/app/search_builders/curation_concerns/deactivated_embargo_search_builder.rb +10 -0
  85. data/app/search_builders/curation_concerns/deactivated_lease_search_builder.rb +10 -0
  86. data/app/search_builders/curation_concerns/embargo_search_builder.rb +23 -0
  87. data/app/search_builders/curation_concerns/expired_embargo_search_builder.rb +11 -0
  88. data/app/search_builders/curation_concerns/expired_lease_search_builder.rb +11 -0
  89. data/app/search_builders/curation_concerns/lease_search_builder.rb +23 -0
  90. data/app/search_builders/curation_concerns/search_builder.rb +10 -16
  91. data/app/services/curation_concerns/curation_concern.rb +0 -5
  92. data/app/services/curation_concerns/embargo_service.rb +26 -4
  93. data/app/services/curation_concerns/lease_service.rb +14 -5
  94. data/app/services/curation_concerns/parent_service.rb +19 -0
  95. data/app/services/curation_concerns/restriction_service.rb +24 -0
  96. data/app/services/rights_service.rb +14 -0
  97. data/app/views/catalog/_action_menu_partials/_collection.html.erb +1 -1
  98. data/app/views/catalog/_action_menu_partials/_default.html.erb +5 -3
  99. data/app/views/catalog/_document_list.html.erb +1 -1
  100. data/app/views/catalog/index.html.erb +1 -35
  101. data/app/views/collections/_edit_descriptions.html.erb +3 -4
  102. data/app/views/collections/_form.html.erb +1 -1
  103. data/app/views/collections/_form_permission.html.erb +1 -1
  104. data/app/views/collections/_search_form.html.erb +10 -0
  105. data/app/views/collections/_show_actions.html.erb +3 -3
  106. data/app/views/collections/_sort_and_per_page.html.erb +2 -2
  107. data/app/views/collections/show.html.erb +6 -6
  108. data/app/views/curation_concerns/base/_attribute_rows.html.erb +7 -0
  109. data/app/views/curation_concerns/base/_attributes.html.erb +6 -13
  110. data/app/views/curation_concerns/base/_form.html.erb +4 -5
  111. data/app/views/curation_concerns/base/_form_descriptive_fields.erb +2 -4
  112. data/app/views/curation_concerns/base/_form_files_and_links.html.erb +3 -5
  113. data/app/views/curation_concerns/base/_form_permission.html.erb +13 -26
  114. data/app/views/curation_concerns/base/_form_permission_note.html.erb +15 -0
  115. data/app/views/curation_concerns/base/_form_permission_under_embargo.html.erb +2 -2
  116. data/app/views/curation_concerns/base/_form_permission_under_lease.html.erb +2 -2
  117. data/app/views/curation_concerns/base/_form_representative_image.html.erb +16 -4
  118. data/app/views/curation_concerns/base/_form_rights.html.erb +17 -0
  119. data/app/views/curation_concerns/base/_form_supplementary_fields.html.erb +4 -9
  120. data/app/views/curation_concerns/base/_related_files.html.erb +4 -4
  121. data/app/views/curation_concerns/base/_representative_media.html.erb +2 -4
  122. data/app/views/curation_concerns/base/_versioning.html.erb +23 -0
  123. data/app/views/curation_concerns/base/show.html.erb +13 -10
  124. data/app/views/curation_concerns/base/show.json.jbuilder +1 -0
  125. data/app/views/curation_concerns/base/versions.html.erb +6 -0
  126. data/app/views/curation_concerns/file_sets/_actions.html.erb +16 -0
  127. data/app/views/curation_concerns/file_sets/_file_set.html.erb +12 -0
  128. data/app/views/curation_concerns/{generic_files → file_sets}/_form.html.erb +7 -7
  129. data/app/views/curation_concerns/file_sets/_multiple_upload.html.erb +3 -0
  130. data/app/views/curation_concerns/{generic_files → file_sets}/edit.html.erb +0 -0
  131. data/app/views/curation_concerns/file_sets/jq_upload.json.jbuilder +8 -0
  132. data/app/views/curation_concerns/file_sets/media_display/_audio.html.erb +6 -0
  133. data/app/views/curation_concerns/file_sets/media_display/_default.html.erb +4 -0
  134. data/app/views/curation_concerns/file_sets/media_display/_image.html.erb +8 -0
  135. data/app/views/curation_concerns/file_sets/media_display/_office_document.html.erb +7 -0
  136. data/app/views/curation_concerns/file_sets/media_display/_pdf.html.erb +7 -0
  137. data/app/views/curation_concerns/file_sets/media_display/_video.html.erb +6 -0
  138. data/app/views/curation_concerns/file_sets/show.html.erb +15 -0
  139. data/app/views/curation_concerns/file_sets/show.json.jbuilder +1 -0
  140. data/app/views/curation_concerns/file_sets/upload/_alerts.html.erb +19 -0
  141. data/app/views/curation_concerns/file_sets/upload/_form.html.erb +6 -0
  142. data/app/views/curation_concerns/file_sets/upload/_form_fields.html.erb +45 -0
  143. data/app/views/curation_concerns/file_sets/upload/_script_templates.html.erb +61 -0
  144. data/app/views/curation_concerns/single_use_links/new_download.html.erb +5 -0
  145. data/app/views/curation_concerns/single_use_links/new_show.html.erb +5 -0
  146. data/app/views/curation_concerns/single_use_links_viewer/show.html.erb +10 -0
  147. data/app/views/error/single_use_error.html.erb +19 -0
  148. data/app/views/layouts/error.html.erb +33 -0
  149. data/app/views/leases/_list_expired_active_leases.html.erb +6 -1
  150. data/app/views/records/_rights_modal.html.erb +1 -0
  151. data/app/views/records/edit_fields/_default.html.erb +5 -0
  152. data/app/views/records/show_fields/_default.html.erb +6 -0
  153. data/app/views/shared/_add_content.html.erb +2 -14
  154. data/app/views/shared/_add_works.html.erb +14 -0
  155. data/app/views/shared/_my_actions.html.erb +9 -1
  156. data/app/views/shared/_site_actions.html.erb +1 -1
  157. data/app/views/shared/_site_search.html.erb +7 -7
  158. data/app/views/upload_sets/_edit.js.erb +15 -0
  159. data/app/views/upload_sets/_metadata.html.erb +50 -0
  160. data/app/views/upload_sets/_more_metadata.html.erb +7 -0
  161. data/app/views/upload_sets/edit.html.erb +26 -0
  162. data/app/views/{catalog/_home_text.html.erb → welcome/index.html.erb} +1 -0
  163. data/config/initializers/simple_form.rb +14 -0
  164. data/config/jetty.yml +5 -0
  165. data/config/locales/curation_concerns.en.yml +25 -4
  166. data/config/routes.rb +5 -0
  167. data/curation_concerns.gemspec +4 -6
  168. data/lib/curation_concerns/callbacks/registry.rb +48 -0
  169. data/lib/curation_concerns/callbacks.rb +26 -0
  170. data/lib/curation_concerns/controller_resource.rb +4 -4
  171. data/lib/curation_concerns/engine.rb +4 -2
  172. data/lib/curation_concerns/rails/routes.rb +23 -19
  173. data/lib/curation_concerns/single_use_error.rb +3 -0
  174. data/lib/curation_concerns/spec_support.rb +0 -2
  175. data/lib/curation_concerns/version.rb +1 -1
  176. data/lib/curation_concerns.rb +1 -2
  177. data/lib/generators/curation_concerns/install_generator.rb +34 -30
  178. data/lib/generators/curation_concerns/templates/catalog_controller.rb +236 -0
  179. data/lib/generators/curation_concerns/templates/config/authorities/rights.yml +19 -0
  180. data/lib/generators/curation_concerns/templates/{curation_concerns.css.scss → curation_concerns.scss} +0 -0
  181. data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +1 -1
  182. data/lib/generators/curation_concerns/work/templates/controller_spec.rb.erb +1 -1
  183. data/lib/generators/curation_concerns/work/templates/form.rb.erb +8 -0
  184. data/lib/generators/curation_concerns/work/templates/form_spec.rb.erb +10 -0
  185. data/lib/generators/curation_concerns/work/templates/model.rb.erb +2 -2
  186. data/lib/generators/curation_concerns/work/templates/model_spec.rb.erb +1 -1
  187. data/lib/generators/curation_concerns/work/work_generator.rb +31 -26
  188. data/spec/abilities/collection_abilities_spec.rb +13 -13
  189. data/spec/abilities/embargo_and_lease_ability_spec.rb +23 -0
  190. data/spec/abilities/file_set_abilities_spec.rb +67 -0
  191. data/spec/abilities/generic_work_abilities_spec.rb +12 -12
  192. data/spec/actors/curation_concerns/embargo_actor_spec.rb +38 -0
  193. data/spec/actors/curation_concerns/file_set_actor_spec.rb +180 -0
  194. data/spec/actors/curation_concerns/lease_actor_spec.rb +39 -0
  195. data/spec/actors/curation_concerns/manages_embargoes_actor_spec.rb +44 -38
  196. data/spec/actors/curation_concerns/work_actor_spec.rb +121 -63
  197. data/spec/controllers/catalog_controller_spec.rb +30 -32
  198. data/spec/controllers/curation_concerns/classify_concerns_controller_spec.rb +2 -3
  199. data/spec/controllers/curation_concerns/collections_controller_spec.rb +93 -76
  200. data/spec/controllers/curation_concerns/file_sets_controller_json_spec.rb +106 -0
  201. data/spec/controllers/curation_concerns/file_sets_controller_spec.rb +237 -0
  202. data/spec/controllers/curation_concerns/generic_works_controller_json_spec.rb +85 -0
  203. data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +84 -72
  204. data/spec/controllers/curation_concerns/permissions_controller_spec.rb +8 -11
  205. data/spec/controllers/curation_concerns/single_use_links_controller_spec.rb +79 -0
  206. data/spec/controllers/curation_concerns/single_use_links_viewer_controller_spec.rb +74 -0
  207. data/spec/controllers/downloads_controller_spec.rb +49 -24
  208. data/spec/controllers/embargoes_controller_spec.rb +42 -51
  209. data/spec/controllers/leases_controller_spec.rb +53 -42
  210. data/spec/controllers/upload_sets_controller_spec.rb +76 -0
  211. data/spec/controllers/welcome_controller_spec.rb +12 -0
  212. data/spec/factories/collections.rb +5 -1
  213. data/spec/factories/{generic_files.rb → file_sets.rb} +6 -6
  214. data/spec/factories/generic_works.rb +5 -6
  215. data/spec/factories/users.rb +2 -4
  216. data/spec/features/add_file_spec.rb +11 -12
  217. data/spec/features/catalog_search_spec.rb +43 -0
  218. data/spec/features/collection_spec.rb +61 -46
  219. data/spec/features/create_work_spec.rb +26 -19
  220. data/spec/features/embargo_spec.rb +13 -12
  221. data/spec/features/lease_spec.rb +15 -16
  222. data/spec/features/update_file_spec.rb +11 -13
  223. data/spec/features/work_generator_spec.rb +34 -26
  224. data/spec/{helpers/curation_concerns/.keep → fixtures/empty_file.txt} +0 -0
  225. data/spec/fixtures/test.pdf +0 -0
  226. data/spec/forms/collection_edit_form_spec.rb +53 -9
  227. data/spec/forms/file_set_edit_form_spec.rb +53 -0
  228. data/spec/forms/work_form_spec.rb +54 -0
  229. data/spec/helpers/catalog_helper_spec.rb +9 -10
  230. data/spec/helpers/configuration_helper_spec.rb +1 -2
  231. data/spec/helpers/curation_concerns/collections_helper_spec.rb +8 -9
  232. data/spec/helpers/curation_concerns/file_set_helper_spec.rb +61 -0
  233. data/spec/helpers/render_constraints_helper_spec.rb +4 -4
  234. data/spec/helpers/url_helper_spec.rb +8 -7
  235. data/spec/indexers/collection_indexer_spec.rb +14 -0
  236. data/spec/indexers/file_set_indexing_service_spec.rb +69 -0
  237. data/spec/indexers/generic_work_indexing_service_spec.rb +22 -0
  238. data/spec/inputs/multifile_input_spec.rb +32 -0
  239. data/spec/jobs/active_fedora_id_based_job_spec.rb +10 -8
  240. data/spec/jobs/audit_job_spec.rb +28 -20
  241. data/spec/jobs/characterize_job_spec.rb +10 -15
  242. data/spec/jobs/create_derivatives_job_spec.rb +11 -9
  243. data/spec/jobs/import_url_job_spec.rb +14 -21
  244. data/spec/jobs/ingest_file_job_spec.rb +45 -0
  245. data/spec/jobs/ingest_local_file_job_spec.rb +13 -15
  246. data/spec/jobs/upload_set_update_job_spec.rb +30 -0
  247. data/spec/jobs/visibility_copy_job_spec.rb +61 -0
  248. data/spec/lib/curation_concerns/callbacks/registry_spec.rb +54 -0
  249. data/spec/lib/curation_concerns/callbacks_spec.rb +27 -0
  250. data/spec/lib/curation_concerns/messages_spec.rb +29 -30
  251. data/spec/lib/curation_concerns/readable_permissions_spec.rb +18 -20
  252. data/spec/lib/curation_concerns/writable_permissions_spec.rb +2 -4
  253. data/spec/matchers/metadata_field_matchers.rb +1 -1
  254. data/spec/matchers/response_matchers.rb +2 -2
  255. data/spec/matchers.rb +3 -2
  256. data/spec/models/checksum_audit_log_spec.rb +37 -32
  257. data/spec/models/curation_concerns/collection_behavior_spec.rb +50 -37
  258. data/spec/models/curation_concerns/file_set/derivatives_spec.rb +84 -0
  259. data/spec/models/curation_concerns/work_behavior_spec.rb +53 -0
  260. data/spec/models/file_set_spec.rb +601 -0
  261. data/spec/models/generic_work_spec.rb +15 -14
  262. data/spec/models/single_use_link_spec.rb +69 -0
  263. data/spec/models/solr_document_spec.rb +67 -0
  264. data/spec/models/upload_set_spec.rb +39 -0
  265. data/spec/models/user_spec.rb +7 -8
  266. data/spec/presenters/curation_concerns/collection_presenter_spec.rb +8 -24
  267. data/spec/presenters/curation_concerns/file_set_presenter_spec.rb +59 -0
  268. data/spec/presenters/curation_concerns/permission_badge_spec.rb +29 -0
  269. data/spec/presenters/curation_concerns/presenter_factory_spec.rb +29 -0
  270. data/spec/presenters/curation_concerns/version_list_presenter_spec.rb +32 -0
  271. data/spec/presenters/curation_concerns/version_presenter_spec.rb +51 -0
  272. data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +35 -0
  273. data/spec/presenters/embargo_presenter_spec.rb +48 -0
  274. data/spec/presenters/lease_presenter_spec.rb +48 -0
  275. data/spec/renderers/curation_concerns/attribute_renderer_spec.rb +14 -0
  276. data/spec/routing/curation_concerns/routes_spec.rb +38 -12
  277. data/spec/routing/route_spec.rb +38 -39
  278. data/spec/search_builders/curation_concerns/embargo_search_builder_spec.rb +17 -0
  279. data/spec/search_builders/curation_concerns/lease_search_builder_spec.rb +17 -0
  280. data/spec/search_builders/curation_concerns/search_builder_spec.rb +60 -0
  281. data/spec/services/derivative_path_spec.rb +16 -0
  282. data/spec/services/embargo_service_spec.rb +15 -14
  283. data/spec/services/file_set_audit_service_spec.rb +71 -0
  284. data/spec/services/lease_service_spec.rb +13 -13
  285. data/spec/services/lock_manager_spec.rb +12 -0
  286. data/spec/services/parent_service_spec.rb +13 -0
  287. data/spec/services/persist_derivatives_spec.rb +24 -0
  288. data/spec/services/persist_directly_contained_output_file_service_spec.rb +14 -0
  289. data/spec/services/repository_audit_service_spec.rb +8 -7
  290. data/spec/services/rights_service_spec.rb +17 -0
  291. data/spec/services/thumbnail_path_service_spec.rb +43 -0
  292. data/spec/services/versioning_service_spec.rb +8 -9
  293. data/spec/spec_helper.rb +21 -13
  294. data/spec/support/curation_concerns/factory_helpers.rb +1 -0
  295. data/spec/support/features/fixture_file_upload.rb +3 -1
  296. data/spec/support/features/session_helpers.rb +3 -4
  297. data/spec/support/features.rb +1 -4
  298. data/spec/support/input_support.rb +11 -0
  299. data/spec/support/matchers/api_responses.rb +22 -0
  300. data/spec/support/shared/shared_examples_has_dc_metadata.rb +0 -2
  301. data/spec/support/shared/shared_examples_is_embargoable.rb +1 -3
  302. data/spec/support/shared/shared_examples_with_access_rights.rb +13 -16
  303. data/spec/tasks/rake_spec.rb +9 -11
  304. data/spec/test_app_templates/Gemfile.extra +4 -1
  305. data/spec/test_app_templates/lib/generators/test_app_generator.rb +3 -35
  306. data/spec/views/catalog/index.html.erb_spec.rb +7 -10
  307. data/spec/views/curation_concerns/base/_attributes.html.erb_spec.rb +9 -6
  308. data/spec/views/curation_concerns/base/_form_permission.html.erb_spec.rb +13 -0
  309. data/spec/views/curation_concerns/base/show.html.erb_spec.rb +35 -15
  310. data/spec/views/curation_concerns/base/show.json.jbuilder_spec.rb +21 -0
  311. data/spec/views/curation_concerns/file_sets/_file_set.html.erb_spec.rb +37 -0
  312. data/spec/views/curation_concerns/file_sets/show.json.jbuilder_spec.rb +21 -0
  313. data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +6 -6
  314. data/spec/views/error/single_use_error.html.erb_spec.rb +8 -0
  315. data/spec/views/layouts/error.html.erb_spec.rb +8 -0
  316. data/spec/views/shared/_add_content.html.erb_spec.rb +33 -20
  317. data/spec/views/shared/_my_actions.html.erb_spec.rb +18 -6
  318. data/spec/views/single_use_links/new_download.html.erb_spec.rb +29 -0
  319. data/spec/views/single_use_links_viewer/show.html.erb_spec.rb +32 -0
  320. data/tasks/jetty.rake +1 -1
  321. data/vendor/assets/javascrips/fileupload/jquery.fileupload-process.js +175 -0
  322. data/vendor/assets/javascrips/fileupload/jquery.fileupload-ui.js +710 -0
  323. data/vendor/assets/javascrips/fileupload/jquery.fileupload-validate.js +122 -0
  324. data/vendor/assets/javascrips/fileupload/jquery.fileupload.js +1477 -0
  325. data/vendor/assets/javascrips/fileupload/locale.js +27 -0
  326. data/vendor/assets/javascrips/fileupload/tmpl.js +87 -0
  327. metadata +242 -213
  328. data/app/assets/javascripts/curation_concerns/help_modal.js +0 -36
  329. data/app/assets/javascripts/curation_concerns/link_groups.js.coffee +0 -123
  330. data/app/assets/javascripts/curation_concerns/link_users.js.coffee +0 -126
  331. data/app/assets/javascripts/curation_concerns/proxy_rights.js.coffee +0 -95
  332. data/app/assets/javascripts/curation_concerns/proxy_submission.js +0 -23
  333. data/app/assets/javascripts/curation_concerns/select_works.js.coffee +0 -20
  334. data/app/controllers/catalog_controller.rb +0 -3
  335. data/app/controllers/concerns/curation_concerns/generic_files_controller_behavior.rb +0 -149
  336. data/app/controllers/curation_concerns/generic_files_controller.rb +0 -13
  337. data/app/datastreams/curation_concerns/generic_work_rdf_properties.rb +0 -57
  338. data/app/datastreams/generic_work_metadata.rb +0 -3
  339. data/app/forms/curation_concerns/forms/generic_file_edit_form.rb +0 -15
  340. data/app/forms/curation_concerns/forms/generic_work_edit_form.rb +0 -9
  341. data/app/helpers/curation_concerns/attribute_helper.rb +0 -67
  342. data/app/helpers/curation_concerns/generic_file_helper.rb +0 -19
  343. data/app/helpers/curation_concerns/thumbnail_helper.rb +0 -11
  344. data/app/presenters/curation_concerns/generic_file_presenter.rb +0 -14
  345. data/app/presenters/curation_concerns/generic_work_presenter.rb +0 -13
  346. data/app/views/catalog/_index_default.html.erb +0 -17
  347. data/app/views/collections/_form_representative_image.html.erb +0 -13
  348. data/app/views/collections/_identifier_and_action.html.erb +0 -15
  349. data/app/views/curation_concerns/base/_form_content_license.html.erb +0 -16
  350. data/app/views/curation_concerns/base/_form_editors.html.erb +0 -15
  351. data/app/views/curation_concerns/generic_files/_actions.html.erb +0 -16
  352. data/app/views/curation_concerns/generic_files/_generic_file.html.erb +0 -12
  353. data/app/views/curation_concerns/generic_files/_media_display.html.erb +0 -19
  354. data/app/views/curation_concerns/generic_files/jq_upload.json.jbuilder +0 -8
  355. data/app/views/curation_concerns/generic_files/show.html.erb +0 -15
  356. data/app/workers/visibility_copy_worker.rb +0 -30
  357. data/curation_concerns-models/.gitignore +0 -17
  358. data/curation_concerns-models/Gemfile +0 -4
  359. data/curation_concerns-models/LICENSE.md +0 -177
  360. data/curation_concerns-models/README.md +0 -42
  361. data/curation_concerns-models/Rakefile +0 -1
  362. data/curation_concerns-models/app/actors/concerns/curation_concerns/manages_embargoes_actor.rb +0 -99
  363. data/curation_concerns-models/app/actors/curation_concerns/base_actor.rb +0 -90
  364. data/curation_concerns-models/app/actors/curation_concerns/generic_file_actor.rb +0 -150
  365. data/curation_concerns-models/app/actors/curation_concerns/work_actor_behavior.rb +0 -88
  366. data/curation_concerns-models/app/jobs/active_fedora_id_based_job.rb +0 -22
  367. data/curation_concerns-models/app/jobs/active_fedora_pid_based_job.rb +0 -6
  368. data/curation_concerns-models/app/jobs/audit_job.rb +0 -58
  369. data/curation_concerns-models/app/jobs/characterize_job.rb +0 -11
  370. data/curation_concerns-models/app/jobs/copy_permissions_job.rb +0 -24
  371. data/curation_concerns-models/app/jobs/create_derivatives_job.rb +0 -15
  372. data/curation_concerns-models/app/jobs/import_url_job.rb +0 -56
  373. data/curation_concerns-models/app/jobs/ingest_local_file_job.rb +0 -48
  374. data/curation_concerns-models/app/jobs/resolrize_job.rb +0 -9
  375. data/curation_concerns-models/app/models/checksum_audit_log.rb +0 -21
  376. data/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb +0 -34
  377. data/curation_concerns-models/app/models/concerns/curation_concerns/basic_metadata.rb +0 -87
  378. data/curation_concerns-models/app/models/concerns/curation_concerns/collection_behavior.rb +0 -47
  379. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/belongs_to_works.rb +0 -53
  380. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/characterization.rb +0 -89
  381. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/content.rb +0 -8
  382. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/export.rb +0 -343
  383. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/full_text_indexing.rb +0 -12
  384. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/indexing.rb +0 -14
  385. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/versions.rb +0 -16
  386. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file.rb +0 -5
  387. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file_behavior.rb +0 -44
  388. data/curation_concerns-models/app/models/concerns/curation_concerns/generic_work_behavior.rb +0 -38
  389. data/curation_concerns-models/app/models/concerns/curation_concerns/has_representative.rb +0 -14
  390. data/curation_concerns-models/app/models/concerns/curation_concerns/human_readable_type.rb +0 -23
  391. data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/readable.rb +0 -19
  392. data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/writable.rb +0 -75
  393. data/curation_concerns-models/app/models/concerns/curation_concerns/permissions.rb +0 -7
  394. data/curation_concerns-models/app/models/concerns/curation_concerns/serializers.rb +0 -15
  395. data/curation_concerns-models/app/models/concerns/curation_concerns/solr_document_behavior.rb +0 -135
  396. data/curation_concerns-models/app/models/concerns/curation_concerns/user.rb +0 -65
  397. data/curation_concerns-models/app/models/concerns/curation_concerns/with_basic_metadata.rb +0 -98
  398. data/curation_concerns-models/app/models/concerns/curation_concerns/with_generic_files.rb +0 -29
  399. data/curation_concerns-models/app/models/curation_concerns/classify_concern.rb +0 -47
  400. data/curation_concerns-models/app/models/curation_concerns/quick_classification_query.rb +0 -31
  401. data/curation_concerns-models/app/models/datastreams/fits_datastream.rb +0 -148
  402. data/curation_concerns-models/app/models/version_committer.rb +0 -2
  403. data/curation_concerns-models/app/services/curation_concerns/characterization_service.rb +0 -71
  404. data/curation_concerns-models/app/services/curation_concerns/full_text_extraction_service.rb +0 -38
  405. data/curation_concerns-models/app/services/curation_concerns/generic_file_audit_service.rb +0 -85
  406. data/curation_concerns-models/app/services/curation_concerns/generic_file_indexing_service.rb +0 -14
  407. data/curation_concerns-models/app/services/curation_concerns/generic_work_indexing_service.rb +0 -16
  408. data/curation_concerns-models/app/services/curation_concerns/noid.rb +0 -23
  409. data/curation_concerns-models/app/services/curation_concerns/repository_audit_service.rb +0 -9
  410. data/curation_concerns-models/app/services/curation_concerns/versioning_service.rb +0 -27
  411. data/curation_concerns-models/config/locales/curation_concerns.en.yml +0 -6
  412. data/curation_concerns-models/curation_concerns-models.gemspec +0 -34
  413. data/curation_concerns-models/lib/curation_concerns/messages.rb +0 -66
  414. data/curation_concerns-models/lib/curation_concerns/models/engine.rb +0 -61
  415. data/curation_concerns-models/lib/curation_concerns/models/resque.rb +0 -36
  416. data/curation_concerns-models/lib/curation_concerns/models/utils.rb +0 -22
  417. data/curation_concerns-models/lib/curation_concerns/models/version.rb +0 -5
  418. data/curation_concerns-models/lib/curation_concerns/models.rb +0 -32
  419. data/curation_concerns-models/lib/generators/curation_concerns/models/abstract_migration_generator.rb +0 -30
  420. data/curation_concerns-models/lib/generators/curation_concerns/models/clamav_generator.rb +0 -19
  421. data/curation_concerns-models/lib/generators/curation_concerns/models/fulltext_generator.rb +0 -28
  422. data/curation_concerns-models/lib/generators/curation_concerns/models/install_generator.rb +0 -70
  423. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/collection.rb +0 -4
  424. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/generic_file.rb +0 -4
  425. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/clamav.rb +0 -1
  426. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/curation_concerns.rb +0 -123
  427. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/mime_types.rb +0 -6
  428. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis.yml +0 -9
  429. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis_config.rb +0 -32
  430. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque-pool.yml +0 -1
  431. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_admin.rb +0 -10
  432. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_config.rb +0 -5
  433. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_checksum_audit_logs.rb +0 -19
  434. data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_version_committers.rb +0 -15
  435. data/curation_concerns-models/lib/tasks/curation_concerns-models_tasks.rake +0 -75
  436. data/curation_concerns-models/lib/tasks/migrate.rake +0 -13
  437. data/curation_concerns-models/lib/tasks/resque.rake +0 -13
  438. data/curation_concerns-models/lib/tasks/solr_reindex.rake +0 -8
  439. data/lib/curation_concerns/configuration.rb +0 -74
  440. data/lib/generators/curation_concerns/templates/curation_concerns_config.rb +0 -2
  441. data/solr_conf/conf/solrconfig.xml +0 -223
  442. data/spec/abilities/generic_file_abilities_spec.rb +0 -62
  443. data/spec/actors/curation_concerns/generic_file_actor_spec.rb +0 -116
  444. data/spec/controllers/curation_concerns/generic_files_controller_spec.rb +0 -251
  445. data/spec/forms/generic_file_edit_form_spec.rb +0 -33
  446. data/spec/helpers/thumbnail_helper_spec.rb +0 -21
  447. data/spec/jobs/copy_permissions_job_spec.rb +0 -49
  448. data/spec/jobs/curation_concerns_resque_queue_spec.rb +0 -49
  449. data/spec/models/curation_concerns/generic_file/derivatives_spec.rb +0 -88
  450. data/spec/models/curation_concerns/generic_work_behavior_spec.rb +0 -35
  451. data/spec/models/fits_datastream_spec.rb +0 -127
  452. data/spec/models/generic_file_spec.rb +0 -619
  453. data/spec/presenters/curation_concerns/generic_file_presenter_spec.rb +0 -16
  454. data/spec/services/characterization_service_spec.rb +0 -30
  455. data/spec/services/full_text_extraction_service_spec.rb +0 -5
  456. data/spec/services/generic_file_audit_service_spec.rb +0 -71
  457. data/spec/services/generic_file_indexing_service_spec.rb +0 -57
  458. data/spec/services/generic_work_indexing_service_spec.rb +0 -18
  459. data/spec/workers/visibility_copy_worker_spec.rb +0 -70
  460. data/vendor/assets/javascripts/handlebars.js +0 -2278
  461. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.autocomplete.js +0 -602
  462. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.core.js +0 -356
  463. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect-highlight.js +0 -50
  464. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect.js +0 -1276
  465. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.menu.js +0 -610
  466. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.position.js +0 -498
  467. data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.widget.js +0 -528
  468. data/vendor/assets/javascripts/jquery.tokeninput.js +0 -1061
  469. data/vendor/assets/stylesheets/jquery-ui-lightness.css +0 -474
  470. data/vendor/assets/stylesheets/token-input-facebook.css +0 -122
  471. data/vendor/assets/stylesheets/token-input-mac.css +0 -204
  472. data/vendor/assets/stylesheets/token-input.css +0 -127
@@ -1,1276 +0,0 @@
1
- /*!
2
- * jQuery UI Effects @VERSION
3
- * http://jqueryui.com
4
- *
5
- * Copyright 2012 jQuery Foundation and other contributors
6
- * Released under the MIT license.
7
- * http://jquery.org/license
8
- *
9
- * http://api.jqueryui.com/category/effects-core/
10
- */
11
- ;(jQuery.effects || (function($, undefined) {
12
-
13
- var backCompat = $.uiBackCompat !== false,
14
- // prefix used for storing data on .data()
15
- dataSpace = "ui-effects-";
16
-
17
- $.effects = {
18
- effect: {}
19
- };
20
-
21
- /*!
22
- * jQuery Color Animations v2.0.0
23
- * http://jquery.com/
24
- *
25
- * Copyright 2012 jQuery Foundation and other contributors
26
- * Released under the MIT license.
27
- * http://jquery.org/license
28
- *
29
- * Date: Mon Aug 13 13:41:02 2012 -0500
30
- */
31
- (function( jQuery, undefined ) {
32
-
33
- var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "),
34
-
35
- // plusequals test for += 100 -= 100
36
- rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
37
- // a set of RE's that can match strings and generate color tuples.
38
- stringParsers = [{
39
- re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
40
- parse: function( execResult ) {
41
- return [
42
- execResult[ 1 ],
43
- execResult[ 2 ],
44
- execResult[ 3 ],
45
- execResult[ 4 ]
46
- ];
47
- }
48
- }, {
49
- re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
50
- parse: function( execResult ) {
51
- return [
52
- execResult[ 1 ] * 2.55,
53
- execResult[ 2 ] * 2.55,
54
- execResult[ 3 ] * 2.55,
55
- execResult[ 4 ]
56
- ];
57
- }
58
- }, {
59
- // this regex ignores A-F because it's compared against an already lowercased string
60
- re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
61
- parse: function( execResult ) {
62
- return [
63
- parseInt( execResult[ 1 ], 16 ),
64
- parseInt( execResult[ 2 ], 16 ),
65
- parseInt( execResult[ 3 ], 16 )
66
- ];
67
- }
68
- }, {
69
- // this regex ignores A-F because it's compared against an already lowercased string
70
- re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
71
- parse: function( execResult ) {
72
- return [
73
- parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
74
- parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
75
- parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
76
- ];
77
- }
78
- }, {
79
- re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
80
- space: "hsla",
81
- parse: function( execResult ) {
82
- return [
83
- execResult[ 1 ],
84
- execResult[ 2 ] / 100,
85
- execResult[ 3 ] / 100,
86
- execResult[ 4 ]
87
- ];
88
- }
89
- }],
90
-
91
- // jQuery.Color( )
92
- color = jQuery.Color = function( color, green, blue, alpha ) {
93
- return new jQuery.Color.fn.parse( color, green, blue, alpha );
94
- },
95
- spaces = {
96
- rgba: {
97
- props: {
98
- red: {
99
- idx: 0,
100
- type: "byte"
101
- },
102
- green: {
103
- idx: 1,
104
- type: "byte"
105
- },
106
- blue: {
107
- idx: 2,
108
- type: "byte"
109
- }
110
- }
111
- },
112
-
113
- hsla: {
114
- props: {
115
- hue: {
116
- idx: 0,
117
- type: "degrees"
118
- },
119
- saturation: {
120
- idx: 1,
121
- type: "percent"
122
- },
123
- lightness: {
124
- idx: 2,
125
- type: "percent"
126
- }
127
- }
128
- }
129
- },
130
- propTypes = {
131
- "byte": {
132
- floor: true,
133
- max: 255
134
- },
135
- "percent": {
136
- max: 1
137
- },
138
- "degrees": {
139
- mod: 360,
140
- floor: true
141
- }
142
- },
143
- support = color.support = {},
144
-
145
- // element for support tests
146
- supportElem = jQuery( "<p>" )[ 0 ],
147
-
148
- // colors = jQuery.Color.names
149
- colors,
150
-
151
- // local aliases of functions called often
152
- each = jQuery.each;
153
-
154
- // determine rgba support immediately
155
- supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
156
- support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
157
-
158
- // define cache name and alpha properties
159
- // for rgba and hsla spaces
160
- each( spaces, function( spaceName, space ) {
161
- space.cache = "_" + spaceName;
162
- space.props.alpha = {
163
- idx: 3,
164
- type: "percent",
165
- def: 1
166
- };
167
- });
168
-
169
- function clamp( value, prop, allowEmpty ) {
170
- var type = propTypes[ prop.type ] || {};
171
-
172
- if ( value == null ) {
173
- return (allowEmpty || !prop.def) ? null : prop.def;
174
- }
175
-
176
- // ~~ is an short way of doing floor for positive numbers
177
- value = type.floor ? ~~value : parseFloat( value );
178
-
179
- // IE will pass in empty strings as value for alpha,
180
- // which will hit this case
181
- if ( isNaN( value ) ) {
182
- return prop.def;
183
- }
184
-
185
- if ( type.mod ) {
186
- // we add mod before modding to make sure that negatives values
187
- // get converted properly: -10 -> 350
188
- return (value + type.mod) % type.mod;
189
- }
190
-
191
- // for now all property types without mod have min and max
192
- return 0 > value ? 0 : type.max < value ? type.max : value;
193
- }
194
-
195
- function stringParse( string ) {
196
- var inst = color(),
197
- rgba = inst._rgba = [];
198
-
199
- string = string.toLowerCase();
200
-
201
- each( stringParsers, function( i, parser ) {
202
- var parsed,
203
- match = parser.re.exec( string ),
204
- values = match && parser.parse( match ),
205
- spaceName = parser.space || "rgba";
206
-
207
- if ( values ) {
208
- parsed = inst[ spaceName ]( values );
209
-
210
- // if this was an rgba parse the assignment might happen twice
211
- // oh well....
212
- inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
213
- rgba = inst._rgba = parsed._rgba;
214
-
215
- // exit each( stringParsers ) here because we matched
216
- return false;
217
- }
218
- });
219
-
220
- // Found a stringParser that handled it
221
- if ( rgba.length ) {
222
-
223
- // if this came from a parsed string, force "transparent" when alpha is 0
224
- // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
225
- if ( rgba.join() === "0,0,0,0" ) {
226
- jQuery.extend( rgba, colors.transparent );
227
- }
228
- return inst;
229
- }
230
-
231
- // named colors
232
- return colors[ string ];
233
- }
234
-
235
- color.fn = jQuery.extend( color.prototype, {
236
- parse: function( red, green, blue, alpha ) {
237
- if ( red === undefined ) {
238
- this._rgba = [ null, null, null, null ];
239
- return this;
240
- }
241
- if ( red.jquery || red.nodeType ) {
242
- red = jQuery( red ).css( green );
243
- green = undefined;
244
- }
245
-
246
- var inst = this,
247
- type = jQuery.type( red ),
248
- rgba = this._rgba = [];
249
-
250
- // more than 1 argument specified - assume ( red, green, blue, alpha )
251
- if ( green !== undefined ) {
252
- red = [ red, green, blue, alpha ];
253
- type = "array";
254
- }
255
-
256
- if ( type === "string" ) {
257
- return this.parse( stringParse( red ) || colors._default );
258
- }
259
-
260
- if ( type === "array" ) {
261
- each( spaces.rgba.props, function( key, prop ) {
262
- rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
263
- });
264
- return this;
265
- }
266
-
267
- if ( type === "object" ) {
268
- if ( red instanceof color ) {
269
- each( spaces, function( spaceName, space ) {
270
- if ( red[ space.cache ] ) {
271
- inst[ space.cache ] = red[ space.cache ].slice();
272
- }
273
- });
274
- } else {
275
- each( spaces, function( spaceName, space ) {
276
- var cache = space.cache;
277
- each( space.props, function( key, prop ) {
278
-
279
- // if the cache doesn't exist, and we know how to convert
280
- if ( !inst[ cache ] && space.to ) {
281
-
282
- // if the value was null, we don't need to copy it
283
- // if the key was alpha, we don't need to copy it either
284
- if ( key === "alpha" || red[ key ] == null ) {
285
- return;
286
- }
287
- inst[ cache ] = space.to( inst._rgba );
288
- }
289
-
290
- // this is the only case where we allow nulls for ALL properties.
291
- // call clamp with alwaysAllowEmpty
292
- inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
293
- });
294
-
295
- // everything defined but alpha?
296
- if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
297
- // use the default of 1
298
- inst[ cache ][ 3 ] = 1;
299
- if ( space.from ) {
300
- inst._rgba = space.from( inst[ cache ] );
301
- }
302
- }
303
- });
304
- }
305
- return this;
306
- }
307
- },
308
- is: function( compare ) {
309
- var is = color( compare ),
310
- same = true,
311
- inst = this;
312
-
313
- each( spaces, function( _, space ) {
314
- var localCache,
315
- isCache = is[ space.cache ];
316
- if (isCache) {
317
- localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
318
- each( space.props, function( _, prop ) {
319
- if ( isCache[ prop.idx ] != null ) {
320
- same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
321
- return same;
322
- }
323
- });
324
- }
325
- return same;
326
- });
327
- return same;
328
- },
329
- _space: function() {
330
- var used = [],
331
- inst = this;
332
- each( spaces, function( spaceName, space ) {
333
- if ( inst[ space.cache ] ) {
334
- used.push( spaceName );
335
- }
336
- });
337
- return used.pop();
338
- },
339
- transition: function( other, distance ) {
340
- var end = color( other ),
341
- spaceName = end._space(),
342
- space = spaces[ spaceName ],
343
- startColor = this.alpha() === 0 ? color( "transparent" ) : this,
344
- start = startColor[ space.cache ] || space.to( startColor._rgba ),
345
- result = start.slice();
346
-
347
- end = end[ space.cache ];
348
- each( space.props, function( key, prop ) {
349
- var index = prop.idx,
350
- startValue = start[ index ],
351
- endValue = end[ index ],
352
- type = propTypes[ prop.type ] || {};
353
-
354
- // if null, don't override start value
355
- if ( endValue === null ) {
356
- return;
357
- }
358
- // if null - use end
359
- if ( startValue === null ) {
360
- result[ index ] = endValue;
361
- } else {
362
- if ( type.mod ) {
363
- if ( endValue - startValue > type.mod / 2 ) {
364
- startValue += type.mod;
365
- } else if ( startValue - endValue > type.mod / 2 ) {
366
- startValue -= type.mod;
367
- }
368
- }
369
- result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
370
- }
371
- });
372
- return this[ spaceName ]( result );
373
- },
374
- blend: function( opaque ) {
375
- // if we are already opaque - return ourself
376
- if ( this._rgba[ 3 ] === 1 ) {
377
- return this;
378
- }
379
-
380
- var rgb = this._rgba.slice(),
381
- a = rgb.pop(),
382
- blend = color( opaque )._rgba;
383
-
384
- return color( jQuery.map( rgb, function( v, i ) {
385
- return ( 1 - a ) * blend[ i ] + a * v;
386
- }));
387
- },
388
- toRgbaString: function() {
389
- var prefix = "rgba(",
390
- rgba = jQuery.map( this._rgba, function( v, i ) {
391
- return v == null ? ( i > 2 ? 1 : 0 ) : v;
392
- });
393
-
394
- if ( rgba[ 3 ] === 1 ) {
395
- rgba.pop();
396
- prefix = "rgb(";
397
- }
398
-
399
- return prefix + rgba.join() + ")";
400
- },
401
- toHslaString: function() {
402
- var prefix = "hsla(",
403
- hsla = jQuery.map( this.hsla(), function( v, i ) {
404
- if ( v == null ) {
405
- v = i > 2 ? 1 : 0;
406
- }
407
-
408
- // catch 1 and 2
409
- if ( i && i < 3 ) {
410
- v = Math.round( v * 100 ) + "%";
411
- }
412
- return v;
413
- });
414
-
415
- if ( hsla[ 3 ] === 1 ) {
416
- hsla.pop();
417
- prefix = "hsl(";
418
- }
419
- return prefix + hsla.join() + ")";
420
- },
421
- toHexString: function( includeAlpha ) {
422
- var rgba = this._rgba.slice(),
423
- alpha = rgba.pop();
424
-
425
- if ( includeAlpha ) {
426
- rgba.push( ~~( alpha * 255 ) );
427
- }
428
-
429
- return "#" + jQuery.map( rgba, function( v ) {
430
-
431
- // default to 0 when nulls exist
432
- v = ( v || 0 ).toString( 16 );
433
- return v.length === 1 ? "0" + v : v;
434
- }).join("");
435
- },
436
- toString: function() {
437
- return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
438
- }
439
- });
440
- color.fn.parse.prototype = color.fn;
441
-
442
- // hsla conversions adapted from:
443
- // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
444
-
445
- function hue2rgb( p, q, h ) {
446
- h = ( h + 1 ) % 1;
447
- if ( h * 6 < 1 ) {
448
- return p + (q - p) * h * 6;
449
- }
450
- if ( h * 2 < 1) {
451
- return q;
452
- }
453
- if ( h * 3 < 2 ) {
454
- return p + (q - p) * ((2/3) - h) * 6;
455
- }
456
- return p;
457
- }
458
-
459
- spaces.hsla.to = function ( rgba ) {
460
- if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
461
- return [ null, null, null, rgba[ 3 ] ];
462
- }
463
- var r = rgba[ 0 ] / 255,
464
- g = rgba[ 1 ] / 255,
465
- b = rgba[ 2 ] / 255,
466
- a = rgba[ 3 ],
467
- max = Math.max( r, g, b ),
468
- min = Math.min( r, g, b ),
469
- diff = max - min,
470
- add = max + min,
471
- l = add * 0.5,
472
- h, s;
473
-
474
- if ( min === max ) {
475
- h = 0;
476
- } else if ( r === max ) {
477
- h = ( 60 * ( g - b ) / diff ) + 360;
478
- } else if ( g === max ) {
479
- h = ( 60 * ( b - r ) / diff ) + 120;
480
- } else {
481
- h = ( 60 * ( r - g ) / diff ) + 240;
482
- }
483
-
484
- if ( l === 0 || l === 1 ) {
485
- s = l;
486
- } else if ( l <= 0.5 ) {
487
- s = diff / add;
488
- } else {
489
- s = diff / ( 2 - add );
490
- }
491
- return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
492
- };
493
-
494
- spaces.hsla.from = function ( hsla ) {
495
- if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
496
- return [ null, null, null, hsla[ 3 ] ];
497
- }
498
- var h = hsla[ 0 ] / 360,
499
- s = hsla[ 1 ],
500
- l = hsla[ 2 ],
501
- a = hsla[ 3 ],
502
- q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
503
- p = 2 * l - q;
504
-
505
- return [
506
- Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
507
- Math.round( hue2rgb( p, q, h ) * 255 ),
508
- Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
509
- a
510
- ];
511
- };
512
-
513
-
514
- each( spaces, function( spaceName, space ) {
515
- var props = space.props,
516
- cache = space.cache,
517
- to = space.to,
518
- from = space.from;
519
-
520
- // makes rgba() and hsla()
521
- color.fn[ spaceName ] = function( value ) {
522
-
523
- // generate a cache for this space if it doesn't exist
524
- if ( to && !this[ cache ] ) {
525
- this[ cache ] = to( this._rgba );
526
- }
527
- if ( value === undefined ) {
528
- return this[ cache ].slice();
529
- }
530
-
531
- var ret,
532
- type = jQuery.type( value ),
533
- arr = ( type === "array" || type === "object" ) ? value : arguments,
534
- local = this[ cache ].slice();
535
-
536
- each( props, function( key, prop ) {
537
- var val = arr[ type === "object" ? key : prop.idx ];
538
- if ( val == null ) {
539
- val = local[ prop.idx ];
540
- }
541
- local[ prop.idx ] = clamp( val, prop );
542
- });
543
-
544
- if ( from ) {
545
- ret = color( from( local ) );
546
- ret[ cache ] = local;
547
- return ret;
548
- } else {
549
- return color( local );
550
- }
551
- };
552
-
553
- // makes red() green() blue() alpha() hue() saturation() lightness()
554
- each( props, function( key, prop ) {
555
- // alpha is included in more than one space
556
- if ( color.fn[ key ] ) {
557
- return;
558
- }
559
- color.fn[ key ] = function( value ) {
560
- var vtype = jQuery.type( value ),
561
- fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
562
- local = this[ fn ](),
563
- cur = local[ prop.idx ],
564
- match;
565
-
566
- if ( vtype === "undefined" ) {
567
- return cur;
568
- }
569
-
570
- if ( vtype === "function" ) {
571
- value = value.call( this, cur );
572
- vtype = jQuery.type( value );
573
- }
574
- if ( value == null && prop.empty ) {
575
- return this;
576
- }
577
- if ( vtype === "string" ) {
578
- match = rplusequals.exec( value );
579
- if ( match ) {
580
- value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
581
- }
582
- }
583
- local[ prop.idx ] = value;
584
- return this[ fn ]( local );
585
- };
586
- });
587
- });
588
-
589
- // add .fx.step functions
590
- each( stepHooks, function( i, hook ) {
591
- jQuery.cssHooks[ hook ] = {
592
- set: function( elem, value ) {
593
- var parsed, curElem,
594
- backgroundColor = "";
595
-
596
- if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) {
597
- value = color( parsed || value );
598
- if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
599
- curElem = hook === "backgroundColor" ? elem.parentNode : elem;
600
- while (
601
- (backgroundColor === "" || backgroundColor === "transparent") &&
602
- curElem && curElem.style
603
- ) {
604
- try {
605
- backgroundColor = jQuery.css( curElem, "backgroundColor" );
606
- curElem = curElem.parentNode;
607
- } catch ( e ) {
608
- }
609
- }
610
-
611
- value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
612
- backgroundColor :
613
- "_default" );
614
- }
615
-
616
- value = value.toRgbaString();
617
- }
618
- try {
619
- elem.style[ hook ] = value;
620
- } catch( error ) {
621
- // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
622
- }
623
- }
624
- };
625
- jQuery.fx.step[ hook ] = function( fx ) {
626
- if ( !fx.colorInit ) {
627
- fx.start = color( fx.elem, hook );
628
- fx.end = color( fx.end );
629
- fx.colorInit = true;
630
- }
631
- jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
632
- };
633
- });
634
-
635
- jQuery.cssHooks.borderColor = {
636
- expand: function( value ) {
637
- var expanded = {};
638
-
639
- each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
640
- expanded[ "border" + part + "Color" ] = value;
641
- });
642
- return expanded;
643
- }
644
- };
645
-
646
- // Basic color names only.
647
- // Usage of any of the other color names requires adding yourself or including
648
- // jquery.color.svg-names.js.
649
- colors = jQuery.Color.names = {
650
- // 4.1. Basic color keywords
651
- aqua: "#00ffff",
652
- black: "#000000",
653
- blue: "#0000ff",
654
- fuchsia: "#ff00ff",
655
- gray: "#808080",
656
- green: "#008000",
657
- lime: "#00ff00",
658
- maroon: "#800000",
659
- navy: "#000080",
660
- olive: "#808000",
661
- purple: "#800080",
662
- red: "#ff0000",
663
- silver: "#c0c0c0",
664
- teal: "#008080",
665
- white: "#ffffff",
666
- yellow: "#ffff00",
667
-
668
- // 4.2.3. "transparent" color keyword
669
- transparent: [ null, null, null, 0 ],
670
-
671
- _default: "#ffffff"
672
- };
673
-
674
- })( jQuery );
675
-
676
-
677
-
678
- /******************************************************************************/
679
- /****************************** CLASS ANIMATIONS ******************************/
680
- /******************************************************************************/
681
- (function() {
682
-
683
- var classAnimationActions = [ "add", "remove", "toggle" ],
684
- shorthandStyles = {
685
- border: 1,
686
- borderBottom: 1,
687
- borderColor: 1,
688
- borderLeft: 1,
689
- borderRight: 1,
690
- borderTop: 1,
691
- borderWidth: 1,
692
- margin: 1,
693
- padding: 1
694
- };
695
-
696
- $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
697
- $.fx.step[ prop ] = function( fx ) {
698
- if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
699
- jQuery.style( fx.elem, prop, fx.end );
700
- fx.setAttr = true;
701
- }
702
- };
703
- });
704
-
705
- function getElementStyles() {
706
- var style = this.ownerDocument.defaultView ?
707
- this.ownerDocument.defaultView.getComputedStyle( this, null ) :
708
- this.currentStyle,
709
- newStyle = {},
710
- key,
711
- len;
712
-
713
- // webkit enumerates style porperties
714
- if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
715
- len = style.length;
716
- while ( len-- ) {
717
- key = style[ len ];
718
- if ( typeof style[ key ] === "string" ) {
719
- newStyle[ $.camelCase( key ) ] = style[ key ];
720
- }
721
- }
722
- } else {
723
- for ( key in style ) {
724
- if ( typeof style[ key ] === "string" ) {
725
- newStyle[ key ] = style[ key ];
726
- }
727
- }
728
- }
729
-
730
- return newStyle;
731
- }
732
-
733
-
734
- function styleDifference( oldStyle, newStyle ) {
735
- var diff = {},
736
- name, value;
737
-
738
- for ( name in newStyle ) {
739
- value = newStyle[ name ];
740
- if ( oldStyle[ name ] !== value ) {
741
- if ( !shorthandStyles[ name ] ) {
742
- if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
743
- diff[ name ] = value;
744
- }
745
- }
746
- }
747
- }
748
-
749
- return diff;
750
- }
751
-
752
- $.effects.animateClass = function( value, duration, easing, callback ) {
753
- var o = $.speed( duration, easing, callback );
754
-
755
- return this.queue( function() {
756
- var animated = $( this ),
757
- baseClass = animated.attr( "class" ) || "",
758
- applyClassChange,
759
- allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
760
-
761
- // map the animated objects to store the original styles.
762
- allAnimations = allAnimations.map(function() {
763
- var el = $( this );
764
- return {
765
- el: el,
766
- start: getElementStyles.call( this )
767
- };
768
- });
769
-
770
- // apply class change
771
- applyClassChange = function() {
772
- $.each( classAnimationActions, function(i, action) {
773
- if ( value[ action ] ) {
774
- animated[ action + "Class" ]( value[ action ] );
775
- }
776
- });
777
- };
778
- applyClassChange();
779
-
780
- // map all animated objects again - calculate new styles and diff
781
- allAnimations = allAnimations.map(function() {
782
- this.end = getElementStyles.call( this.el[ 0 ] );
783
- this.diff = styleDifference( this.start, this.end );
784
- return this;
785
- });
786
-
787
- // apply original class
788
- animated.attr( "class", baseClass );
789
-
790
- // map all animated objects again - this time collecting a promise
791
- allAnimations = allAnimations.map(function() {
792
- var styleInfo = this,
793
- dfd = $.Deferred(),
794
- opts = jQuery.extend({}, o, {
795
- queue: false,
796
- complete: function() {
797
- dfd.resolve( styleInfo );
798
- }
799
- });
800
-
801
- this.el.animate( this.diff, opts );
802
- return dfd.promise();
803
- });
804
-
805
- // once all animations have completed:
806
- $.when.apply( $, allAnimations.get() ).done(function() {
807
-
808
- // set the final class
809
- applyClassChange();
810
-
811
- // for each animated element,
812
- // clear all css properties that were animated
813
- $.each( arguments, function() {
814
- var el = this.el;
815
- $.each( this.diff, function(key) {
816
- el.css( key, '' );
817
- });
818
- });
819
-
820
- // this is guarnteed to be there if you use jQuery.speed()
821
- // it also handles dequeuing the next anim...
822
- o.complete.call( animated[ 0 ] );
823
- });
824
- });
825
- };
826
-
827
- $.fn.extend({
828
- _addClass: $.fn.addClass,
829
- addClass: function( classNames, speed, easing, callback ) {
830
- return speed ?
831
- $.effects.animateClass.call( this,
832
- { add: classNames }, speed, easing, callback ) :
833
- this._addClass( classNames );
834
- },
835
-
836
- _removeClass: $.fn.removeClass,
837
- removeClass: function( classNames, speed, easing, callback ) {
838
- return speed ?
839
- $.effects.animateClass.call( this,
840
- { remove: classNames }, speed, easing, callback ) :
841
- this._removeClass( classNames );
842
- },
843
-
844
- _toggleClass: $.fn.toggleClass,
845
- toggleClass: function( classNames, force, speed, easing, callback ) {
846
- if ( typeof force === "boolean" || force === undefined ) {
847
- if ( !speed ) {
848
- // without speed parameter
849
- return this._toggleClass( classNames, force );
850
- } else {
851
- return $.effects.animateClass.call( this,
852
- (force ? { add: classNames } : { remove: classNames }),
853
- speed, easing, callback );
854
- }
855
- } else {
856
- // without force parameter
857
- return $.effects.animateClass.call( this,
858
- { toggle: classNames }, force, speed, easing );
859
- }
860
- },
861
-
862
- switchClass: function( remove, add, speed, easing, callback) {
863
- return $.effects.animateClass.call( this, {
864
- add: add,
865
- remove: remove
866
- }, speed, easing, callback );
867
- }
868
- });
869
-
870
- })();
871
-
872
- /******************************************************************************/
873
- /*********************************** EFFECTS **********************************/
874
- /******************************************************************************/
875
-
876
- (function() {
877
-
878
- $.extend( $.effects, {
879
- version: "@VERSION",
880
-
881
- // Saves a set of properties in a data storage
882
- save: function( element, set ) {
883
- for( var i=0; i < set.length; i++ ) {
884
- if ( set[ i ] !== null ) {
885
- element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
886
- }
887
- }
888
- },
889
-
890
- // Restores a set of previously saved properties from a data storage
891
- restore: function( element, set ) {
892
- var val, i;
893
- for( i=0; i < set.length; i++ ) {
894
- if ( set[ i ] !== null ) {
895
- val = element.data( dataSpace + set[ i ] );
896
- // support: jQuery 1.6.2
897
- // http://bugs.jquery.com/ticket/9917
898
- // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
899
- // We can't differentiate between "" and 0 here, so we just assume
900
- // empty string since it's likely to be a more common value...
901
- if ( val === undefined ) {
902
- val = "";
903
- }
904
- element.css( set[ i ], val );
905
- }
906
- }
907
- },
908
-
909
- setMode: function( el, mode ) {
910
- if (mode === "toggle") {
911
- mode = el.is( ":hidden" ) ? "show" : "hide";
912
- }
913
- return mode;
914
- },
915
-
916
- // Translates a [top,left] array into a baseline value
917
- // this should be a little more flexible in the future to handle a string & hash
918
- getBaseline: function( origin, original ) {
919
- var y, x;
920
- switch ( origin[ 0 ] ) {
921
- case "top": y = 0; break;
922
- case "middle": y = 0.5; break;
923
- case "bottom": y = 1; break;
924
- default: y = origin[ 0 ] / original.height;
925
- }
926
- switch ( origin[ 1 ] ) {
927
- case "left": x = 0; break;
928
- case "center": x = 0.5; break;
929
- case "right": x = 1; break;
930
- default: x = origin[ 1 ] / original.width;
931
- }
932
- return {
933
- x: x,
934
- y: y
935
- };
936
- },
937
-
938
- // Wraps the element around a wrapper that copies position properties
939
- createWrapper: function( element ) {
940
-
941
- // if the element is already wrapped, return it
942
- if ( element.parent().is( ".ui-effects-wrapper" )) {
943
- return element.parent();
944
- }
945
-
946
- // wrap the element
947
- var props = {
948
- width: element.outerWidth(true),
949
- height: element.outerHeight(true),
950
- "float": element.css( "float" )
951
- },
952
- wrapper = $( "<div></div>" )
953
- .addClass( "ui-effects-wrapper" )
954
- .css({
955
- fontSize: "100%",
956
- background: "transparent",
957
- border: "none",
958
- margin: 0,
959
- padding: 0
960
- }),
961
- // Store the size in case width/height are defined in % - Fixes #5245
962
- size = {
963
- width: element.width(),
964
- height: element.height()
965
- },
966
- active = document.activeElement;
967
-
968
- // support: Firefox
969
- // Firefox incorrectly exposes anonymous content
970
- // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
971
- try {
972
- active.id;
973
- } catch( e ) {
974
- active = document.body;
975
- }
976
-
977
- element.wrap( wrapper );
978
-
979
- // Fixes #7595 - Elements lose focus when wrapped.
980
- if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
981
- $( active ).focus();
982
- }
983
-
984
- wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
985
-
986
- // transfer positioning properties to the wrapper
987
- if ( element.css( "position" ) === "static" ) {
988
- wrapper.css({ position: "relative" });
989
- element.css({ position: "relative" });
990
- } else {
991
- $.extend( props, {
992
- position: element.css( "position" ),
993
- zIndex: element.css( "z-index" )
994
- });
995
- $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
996
- props[ pos ] = element.css( pos );
997
- if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
998
- props[ pos ] = "auto";
999
- }
1000
- });
1001
- element.css({
1002
- position: "relative",
1003
- top: 0,
1004
- left: 0,
1005
- right: "auto",
1006
- bottom: "auto"
1007
- });
1008
- }
1009
- element.css(size);
1010
-
1011
- return wrapper.css( props ).show();
1012
- },
1013
-
1014
- removeWrapper: function( element ) {
1015
- var active = document.activeElement;
1016
-
1017
- if ( element.parent().is( ".ui-effects-wrapper" ) ) {
1018
- element.parent().replaceWith( element );
1019
-
1020
- // Fixes #7595 - Elements lose focus when wrapped.
1021
- if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
1022
- $( active ).focus();
1023
- }
1024
- }
1025
-
1026
-
1027
- return element;
1028
- },
1029
-
1030
- setTransition: function( element, list, factor, value ) {
1031
- value = value || {};
1032
- $.each( list, function( i, x ) {
1033
- var unit = element.cssUnit( x );
1034
- if ( unit[ 0 ] > 0 ) {
1035
- value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
1036
- }
1037
- });
1038
- return value;
1039
- }
1040
- });
1041
-
1042
- // return an effect options object for the given parameters:
1043
- function _normalizeArguments( effect, options, speed, callback ) {
1044
-
1045
- // allow passing all options as the first parameter
1046
- if ( $.isPlainObject( effect ) ) {
1047
- options = effect;
1048
- effect = effect.effect;
1049
- }
1050
-
1051
- // convert to an object
1052
- effect = { effect: effect };
1053
-
1054
- // catch (effect, null, ...)
1055
- if ( options == null ) {
1056
- options = {};
1057
- }
1058
-
1059
- // catch (effect, callback)
1060
- if ( $.isFunction( options ) ) {
1061
- callback = options;
1062
- speed = null;
1063
- options = {};
1064
- }
1065
-
1066
- // catch (effect, speed, ?)
1067
- if ( typeof options === "number" || $.fx.speeds[ options ] ) {
1068
- callback = speed;
1069
- speed = options;
1070
- options = {};
1071
- }
1072
-
1073
- // catch (effect, options, callback)
1074
- if ( $.isFunction( speed ) ) {
1075
- callback = speed;
1076
- speed = null;
1077
- }
1078
-
1079
- // add options to effect
1080
- if ( options ) {
1081
- $.extend( effect, options );
1082
- }
1083
-
1084
- speed = speed || options.duration;
1085
- effect.duration = $.fx.off ? 0 :
1086
- typeof speed === "number" ? speed :
1087
- speed in $.fx.speeds ? $.fx.speeds[ speed ] :
1088
- $.fx.speeds._default;
1089
-
1090
- effect.complete = callback || options.complete;
1091
-
1092
- return effect;
1093
- }
1094
-
1095
- function standardSpeed( speed ) {
1096
- // valid standard speeds
1097
- if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
1098
- return true;
1099
- }
1100
-
1101
- // invalid strings - treat as "normal" speed
1102
- if ( typeof speed === "string" && !$.effects.effect[ speed ] ) {
1103
- // TODO: remove in 2.0 (#7115)
1104
- if ( backCompat && $.effects[ speed ] ) {
1105
- return false;
1106
- }
1107
- return true;
1108
- }
1109
-
1110
- return false;
1111
- }
1112
-
1113
- $.fn.extend({
1114
- effect: function( /* effect, options, speed, callback */ ) {
1115
- var args = _normalizeArguments.apply( this, arguments ),
1116
- mode = args.mode,
1117
- queue = args.queue,
1118
- effectMethod = $.effects.effect[ args.effect ],
1119
-
1120
- // DEPRECATED: remove in 2.0 (#7115)
1121
- oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ];
1122
-
1123
- if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) {
1124
- // delegate to the original method (e.g., .show()) if possible
1125
- if ( mode ) {
1126
- return this[ mode ]( args.duration, args.complete );
1127
- } else {
1128
- return this.each( function() {
1129
- if ( args.complete ) {
1130
- args.complete.call( this );
1131
- }
1132
- });
1133
- }
1134
- }
1135
-
1136
- function run( next ) {
1137
- var elem = $( this ),
1138
- complete = args.complete,
1139
- mode = args.mode;
1140
-
1141
- function done() {
1142
- if ( $.isFunction( complete ) ) {
1143
- complete.call( elem[0] );
1144
- }
1145
- if ( $.isFunction( next ) ) {
1146
- next();
1147
- }
1148
- }
1149
-
1150
- // if the element is hiddden and mode is hide,
1151
- // or element is visible and mode is show
1152
- if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
1153
- done();
1154
- } else {
1155
- effectMethod.call( elem[0], args, done );
1156
- }
1157
- }
1158
-
1159
- // TODO: remove this check in 2.0, effectMethod will always be true
1160
- if ( effectMethod ) {
1161
- return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
1162
- } else {
1163
- // DEPRECATED: remove in 2.0 (#7115)
1164
- return oldEffectMethod.call(this, {
1165
- options: args,
1166
- duration: args.duration,
1167
- callback: args.complete,
1168
- mode: args.mode
1169
- });
1170
- }
1171
- },
1172
-
1173
- _show: $.fn.show,
1174
- show: function( speed ) {
1175
- if ( standardSpeed( speed ) ) {
1176
- return this._show.apply( this, arguments );
1177
- } else {
1178
- var args = _normalizeArguments.apply( this, arguments );
1179
- args.mode = "show";
1180
- return this.effect.call( this, args );
1181
- }
1182
- },
1183
-
1184
- _hide: $.fn.hide,
1185
- hide: function( speed ) {
1186
- if ( standardSpeed( speed ) ) {
1187
- return this._hide.apply( this, arguments );
1188
- } else {
1189
- var args = _normalizeArguments.apply( this, arguments );
1190
- args.mode = "hide";
1191
- return this.effect.call( this, args );
1192
- }
1193
- },
1194
-
1195
- // jQuery core overloads toggle and creates _toggle
1196
- __toggle: $.fn.toggle,
1197
- toggle: function( speed ) {
1198
- if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
1199
- return this.__toggle.apply( this, arguments );
1200
- } else {
1201
- var args = _normalizeArguments.apply( this, arguments );
1202
- args.mode = "toggle";
1203
- return this.effect.call( this, args );
1204
- }
1205
- },
1206
-
1207
- // helper functions
1208
- cssUnit: function(key) {
1209
- var style = this.css( key ),
1210
- val = [];
1211
-
1212
- $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
1213
- if ( style.indexOf( unit ) > 0 ) {
1214
- val = [ parseFloat( style ), unit ];
1215
- }
1216
- });
1217
- return val;
1218
- }
1219
- });
1220
-
1221
- })();
1222
-
1223
- /******************************************************************************/
1224
- /*********************************** EASING ***********************************/
1225
- /******************************************************************************/
1226
-
1227
- (function() {
1228
-
1229
- // based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
1230
-
1231
- var baseEasings = {};
1232
-
1233
- $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
1234
- baseEasings[ name ] = function( p ) {
1235
- return Math.pow( p, i + 2 );
1236
- };
1237
- });
1238
-
1239
- $.extend( baseEasings, {
1240
- Sine: function ( p ) {
1241
- return 1 - Math.cos( p * Math.PI / 2 );
1242
- },
1243
- Circ: function ( p ) {
1244
- return 1 - Math.sqrt( 1 - p * p );
1245
- },
1246
- Elastic: function( p ) {
1247
- return p === 0 || p === 1 ? p :
1248
- -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
1249
- },
1250
- Back: function( p ) {
1251
- return p * p * ( 3 * p - 2 );
1252
- },
1253
- Bounce: function ( p ) {
1254
- var pow2,
1255
- bounce = 4;
1256
-
1257
- while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
1258
- return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
1259
- }
1260
- });
1261
-
1262
- $.each( baseEasings, function( name, easeIn ) {
1263
- $.easing[ "easeIn" + name ] = easeIn;
1264
- $.easing[ "easeOut" + name ] = function( p ) {
1265
- return 1 - easeIn( 1 - p );
1266
- };
1267
- $.easing[ "easeInOut" + name ] = function( p ) {
1268
- return p < 0.5 ?
1269
- easeIn( p * 2 ) / 2 :
1270
- 1 - easeIn( p * -2 + 2 ) / 2;
1271
- };
1272
- });
1273
-
1274
- })();
1275
-
1276
- })(jQuery));