mechanize_store 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (383) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +60 -0
  4. data/Rakefile +28 -0
  5. data/app/assets/javascripts/mechanize_store/application.js +22 -0
  6. data/app/assets/javascripts/mechanize_store/sb-admin/bootstrap.js +1951 -0
  7. data/app/assets/javascripts/mechanize_store/sb-admin/custom.js +58 -0
  8. data/app/assets/javascripts/mechanize_store/sb-admin/flot/excanvas.min.js +1 -0
  9. data/app/assets/javascripts/mechanize_store/sb-admin/flot/jquery.flot.js +3137 -0
  10. data/app/assets/javascripts/mechanize_store/sb-admin/flot/jquery.flot.pie.js +817 -0
  11. data/app/assets/javascripts/mechanize_store/sb-admin/flot/main.js +20 -0
  12. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/canvas-to-blob.min.js +1 -0
  13. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.blueimp-gallery.min.js +1 -0
  14. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-angular.js +429 -0
  15. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-audio.js +106 -0
  16. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-image.js +309 -0
  17. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-jquery-ui.js +152 -0
  18. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-process.js +172 -0
  19. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-ui.js +699 -0
  20. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-validate.js +119 -0
  21. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-video.js +106 -0
  22. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload.js +1426 -0
  23. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.iframe-transport.js +214 -0
  24. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.ui.widget.js +530 -0
  25. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/load-image.min.js +1 -0
  26. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/main.js +14 -0
  27. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/tmpl.min.js +1 -0
  28. data/app/assets/javascripts/mechanize_store/sb-admin/jquery-ui.js +2256 -0
  29. data/app/assets/javascripts/mechanize_store/sb-admin/jquery.activity-indicator-1.0.0.min.js +223 -0
  30. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/dataTables/dataTables.bootstrap.js +245 -0
  31. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/dataTables/jquery.dataTables.js +14013 -0
  32. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/flot/excanvas.min.js +1 -0
  33. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/flot/jquery.flot.js +2599 -0
  34. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/flot/jquery.flot.pie.js +750 -0
  35. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/flot/jquery.flot.resize.js +60 -0
  36. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/flot/jquery.flot.tooltip.min.js +12 -0
  37. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/metisMenu/jquery.metisMenu.js +45 -0
  38. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/morris/morris.js +1888 -0
  39. data/app/assets/javascripts/mechanize_store/sb-admin/plugins/morris/raphael-2.1.0.min.js +10 -0
  40. data/app/assets/javascripts/mechanize_store/sb-admin/sb-admin.js +18 -0
  41. data/app/assets/stylesheets/mechanize_store/application.css +197 -0
  42. data/app/assets/stylesheets/mechanize_store/sb-admin/bootstrap.css +5831 -0
  43. data/app/assets/stylesheets/mechanize_store/sb-admin/plugins/dataTables/dataTables.bootstrap.css +233 -0
  44. data/app/assets/stylesheets/mechanize_store/sb-admin/plugins/morris/morris-0.4.3.min.css +2 -0
  45. data/app/assets/stylesheets/mechanize_store/sb-admin/plugins/social-buttons/social-buttons.css +68 -0
  46. data/app/assets/stylesheets/mechanize_store/sb-admin/plugins/timeline/timeline.css +144 -0
  47. data/app/assets/stylesheets/mechanize_store/sb-admin/sb-admin.css +307 -0
  48. data/app/controllers/mechanize_store/application_controller.rb +4 -0
  49. data/app/controllers/mechanize_store/flags_controller.rb +77 -0
  50. data/app/controllers/mechanize_store/order_statuses_controller.rb +77 -0
  51. data/app/controllers/mechanize_store/orders_controller.rb +28 -0
  52. data/app/controllers/mechanize_store/payment_statuses_controller.rb +77 -0
  53. data/app/controllers/mechanize_store/payment_types_controller.rb +77 -0
  54. data/app/controllers/mechanize_store/product_categories_controller.rb +77 -0
  55. data/app/controllers/mechanize_store/product_photos_controller.rb +49 -0
  56. data/app/controllers/mechanize_store/products_controller.rb +77 -0
  57. data/app/helpers/mechanize_store/application_helper.rb +7 -0
  58. data/app/models/mechanize_store/flag.rb +4 -0
  59. data/app/models/mechanize_store/freight.rb +5 -0
  60. data/app/models/mechanize_store/order.rb +47 -0
  61. data/app/models/mechanize_store/order_item.rb +10 -0
  62. data/app/models/mechanize_store/order_status.rb +10 -0
  63. data/app/models/mechanize_store/payment.rb +8 -0
  64. data/app/models/mechanize_store/payment_status.rb +19 -0
  65. data/app/models/mechanize_store/payment_type.rb +5 -0
  66. data/app/models/mechanize_store/product.rb +11 -0
  67. data/app/models/mechanize_store/product_category.rb +5 -0
  68. data/app/models/mechanize_store/product_photo.rb +16 -0
  69. data/app/views/mechanize_store/flags/_form.html.erb +11 -0
  70. data/app/views/mechanize_store/flags/edit.html.erb +12 -0
  71. data/app/views/mechanize_store/flags/index.html.erb +46 -0
  72. data/app/views/mechanize_store/flags/new.html.erb +9 -0
  73. data/app/views/mechanize_store/flags/show.html.erb +15 -0
  74. data/app/views/mechanize_store/order_statuses/_form.html.erb +11 -0
  75. data/app/views/mechanize_store/order_statuses/edit.html.erb +12 -0
  76. data/app/views/mechanize_store/order_statuses/index.html.erb +46 -0
  77. data/app/views/mechanize_store/order_statuses/new.html.erb +9 -0
  78. data/app/views/mechanize_store/order_statuses/show.html.erb +15 -0
  79. data/app/views/mechanize_store/orders/index.html.erb +84 -0
  80. data/app/views/mechanize_store/orders/show.html.erb +0 -0
  81. data/app/views/mechanize_store/payment_statuses/_form.html.erb +11 -0
  82. data/app/views/mechanize_store/payment_statuses/edit.html.erb +12 -0
  83. data/app/views/mechanize_store/payment_statuses/index.html.erb +46 -0
  84. data/app/views/mechanize_store/payment_statuses/new.html.erb +9 -0
  85. data/app/views/mechanize_store/payment_statuses/show.html.erb +15 -0
  86. data/app/views/mechanize_store/payment_types/_form.html.erb +11 -0
  87. data/app/views/mechanize_store/payment_types/edit.html.erb +12 -0
  88. data/app/views/mechanize_store/payment_types/index.html.erb +46 -0
  89. data/app/views/mechanize_store/payment_types/new.html.erb +9 -0
  90. data/app/views/mechanize_store/payment_types/show.html.erb +15 -0
  91. data/app/views/mechanize_store/product_categories/_form.html.erb +12 -0
  92. data/app/views/mechanize_store/product_categories/edit.html.erb +12 -0
  93. data/app/views/mechanize_store/product_categories/index.html.erb +46 -0
  94. data/app/views/mechanize_store/product_categories/new.html.erb +9 -0
  95. data/app/views/mechanize_store/product_categories/show.html.erb +19 -0
  96. data/app/views/mechanize_store/product_photos/create.json.jbuilder +9 -0
  97. data/app/views/mechanize_store/product_photos/index.json.jbuilder +9 -0
  98. data/app/views/mechanize_store/products/_form.html.erb +18 -0
  99. data/app/views/mechanize_store/products/edit.html.erb +12 -0
  100. data/app/views/mechanize_store/products/index.html.erb +50 -0
  101. data/app/views/mechanize_store/products/new.html.erb +9 -0
  102. data/app/views/mechanize_store/products/show.html.erb +197 -0
  103. data/app/views/shared/_flashes.html.erb +8 -0
  104. data/config/locales/mechanize_store.pt-BR.yml +65 -0
  105. data/config/routes.rb +11 -0
  106. data/db/migrate/20140401203200_create_mechanize_store_freights.rb +12 -0
  107. data/db/migrate/20140401203246_create_mechanize_store_order_statuses.rb +9 -0
  108. data/db/migrate/20140402140318_create_mechanize_store_payment_statuses.rb +9 -0
  109. data/db/migrate/20140402140325_create_mechanize_store_payment_types.rb +9 -0
  110. data/db/migrate/20140402140539_create_mechanize_store_payments.rb +15 -0
  111. data/db/migrate/20140402140549_create_mechanize_store_flags.rb +9 -0
  112. data/db/migrate/20140402140832_create_mechanize_store_products.rb +16 -0
  113. data/db/migrate/20140402140942_create_mechanize_store_product_photos.rb +10 -0
  114. data/db/migrate/20140402153139_create_mechanize_store_orders.rb +11 -0
  115. data/db/migrate/20140402192058_create_mechanize_store_product_categories.rb +10 -0
  116. data/db/migrate/20140407193412_add_width_to_mechanize_store_product.rb +6 -0
  117. data/db/migrate/20140409191426_create_mechanize_store_order_items.rb +12 -0
  118. data/db/migrate/20140416123100_add_payment_type_id_to_payment.rb +6 -0
  119. data/db/migrate/20140417200520_add_time_to_freight.rb +5 -0
  120. data/lib/mechanize_store.rb +4 -0
  121. data/lib/mechanize_store/engine.rb +17 -0
  122. data/lib/mechanize_store/version.rb +3 -0
  123. data/lib/tasks/mechanize_store_tasks.rake +4 -0
  124. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  125. data/lib/templates/erb/scaffold/edit.html.erb +12 -0
  126. data/lib/templates/erb/scaffold/index.html.erb +50 -0
  127. data/lib/templates/erb/scaffold/new.html.erb +9 -0
  128. data/lib/templates/erb/scaffold/show.html.erb +17 -0
  129. data/lib/templates/rails/scaffold_controller/controller.rb +79 -0
  130. data/spec/controllers/mechanize_store/flags_controller_spec.rb +138 -0
  131. data/spec/controllers/mechanize_store/order_statuses_controller_spec.rb +138 -0
  132. data/spec/controllers/mechanize_store/orders_controller_spec.rb +29 -0
  133. data/spec/controllers/mechanize_store/payment_statuses_controller_spec.rb +139 -0
  134. data/spec/controllers/mechanize_store/payment_types_controller_spec.rb +139 -0
  135. data/spec/controllers/mechanize_store/product_categories_controller_spec.rb +138 -0
  136. data/spec/controllers/mechanize_store/product_photos_controller_spec.rb +75 -0
  137. data/spec/controllers/mechanize_store/products_controller_spec.rb +135 -0
  138. data/spec/dummy/README.rdoc +28 -0
  139. data/spec/dummy/Rakefile +6 -0
  140. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  141. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  142. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  143. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  144. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  145. data/spec/dummy/bin/bundle +3 -0
  146. data/spec/dummy/bin/rails +4 -0
  147. data/spec/dummy/bin/rake +4 -0
  148. data/spec/dummy/config.ru +4 -0
  149. data/spec/dummy/config/application.rb +25 -0
  150. data/spec/dummy/config/boot.rb +5 -0
  151. data/spec/dummy/config/database.yml +25 -0
  152. data/spec/dummy/config/environment.rb +5 -0
  153. data/spec/dummy/config/environments/development.rb +29 -0
  154. data/spec/dummy/config/environments/production.rb +80 -0
  155. data/spec/dummy/config/environments/test.rb +36 -0
  156. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  157. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  158. data/spec/dummy/config/initializers/inflections.rb +16 -0
  159. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  160. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  161. data/spec/dummy/config/initializers/session_store.rb +3 -0
  162. data/spec/dummy/config/initializers/simple_form.rb +145 -0
  163. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  164. data/spec/dummy/config/locales/en.yml +23 -0
  165. data/spec/dummy/config/locales/pt-BR.yml +23 -0
  166. data/spec/dummy/config/routes.rb +3 -0
  167. data/spec/dummy/db/development.sqlite3 +0 -0
  168. data/spec/dummy/db/migrate/20140407144119_create_mechanize_store_freights.mechanize_store.rb +13 -0
  169. data/spec/dummy/db/migrate/20140407144120_create_mechanize_store_order_statuses.mechanize_store.rb +10 -0
  170. data/spec/dummy/db/migrate/20140407144121_create_mechanize_store_payment_statuses.mechanize_store.rb +10 -0
  171. data/spec/dummy/db/migrate/20140407144122_create_mechanize_store_payment_types.mechanize_store.rb +10 -0
  172. data/spec/dummy/db/migrate/20140407144123_create_mechanize_store_payments.mechanize_store.rb +17 -0
  173. data/spec/dummy/db/migrate/20140407144124_create_mechanize_store_flags.mechanize_store.rb +10 -0
  174. data/spec/dummy/db/migrate/20140407144125_create_mechanize_store_products.mechanize_store.rb +17 -0
  175. data/spec/dummy/db/migrate/20140407144126_create_mechanize_store_product_photos.mechanize_store.rb +11 -0
  176. data/spec/dummy/db/migrate/20140407144127_create_mechanize_store_orders.mechanize_store.rb +12 -0
  177. data/spec/dummy/db/migrate/20140407144128_create_mechanize_store_product_categories.mechanize_store.rb +11 -0
  178. data/spec/dummy/db/migrate/20140407193949_add_width_to_mechanize_store_product.mechanize_store.rb +7 -0
  179. data/spec/dummy/db/migrate/20140409191457_create_mechanize_store_order_items.mechanize_store.rb +13 -0
  180. data/spec/dummy/db/schema.rb +125 -0
  181. data/spec/dummy/db/test.sqlite3 +0 -0
  182. data/spec/dummy/log/development.log +24931 -0
  183. data/spec/dummy/log/test.log +42225 -0
  184. data/spec/dummy/public/404.html +58 -0
  185. data/spec/dummy/public/422.html +58 -0
  186. data/spec/dummy/public/500.html +57 -0
  187. data/spec/dummy/public/favicon.ico +0 -0
  188. data/spec/dummy/tmp/cache/assets/development/sprockets/015a50b3ac7ad70aa90ce0a95c99df04 +0 -0
  189. data/spec/dummy/tmp/cache/assets/development/sprockets/020540bcd9f6782692071f17f50f43b0 +0 -0
  190. data/spec/dummy/tmp/cache/assets/development/sprockets/0378e5799bf84efc4c9b8ac61252a081 +0 -0
  191. data/spec/dummy/tmp/cache/assets/development/sprockets/04032662bf2ebfb00b4218e459ab14bf +0 -0
  192. data/spec/dummy/tmp/cache/assets/development/sprockets/043663643ec7f44e8f7baeb7856605bb +0 -0
  193. data/spec/dummy/tmp/cache/assets/development/sprockets/059883583379e5e373caaa73ac8f18ca +0 -0
  194. data/spec/dummy/tmp/cache/assets/development/sprockets/05f7ba95ff1ffeab9cb378fcb7b0289f +0 -0
  195. data/spec/dummy/tmp/cache/assets/development/sprockets/069b62a9f82e145a95c6dbcada54860d +0 -0
  196. data/spec/dummy/tmp/cache/assets/development/sprockets/06ce3d4f3b99f90fa0ced1db38c5fb13 +0 -0
  197. data/spec/dummy/tmp/cache/assets/development/sprockets/0a70c895b23487214ec56a6cd4bd9552 +0 -0
  198. data/spec/dummy/tmp/cache/assets/development/sprockets/0e42ab04670f4d8017b5eeb5ec7f080b +0 -0
  199. data/spec/dummy/tmp/cache/assets/development/sprockets/0f2edd5bf10b0d769d20d28769abf705 +0 -0
  200. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  201. data/spec/dummy/tmp/cache/assets/development/sprockets/14464296f672d2910982229137d66535 +0 -0
  202. data/spec/dummy/tmp/cache/assets/development/sprockets/19456f04c83f78d9ab6e5d57031015ef +0 -0
  203. data/spec/dummy/tmp/cache/assets/development/sprockets/1a5faaf1e18d5f49d129459ae565f1af +0 -0
  204. data/spec/dummy/tmp/cache/assets/development/sprockets/1a78a9c2facea31464f84e54fdc36059 +0 -0
  205. data/spec/dummy/tmp/cache/assets/development/sprockets/1da2c163f7f6bbd029786010cd788bce +0 -0
  206. data/spec/dummy/tmp/cache/assets/development/sprockets/250ad25722c066145272032ad82f4561 +0 -0
  207. data/spec/dummy/tmp/cache/assets/development/sprockets/2593c6406f0e0ba8eb5271badc1fbef1 +0 -0
  208. data/spec/dummy/tmp/cache/assets/development/sprockets/262f77e6bb6c8e1453f5477c82a17b11 +0 -0
  209. data/spec/dummy/tmp/cache/assets/development/sprockets/27479abec405e7ea5ee309699b19c495 +0 -0
  210. data/spec/dummy/tmp/cache/assets/development/sprockets/2b16e3dfbce9d1bb0de91f424f03694a +0 -0
  211. data/spec/dummy/tmp/cache/assets/development/sprockets/2b89581781ce2529d6435ae4a831dcb9 +0 -0
  212. data/spec/dummy/tmp/cache/assets/development/sprockets/2c8d436d977e56045cd16cc55f33e24f +0 -0
  213. data/spec/dummy/tmp/cache/assets/development/sprockets/2d8950ff6bb73413e9deb6e196bfffd0 +0 -0
  214. data/spec/dummy/tmp/cache/assets/development/sprockets/2dc34152e91278da6990e448dccf297a +0 -0
  215. data/spec/dummy/tmp/cache/assets/development/sprockets/2e2c50f356deda30cee516e501b1eb70 +0 -0
  216. data/spec/dummy/tmp/cache/assets/development/sprockets/2ee1b9592bbe1ba628925e28b31fdc2a +0 -0
  217. data/spec/dummy/tmp/cache/assets/development/sprockets/2f378010bb54f8ca9c2a38c7df245b26 +0 -0
  218. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  219. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  220. data/spec/dummy/tmp/cache/assets/development/sprockets/38aa872dea852cc952801236dfc073fc +0 -0
  221. data/spec/dummy/tmp/cache/assets/development/sprockets/3c562eb64c2c0fc045f18356d3ddd84e +0 -0
  222. data/spec/dummy/tmp/cache/assets/development/sprockets/3daa6dd7a3804d55f1896a2d40ccea5f +0 -0
  223. data/spec/dummy/tmp/cache/assets/development/sprockets/436e4923cef6508f9572309894ad3afb +0 -0
  224. data/spec/dummy/tmp/cache/assets/development/sprockets/43db98f3f4043e28dd241d4bcf40a382 +0 -0
  225. data/spec/dummy/tmp/cache/assets/development/sprockets/4517526bf21c2e0d4475812a0801ff73 +0 -0
  226. data/spec/dummy/tmp/cache/assets/development/sprockets/45e8f86d32c088635371e9d83d481ff0 +0 -0
  227. data/spec/dummy/tmp/cache/assets/development/sprockets/46c7525f809be6b9a6da46ec5281b90d +0 -0
  228. data/spec/dummy/tmp/cache/assets/development/sprockets/48710380827190cf4c297aeb8ff8f521 +0 -0
  229. data/spec/dummy/tmp/cache/assets/development/sprockets/48c25b92a4e1841bd519a77588afb5df +0 -0
  230. data/spec/dummy/tmp/cache/assets/development/sprockets/4b3b499b73fde3f086615d203a4cd9ee +0 -0
  231. data/spec/dummy/tmp/cache/assets/development/sprockets/4c1f9a5156d1c8724067d833a65dc486 +0 -0
  232. data/spec/dummy/tmp/cache/assets/development/sprockets/4e1d544283e15d5f8e7575f717a440a4 +0 -0
  233. data/spec/dummy/tmp/cache/assets/development/sprockets/54843f9a3a2ac75ad7ebde3307ce8606 +0 -0
  234. data/spec/dummy/tmp/cache/assets/development/sprockets/55116814eac2aaa3b60343e4269a18f9 +0 -0
  235. data/spec/dummy/tmp/cache/assets/development/sprockets/55d45208b6b824293fd70642ec435749 +0 -0
  236. data/spec/dummy/tmp/cache/assets/development/sprockets/593ece65492f611f990932db9d09f2c7 +0 -0
  237. data/spec/dummy/tmp/cache/assets/development/sprockets/59bb66920183998fcca5f2c787d0180e +0 -0
  238. data/spec/dummy/tmp/cache/assets/development/sprockets/5c19a1c0836acd88cf90128587c8a9f2 +0 -0
  239. data/spec/dummy/tmp/cache/assets/development/sprockets/5cbd47d1e56ce6ad12324dc100b18435 +0 -0
  240. data/spec/dummy/tmp/cache/assets/development/sprockets/5dd2138848e347d174c374d012420ae3 +0 -0
  241. data/spec/dummy/tmp/cache/assets/development/sprockets/5e2b19c7c137f093e3a17e2eed13b00e +0 -0
  242. data/spec/dummy/tmp/cache/assets/development/sprockets/5f29f414f1d3e6a4c8eacd4974e20369 +0 -0
  243. data/spec/dummy/tmp/cache/assets/development/sprockets/5fc8e81b247da7b93af8a2eb06017a5e +0 -0
  244. data/spec/dummy/tmp/cache/assets/development/sprockets/646c6b9465381d825591b427e65cfa6f +0 -0
  245. data/spec/dummy/tmp/cache/assets/development/sprockets/6554b2d6606c5f90f91a8a1f01ee5207 +0 -0
  246. data/spec/dummy/tmp/cache/assets/development/sprockets/662f5fc7888fcf74ff719aea443f1e0e +0 -0
  247. data/spec/dummy/tmp/cache/assets/development/sprockets/66c3c3a1daf01d2edc14fb56645814af +0 -0
  248. data/spec/dummy/tmp/cache/assets/development/sprockets/69f57e81929c085cfd164a7b30f9cb5f +0 -0
  249. data/spec/dummy/tmp/cache/assets/development/sprockets/6a7af764897e94acc0adc4f6855846ea +0 -0
  250. data/spec/dummy/tmp/cache/assets/development/sprockets/6ddd5e3587977e83d7dc7b7124cc4044 +0 -0
  251. data/spec/dummy/tmp/cache/assets/development/sprockets/70894d30d9a638ae5cb410c1bf51d436 +0 -0
  252. data/spec/dummy/tmp/cache/assets/development/sprockets/746b6834bc4167c8495578a1b7b05cd2 +0 -0
  253. data/spec/dummy/tmp/cache/assets/development/sprockets/748419e05355441fbf8b5177841a01ae +0 -0
  254. data/spec/dummy/tmp/cache/assets/development/sprockets/75b6e2b76634cd778e12a60b8862cc83 +0 -0
  255. data/spec/dummy/tmp/cache/assets/development/sprockets/75e995d7f41c3d87054f39654ee96276 +0 -0
  256. data/spec/dummy/tmp/cache/assets/development/sprockets/7a6ffbc3e76322931e50faa267bf2ccd +0 -0
  257. data/spec/dummy/tmp/cache/assets/development/sprockets/7dbc97a9be7f04dc0f5cb28337fe9f4c +0 -0
  258. data/spec/dummy/tmp/cache/assets/development/sprockets/7e908a7a32793f07298fa2f32f7a1da6 +0 -0
  259. data/spec/dummy/tmp/cache/assets/development/sprockets/80137a3a1ee5336154baaea4290aa0fa +0 -0
  260. data/spec/dummy/tmp/cache/assets/development/sprockets/80a4a7e08ffe3c1b0ad632a9f69dae61 +0 -0
  261. data/spec/dummy/tmp/cache/assets/development/sprockets/875373523edad14b9efdc32d30056b88 +0 -0
  262. data/spec/dummy/tmp/cache/assets/development/sprockets/8b2a3bdfdd87982dbcdf9beaa4883771 +0 -0
  263. data/spec/dummy/tmp/cache/assets/development/sprockets/8c29fc18ccf7320aa1f9d9fbc277adbc +0 -0
  264. data/spec/dummy/tmp/cache/assets/development/sprockets/8c48b01bb6fe5d3f87c3e2d8796bfe57 +0 -0
  265. data/spec/dummy/tmp/cache/assets/development/sprockets/8c880b8aef8a9168cf039ff966dde072 +0 -0
  266. data/spec/dummy/tmp/cache/assets/development/sprockets/8e1041b3a7abe8f1431f078dd04e52f2 +0 -0
  267. data/spec/dummy/tmp/cache/assets/development/sprockets/8e1509b014a325c41eb6d6d060697d5b +0 -0
  268. data/spec/dummy/tmp/cache/assets/development/sprockets/9295c97f3680de471db1138760883721 +0 -0
  269. data/spec/dummy/tmp/cache/assets/development/sprockets/932ff26d70c7f83db540941e70fbc256 +0 -0
  270. data/spec/dummy/tmp/cache/assets/development/sprockets/95d1184dee9d6ad8efbb18992ef7f3bd +0 -0
  271. data/spec/dummy/tmp/cache/assets/development/sprockets/9a57b3781439b98aa17111614be63659 +0 -0
  272. data/spec/dummy/tmp/cache/assets/development/sprockets/9a958d65f5d84cf81a860fe6b98f7586 +0 -0
  273. data/spec/dummy/tmp/cache/assets/development/sprockets/9ba78083ca4f55d2e3dbb4c16f5108a4 +0 -0
  274. data/spec/dummy/tmp/cache/assets/development/sprockets/9bf7f52d56b17c5fcacc89e0196ec9ec +0 -0
  275. data/spec/dummy/tmp/cache/assets/development/sprockets/9dcc41c3f740c89aa23972f9f0fb7682 +0 -0
  276. data/spec/dummy/tmp/cache/assets/development/sprockets/9dd69825bb5d22668e78fcadbcc384bf +0 -0
  277. data/spec/dummy/tmp/cache/assets/development/sprockets/9f7694dc7aa37365dca45aa754f46e75 +0 -0
  278. data/spec/dummy/tmp/cache/assets/development/sprockets/a119b32f75ff105e311edc0f31ca67f6 +0 -0
  279. data/spec/dummy/tmp/cache/assets/development/sprockets/a388745aef9974ea0f378a3b83f6f8e7 +0 -0
  280. data/spec/dummy/tmp/cache/assets/development/sprockets/a80b32eb0130473db70817a2464be54a +0 -0
  281. data/spec/dummy/tmp/cache/assets/development/sprockets/a97cfb7a9ba4204c2c02cb794e0b529e +0 -0
  282. data/spec/dummy/tmp/cache/assets/development/sprockets/a9d026eb5dcf44bbad77067be7ccc216 +0 -0
  283. data/spec/dummy/tmp/cache/assets/development/sprockets/ac2422a2e7c30bbcf41620f5eadf6c9a +0 -0
  284. data/spec/dummy/tmp/cache/assets/development/sprockets/aca81e68e9477c36988579e16d099f7a +0 -0
  285. data/spec/dummy/tmp/cache/assets/development/sprockets/ad821e6998f57556c2bbebeac574bbd3 +0 -0
  286. data/spec/dummy/tmp/cache/assets/development/sprockets/adc26899d70ead5b9321d6b6be5cb73a +0 -0
  287. data/spec/dummy/tmp/cache/assets/development/sprockets/ae2d91de359a9f7f39d93f379705b07c +0 -0
  288. data/spec/dummy/tmp/cache/assets/development/sprockets/b1909373f0eb96fc7eb1a16b13cf9d9c +0 -0
  289. data/spec/dummy/tmp/cache/assets/development/sprockets/b2d360ac92a3862e54a81752fac14f04 +0 -0
  290. data/spec/dummy/tmp/cache/assets/development/sprockets/b32edcdd838f74e3b0b694bb4fb78135 +0 -0
  291. data/spec/dummy/tmp/cache/assets/development/sprockets/b80b1d0da5126d78830d5cc9d33bb939 +0 -0
  292. data/spec/dummy/tmp/cache/assets/development/sprockets/b80ff122a6e6cb26a8726574c9ed9843 +0 -0
  293. data/spec/dummy/tmp/cache/assets/development/sprockets/b8788a2d9cd7867f9732a0d1218b3be3 +0 -0
  294. data/spec/dummy/tmp/cache/assets/development/sprockets/c01c09c7af2805825d421efe97369c92 +0 -0
  295. data/spec/dummy/tmp/cache/assets/development/sprockets/c096a28eb3fb4f6a5943814c1d83de28 +0 -0
  296. data/spec/dummy/tmp/cache/assets/development/sprockets/c1c5e3bf6b463ce593f544553cd61880 +0 -0
  297. data/spec/dummy/tmp/cache/assets/development/sprockets/c206d760825f5d60935bc162372aae5f +0 -0
  298. data/spec/dummy/tmp/cache/assets/development/sprockets/c276778eb885b31ac5c72899422f687b +0 -0
  299. data/spec/dummy/tmp/cache/assets/development/sprockets/c381ab6aead4f08abb9b7da1fd2c5cbe +0 -0
  300. data/spec/dummy/tmp/cache/assets/development/sprockets/c3fae7c3a4d1eb0934a03e3508994894 +0 -0
  301. data/spec/dummy/tmp/cache/assets/development/sprockets/c532dcbd254ee5454d453f8dca2ea356 +0 -0
  302. data/spec/dummy/tmp/cache/assets/development/sprockets/c5febc1300d6cd4c2f85a5dcc4ccca65 +0 -0
  303. data/spec/dummy/tmp/cache/assets/development/sprockets/c6337ac9ac53de67c5e4e0bbd8e0b98f +0 -0
  304. data/spec/dummy/tmp/cache/assets/development/sprockets/c63f6f599121de54f10407499bdeb95d +0 -0
  305. data/spec/dummy/tmp/cache/assets/development/sprockets/c6ccf7b3128d1693a850e8014129e21b +0 -0
  306. data/spec/dummy/tmp/cache/assets/development/sprockets/c884f6ae49a257a9b8218d60cddc22c1 +0 -0
  307. data/spec/dummy/tmp/cache/assets/development/sprockets/c9053dba65ec180c37b513c1e0a02953 +0 -0
  308. data/spec/dummy/tmp/cache/assets/development/sprockets/c9274eaf6338c910a014211f057bb10f +0 -0
  309. data/spec/dummy/tmp/cache/assets/development/sprockets/c9b7bfc895f9ef763149e886eed1c12a +0 -0
  310. data/spec/dummy/tmp/cache/assets/development/sprockets/ca5d6127a6b6cb20b3137c6ed1b086e4 +0 -0
  311. data/spec/dummy/tmp/cache/assets/development/sprockets/ca68d3d42cc489b72f5a9caa1bec8a0f +0 -0
  312. data/spec/dummy/tmp/cache/assets/development/sprockets/cbb3bbaeb5cbb28714fc2d854e55d759 +0 -0
  313. data/spec/dummy/tmp/cache/assets/development/sprockets/cbc8f4f72d68f84e285b14c13c615e94 +0 -0
  314. data/spec/dummy/tmp/cache/assets/development/sprockets/cbf5cac128a3b9fd8567cf02d8b5c7f4 +0 -0
  315. data/spec/dummy/tmp/cache/assets/development/sprockets/cf62df2949741a6dfcbdf6dae39a376e +0 -0
  316. data/spec/dummy/tmp/cache/assets/development/sprockets/cfe2122c3660d4bf29e621b13cc1e4c0 +0 -0
  317. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  318. data/spec/dummy/tmp/cache/assets/development/sprockets/d1ebcb314c13703007e0a6e9c5604655 +0 -0
  319. data/spec/dummy/tmp/cache/assets/development/sprockets/d4db7fd1c1ad160335e9abc86e49a138 +0 -0
  320. data/spec/dummy/tmp/cache/assets/development/sprockets/d5a9b12dc73b0e530314f93a2e7d4270 +0 -0
  321. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  322. data/spec/dummy/tmp/cache/assets/development/sprockets/d84c8af9dd2dd84ac27282b753d2b33c +0 -0
  323. data/spec/dummy/tmp/cache/assets/development/sprockets/d86a26ce11fa0095e076b69ecd98fbf6 +0 -0
  324. data/spec/dummy/tmp/cache/assets/development/sprockets/dba3e0db21349797be91d79366b2e6d9 +0 -0
  325. data/spec/dummy/tmp/cache/assets/development/sprockets/dcfc0ac1daceac33f1f1d348341a8c75 +0 -0
  326. data/spec/dummy/tmp/cache/assets/development/sprockets/dd149c63c658dcacd022a8bbd0136c9f +0 -0
  327. data/spec/dummy/tmp/cache/assets/development/sprockets/de287cf9a2ea50ebc178bcc7cd8e0f4c +0 -0
  328. data/spec/dummy/tmp/cache/assets/development/sprockets/de35fa3c2360ca5a0479c6ec6c8c0d62 +0 -0
  329. data/spec/dummy/tmp/cache/assets/development/sprockets/dfc074e83f62650815ec91d5e6ae716a +0 -0
  330. data/spec/dummy/tmp/cache/assets/development/sprockets/e4806a3aea27283bdce20bcb1cc894a6 +0 -0
  331. data/spec/dummy/tmp/cache/assets/development/sprockets/e9075a2c21b7e2c0543aceff4975485a +0 -0
  332. data/spec/dummy/tmp/cache/assets/development/sprockets/e9c2ccf818891a7575ec2200367bbf52 +0 -0
  333. data/spec/dummy/tmp/cache/assets/development/sprockets/eb3496f8d86eed2469155f90f146a7bd +0 -0
  334. data/spec/dummy/tmp/cache/assets/development/sprockets/ec5d87f50983b6156db79eb4c4b0ae6d +0 -0
  335. data/spec/dummy/tmp/cache/assets/development/sprockets/f0bb04309f0742e927d269899c6b9a4a +0 -0
  336. data/spec/dummy/tmp/cache/assets/development/sprockets/f0fdb965c01e31547d9058c609918712 +0 -0
  337. data/spec/dummy/tmp/cache/assets/development/sprockets/f2de92b01852702a49c9e9e5cd3b320f +0 -0
  338. data/spec/dummy/tmp/cache/assets/development/sprockets/f478e4dc1bdfe5240e3ca48440488e32 +0 -0
  339. data/spec/dummy/tmp/cache/assets/development/sprockets/f51cc05ee2ec6ed667257568e527f522 +0 -0
  340. data/spec/dummy/tmp/cache/assets/development/sprockets/f535bdc9ad7f7f6ce6009b846c2fc2d7 +0 -0
  341. data/spec/dummy/tmp/cache/assets/development/sprockets/f61f3d9d282d0c092d604b8433071c77 +0 -0
  342. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  343. data/spec/dummy/tmp/cache/assets/development/sprockets/f97dc728e6d15fb7ba9f14ad2b8b6bcb +0 -0
  344. data/spec/dummy/tmp/cache/assets/development/sprockets/faeec0db256cfb91ad104e66a9453bd9 +0 -0
  345. data/spec/dummy/tmp/cache/assets/development/sprockets/fbbf6a435d522871a2d29d97e370bfce +0 -0
  346. data/spec/dummy/tmp/cache/assets/development/sprockets/ffbf6316da17c85bd6bda4bdb1961baf +0 -0
  347. data/spec/factories/mechanize_store_order_items.rb +10 -0
  348. data/spec/factories/mechanize_store_products.rb +14 -0
  349. data/spec/factories/store_flags.rb +7 -0
  350. data/spec/factories/store_freights.rb +10 -0
  351. data/spec/factories/store_order_statuses.rb +7 -0
  352. data/spec/factories/store_orders.rb +8 -0
  353. data/spec/factories/store_payment_statuses.rb +7 -0
  354. data/spec/factories/store_payment_types.rb +7 -0
  355. data/spec/factories/store_payments.rb +14 -0
  356. data/spec/factories/store_product_categories.rb +8 -0
  357. data/spec/factories/store_product_photos.rb +8 -0
  358. data/spec/factories/store_stores.rb +10 -0
  359. data/spec/features/orders_flow_spec.rb +0 -0
  360. data/spec/features/products_flow_test.rb +68 -0
  361. data/spec/fixtures/rails.png +0 -0
  362. data/spec/models/mechanize_store/order_item_spec.rb +7 -0
  363. data/spec/models/store/flag_spec.rb +7 -0
  364. data/spec/models/store/freight_spec.rb +7 -0
  365. data/spec/models/store/order_spec.rb +7 -0
  366. data/spec/models/store/order_status_spec.rb +7 -0
  367. data/spec/models/store/payment_spec.rb +7 -0
  368. data/spec/models/store/payment_status_spec.rb +7 -0
  369. data/spec/models/store/payment_type_spec.rb +7 -0
  370. data/spec/models/store/product_category_spec.rb +7 -0
  371. data/spec/models/store/product_photo_spec.rb +7 -0
  372. data/spec/models/store/product_spec.rb +7 -0
  373. data/spec/models/store/store_spec.rb +7 -0
  374. data/spec/routing/store/flags_routing_spec.rb +39 -0
  375. data/spec/routing/store/order_statuses_routing_spec.rb +39 -0
  376. data/spec/routing/store/orders_routing_spec.rb +18 -0
  377. data/spec/routing/store/payment_statuses_routing_spec.rb +38 -0
  378. data/spec/routing/store/payment_types_routing_spec.rb +38 -0
  379. data/spec/routing/store/product_categories_routing_spec.rb +39 -0
  380. data/spec/routing/store/products_photos_routing_spec.rb +19 -0
  381. data/spec/routing/store/products_routing_spec.rb +39 -0
  382. data/spec/spec_helper.rb +22 -0
  383. metadata +876 -0
@@ -0,0 +1 @@
1
+ !function(a){"use strict";var b=function(a,c,d){var e,f,g=document.createElement("img");if(g.onerror=c,g.onload=function(){!f||d&&d.noRevoke||b.revokeObjectURL(f),c&&c(b.scale(g,d))},b.isInstanceOf("Blob",a)||b.isInstanceOf("File",a))e=f=b.createObjectURL(a),g._type=a.type;else{if("string"!=typeof a)return!1;e=a,d&&d.crossOrigin&&(g.crossOrigin=d.crossOrigin)}return e?(g.src=e,g):b.readFile(a,function(a){var b=a.target;b&&b.result?g.src=b.result:c&&c(a)})},c=window.createObjectURL&&window||window.URL&&URL.revokeObjectURL&&URL||window.webkitURL&&webkitURL;b.isInstanceOf=function(a,b){return Object.prototype.toString.call(b)==="[object "+a+"]"},b.transformCoordinates=function(){},b.getTransformedOptions=function(a){return a},b.renderImageToCanvas=function(a,b,c,d,e,f,g,h,i,j){return a.getContext("2d").drawImage(b,c,d,e,f,g,h,i,j),a},b.hasCanvasOption=function(a){return a.canvas||a.crop},b.scale=function(a,c){c=c||{};var d,e,f,g,h,i,j,k,l,m=document.createElement("canvas"),n=a.getContext||b.hasCanvasOption(c)&&m.getContext,o=a.naturalWidth||a.width,p=a.naturalHeight||a.height,q=o,r=p,s=function(){var a=Math.max((f||q)/q,(g||r)/r);a>1&&(q=Math.ceil(q*a),r=Math.ceil(r*a))},t=function(){var a=Math.min((d||q)/q,(e||r)/r);1>a&&(q=Math.ceil(q*a),r=Math.ceil(r*a))};return n&&(c=b.getTransformedOptions(c),j=c.left||0,k=c.top||0,c.sourceWidth?(h=c.sourceWidth,void 0!==c.right&&void 0===c.left&&(j=o-h-c.right)):h=o-j-(c.right||0),c.sourceHeight?(i=c.sourceHeight,void 0!==c.bottom&&void 0===c.top&&(k=p-i-c.bottom)):i=p-k-(c.bottom||0),q=h,r=i),d=c.maxWidth,e=c.maxHeight,f=c.minWidth,g=c.minHeight,n&&d&&e&&c.crop?(q=d,r=e,l=h/i-d/e,0>l?(i=e*h/d,void 0===c.top&&void 0===c.bottom&&(k=(p-i)/2)):l>0&&(h=d*i/e,void 0===c.left&&void 0===c.right&&(j=(o-h)/2))):((c.contain||c.cover)&&(f=d=d||f,g=e=e||g),c.cover?(t(),s()):(s(),t())),n?(m.width=q,m.height=r,b.transformCoordinates(m,c),b.renderImageToCanvas(m,a,j,k,h,i,0,0,q,r)):(a.width=q,a.height=r,a)},b.createObjectURL=function(a){return c?c.createObjectURL(a):!1},b.revokeObjectURL=function(a){return c?c.revokeObjectURL(a):!1},b.readFile=function(a,b,c){if(window.FileReader){var d=new FileReader;if(d.onload=d.onerror=b,c=c||"readAsDataURL",d[c])return d[c](a),d}return!1},"function"==typeof define&&define.amd?define(function(){return b}):a.loadImage=b}(this),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image"],a):a(window.loadImage)}(function(a){"use strict";if(window.navigator&&window.navigator.platform&&/iP(hone|od|ad)/.test(window.navigator.platform)){var b=a.renderImageToCanvas;a.detectSubsampling=function(a){var b,c;return a.width*a.height>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-a.width+1,0),0===c.getImageData(0,0,1,1).data[3]):!1},a.detectVerticalSquash=function(a,b){var c,d,e,f,g,h=a.naturalHeight||a.height,i=document.createElement("canvas"),j=i.getContext("2d");for(b&&(h/=2),i.width=1,i.height=h,j.drawImage(a,0,0),c=j.getImageData(0,0,1,h).data,d=0,e=h,f=h;f>d;)g=c[4*(f-1)+3],0===g?e=f:d=f,f=e+d>>1;return f/h||1},a.renderImageToCanvas=function(c,d,e,f,g,h,i,j,k,l){if("image/jpeg"===d._type){var m,n,o,p,q=c.getContext("2d"),r=document.createElement("canvas"),s=1024,t=r.getContext("2d");if(r.width=s,r.height=s,q.save(),m=a.detectSubsampling(d),m&&(e/=2,f/=2,g/=2,h/=2),n=a.detectVerticalSquash(d,m),m||1!==n){for(f*=n,k=Math.ceil(s*k/g),l=Math.ceil(s*l/h/n),j=0,p=0;h>p;){for(i=0,o=0;g>o;)t.clearRect(0,0,s,s),t.drawImage(d,e,f,g,h,-o,-p,g,h),q.drawImage(r,0,0,s,s,i,j,k,l),o+=s,i+=k;p+=s,j+=l}return q.restore(),c}}return b(c,d,e,f,g,h,i,j,k,l)}}}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image"],a):a(window.loadImage)}(function(a){"use strict";var b=a.hasCanvasOption;a.hasCanvasOption=function(a){return b(a)||a.orientation},a.transformCoordinates=function(a,b){var c=a.getContext("2d"),d=a.width,e=a.height,f=b.orientation;if(f)switch(f>4&&(a.width=e,a.height=d),f){case 2:c.translate(d,0),c.scale(-1,1);break;case 3:c.translate(d,e),c.rotate(Math.PI);break;case 4:c.translate(0,e),c.scale(1,-1);break;case 5:c.rotate(.5*Math.PI),c.scale(1,-1);break;case 6:c.rotate(.5*Math.PI),c.translate(0,-e);break;case 7:c.rotate(.5*Math.PI),c.translate(d,-e),c.scale(-1,1);break;case 8:c.rotate(-.5*Math.PI),c.translate(-d,0)}},a.getTransformedOptions=function(a){if(!a.orientation||1===a.orientation)return a;var b,c={};for(b in a)a.hasOwnProperty(b)&&(c[b]=a[b]);switch(a.orientation){case 2:c.left=a.right,c.right=a.left;break;case 3:c.left=a.right,c.top=a.bottom,c.right=a.left,c.bottom=a.top;break;case 4:c.top=a.bottom,c.bottom=a.top;break;case 5:c.left=a.top,c.top=a.left,c.right=a.bottom,c.bottom=a.right;break;case 6:c.left=a.top,c.top=a.right,c.right=a.bottom,c.bottom=a.left;break;case 7:c.left=a.bottom,c.top=a.right,c.right=a.top,c.bottom=a.left;break;case 8:c.left=a.bottom,c.top=a.left,c.right=a.top,c.bottom=a.right}return a.orientation>4&&(c.maxWidth=a.maxHeight,c.maxHeight=a.maxWidth,c.minWidth=a.minHeight,c.minHeight=a.minWidth,c.sourceWidth=a.sourceHeight,c.sourceHeight=a.sourceWidth),c}}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image"],a):a(window.loadImage)}(function(a){"use strict";var b=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);a.blobSlice=b&&function(){var a=this.slice||this.webkitSlice||this.mozSlice;return a.apply(this,arguments)},a.metaDataParsers={jpeg:{65505:[]}},a.parseMetaData=function(b,c,d){d=d||{};var e=this,f=d.maxMetaDataSize||262144,g={},h=!(window.DataView&&b&&b.size>=12&&"image/jpeg"===b.type&&a.blobSlice);(h||!a.readFile(a.blobSlice.call(b,0,f),function(b){if(b.target.error)return console.log(b.target.error),c(g),void 0;var f,h,i,j,k=b.target.result,l=new DataView(k),m=2,n=l.byteLength-4,o=m;if(65496===l.getUint16(0)){for(;n>m&&(f=l.getUint16(m),f>=65504&&65519>=f||65534===f);){if(h=l.getUint16(m+2)+2,m+h>l.byteLength){console.log("Invalid meta data: Invalid segment size.");break}if(i=a.metaDataParsers.jpeg[f])for(j=0;j<i.length;j+=1)i[j].call(e,l,m,h,g,d);m+=h,o=m}!d.disableImageHead&&o>6&&(g.imageHead=k.slice?k.slice(0,o):new Uint8Array(k).subarray(0,o))}else console.log("Invalid JPEG file: Missing JPEG marker.");c(g)},"readAsArrayBuffer"))&&c(g)}}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image","load-image-meta"],a):a(window.loadImage)}(function(a){"use strict";a.ExifMap=function(){return this},a.ExifMap.prototype.map={Orientation:274},a.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},a.getExifThumbnail=function(a,b,c){var d,e,f;if(!c||b+c>a.byteLength)return console.log("Invalid Exif data: Invalid thumbnail data."),void 0;for(d=[],e=0;c>e;e+=1)f=a.getUint8(b+e),d.push((16>f?"0":"")+f.toString(16));return"data:image/jpeg,%"+d.join("%")},a.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},a.exifTagTypes[7]=a.exifTagTypes[1],a.getExifValue=function(b,c,d,e,f,g){var h,i,j,k,l,m,n=a.exifTagTypes[e];if(!n)return console.log("Invalid Exif data: Invalid tag type."),void 0;if(h=n.size*f,i=h>4?c+b.getUint32(d+8,g):d+8,i+h>b.byteLength)return console.log("Invalid Exif data: Invalid data offset."),void 0;if(1===f)return n.getValue(b,i,g);for(j=[],k=0;f>k;k+=1)j[k]=n.getValue(b,i+k*n.size,g);if(n.ascii){for(l="",k=0;k<j.length&&(m=j[k],"\x00"!==m);k+=1)l+=m;return l}return j},a.parseExifTag=function(b,c,d,e,f){var g=b.getUint16(d,e);f.exif[g]=a.getExifValue(b,c,d,b.getUint16(d+2,e),b.getUint32(d+4,e),e)},a.parseExifTags=function(a,b,c,d,e){var f,g,h;if(c+6>a.byteLength)return console.log("Invalid Exif data: Invalid directory offset."),void 0;if(f=a.getUint16(c,d),g=c+2+12*f,g+4>a.byteLength)return console.log("Invalid Exif data: Invalid directory size."),void 0;for(h=0;f>h;h+=1)this.parseExifTag(a,b,c+2+12*h,d,e);return a.getUint32(g,d)},a.parseExifData=function(b,c,d,e,f){if(!f.disableExif){var g,h,i,j=c+10;if(1165519206===b.getUint32(c+4)){if(j+8>b.byteLength)return console.log("Invalid Exif data: Invalid segment size."),void 0;if(0!==b.getUint16(c+8))return console.log("Invalid Exif data: Missing byte alignment offset."),void 0;switch(b.getUint16(j)){case 18761:g=!0;break;case 19789:g=!1;break;default:return console.log("Invalid Exif data: Invalid byte alignment marker."),void 0}if(42!==b.getUint16(j+2,g))return console.log("Invalid Exif data: Missing TIFF marker."),void 0;h=b.getUint32(j+4,g),e.exif=new a.ExifMap,h=a.parseExifTags(b,j,j+h,g,e),h&&!f.disableExifThumbnail&&(i={exif:{}},h=a.parseExifTags(b,j,j+h,g,i),i.exif[513]&&(e.exif.Thumbnail=a.getExifThumbnail(b,j+i.exif[513],i.exif[514]))),e.exif[34665]&&!f.disableExifSub&&a.parseExifTags(b,j,j+e.exif[34665],g,e),e.exif[34853]&&!f.disableExifGps&&a.parseExifTags(b,j,j+e.exif[34853],g,e)}}},a.metaDataParsers.jpeg[65505].push(a.parseExifData)}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image","load-image-exif"],a):a(window.loadImage)}(function(a){"use strict";a.ExifMap.prototype.tags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright",36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",42240:"Gamma",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"PhotographicSensitivity",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},a.ExifMap.prototype.stringValues={ExposureProgram:{0:"Undefined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Undefined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},ComponentsConfiguration:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"},Orientation:{1:"top-left",2:"top-right",3:"bottom-right",4:"bottom-left",5:"left-top",6:"right-top",7:"right-bottom",8:"left-bottom"}},a.ExifMap.prototype.getText=function(a){var b=this.get(a);switch(a){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":case"Orientation":return this.stringValues[a][b];case"ExifVersion":case"FlashpixVersion":return String.fromCharCode(b[0],b[1],b[2],b[3]);case"ComponentsConfiguration":return this.stringValues[a][b[0]]+this.stringValues[a][b[1]]+this.stringValues[a][b[2]]+this.stringValues[a][b[3]];case"GPSVersionID":return b[0]+"."+b[1]+"."+b[2]+"."+b[3]}return String(b)},function(a){var b,c=a.tags,d=a.map;for(b in c)c.hasOwnProperty(b)&&(d[c[b]]=b)}(a.ExifMap.prototype),a.ExifMap.prototype.getAll=function(){var a,b,c={};for(a in this)this.hasOwnProperty(a)&&(b=this.tags[a],b&&(c[b]=this.getText(b)));return c}});
@@ -0,0 +1,14 @@
1
+ //= require mechanize_store/sb-admin/jquery-file-upload/jquery.ui.widget
2
+ //= require mechanize_store/sb-admin/jquery-file-upload/tmpl.min
3
+ //= require mechanize_store/sb-admin/jquery-file-upload/load-image.min
4
+ //= require mechanize_store/sb-admin/jquery-file-upload/canvas-to-blob.min
5
+ //= require mechanize_store/sb-admin/jquery-file-upload/jquery.blueimp-gallery.min
6
+ //= require mechanize_store/sb-admin/jquery-file-upload/jquery.iframe-transport
7
+ //= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload
8
+ //= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-process
9
+ //= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-image
10
+ //= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-audio
11
+ //= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-video
12
+ //= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-validate
13
+ //= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-ui
14
+
@@ -0,0 +1 @@
1
+ !function(a){"use strict";var b=function(a,c){var d=/[^\w\-\.:]/.test(a)?new Function(b.arg+",tmpl","var _e=tmpl.encode"+b.helper+",_s='"+a.replace(b.regexp,b.func)+"';return _s;"):b.cache[a]=b.cache[a]||b(b.load(a));return c?d(c,b):function(a){return d(a,b)}};b.cache={},b.load=function(a){return document.getElementById(a).innerHTML},b.regexp=/([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g,b.func=function(a,b,c,d,e,f){return b?{"\n":"\\n","\r":"\\r"," ":"\\t"," ":" "}[b]||"\\"+b:c?"="===c?"'+_e("+d+")+'":"'+("+d+"==null?'':"+d+")+'":e?"';":f?"_s+='":void 0},b.encReg=/[<>&"'\x00]/g,b.encMap={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#39;"},b.encode=function(a){return(null==a?"":""+a).replace(b.encReg,function(a){return b.encMap[a]||""})},b.arg="o",b.helper=",print=function(s,e){_s+=e?(s==null?'':s):_e(s);},include=function(s,d){_s+=tmpl(s,d);}","function"==typeof define&&define.amd?define(function(){return b}):a.tmpl=b}(this);
@@ -0,0 +1,2256 @@
1
+ /*! jQuery UI - v1.10.4 - 2014-03-29
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.sortable.js
4
+ * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ (function( $, undefined ) {
7
+
8
+ var uuid = 0,
9
+ runiqueId = /^ui-id-\d+$/;
10
+
11
+ // $.ui might exist from components with no dependencies, e.g., $.ui.position
12
+ $.ui = $.ui || {};
13
+
14
+ $.extend( $.ui, {
15
+ version: "1.10.4",
16
+
17
+ keyCode: {
18
+ BACKSPACE: 8,
19
+ COMMA: 188,
20
+ DELETE: 46,
21
+ DOWN: 40,
22
+ END: 35,
23
+ ENTER: 13,
24
+ ESCAPE: 27,
25
+ HOME: 36,
26
+ LEFT: 37,
27
+ NUMPAD_ADD: 107,
28
+ NUMPAD_DECIMAL: 110,
29
+ NUMPAD_DIVIDE: 111,
30
+ NUMPAD_ENTER: 108,
31
+ NUMPAD_MULTIPLY: 106,
32
+ NUMPAD_SUBTRACT: 109,
33
+ PAGE_DOWN: 34,
34
+ PAGE_UP: 33,
35
+ PERIOD: 190,
36
+ RIGHT: 39,
37
+ SPACE: 32,
38
+ TAB: 9,
39
+ UP: 38
40
+ }
41
+ });
42
+
43
+ // plugins
44
+ $.fn.extend({
45
+ focus: (function( orig ) {
46
+ return function( delay, fn ) {
47
+ return typeof delay === "number" ?
48
+ this.each(function() {
49
+ var elem = this;
50
+ setTimeout(function() {
51
+ $( elem ).focus();
52
+ if ( fn ) {
53
+ fn.call( elem );
54
+ }
55
+ }, delay );
56
+ }) :
57
+ orig.apply( this, arguments );
58
+ };
59
+ })( $.fn.focus ),
60
+
61
+ scrollParent: function() {
62
+ var scrollParent;
63
+ if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) {
64
+ scrollParent = this.parents().filter(function() {
65
+ return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
66
+ }).eq(0);
67
+ } else {
68
+ scrollParent = this.parents().filter(function() {
69
+ return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
70
+ }).eq(0);
71
+ }
72
+
73
+ return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent;
74
+ },
75
+
76
+ zIndex: function( zIndex ) {
77
+ if ( zIndex !== undefined ) {
78
+ return this.css( "zIndex", zIndex );
79
+ }
80
+
81
+ if ( this.length ) {
82
+ var elem = $( this[ 0 ] ), position, value;
83
+ while ( elem.length && elem[ 0 ] !== document ) {
84
+ // Ignore z-index if position is set to a value where z-index is ignored by the browser
85
+ // This makes behavior of this function consistent across browsers
86
+ // WebKit always returns auto if the element is positioned
87
+ position = elem.css( "position" );
88
+ if ( position === "absolute" || position === "relative" || position === "fixed" ) {
89
+ // IE returns 0 when zIndex is not specified
90
+ // other browsers return a string
91
+ // we ignore the case of nested elements with an explicit value of 0
92
+ // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
93
+ value = parseInt( elem.css( "zIndex" ), 10 );
94
+ if ( !isNaN( value ) && value !== 0 ) {
95
+ return value;
96
+ }
97
+ }
98
+ elem = elem.parent();
99
+ }
100
+ }
101
+
102
+ return 0;
103
+ },
104
+
105
+ uniqueId: function() {
106
+ return this.each(function() {
107
+ if ( !this.id ) {
108
+ this.id = "ui-id-" + (++uuid);
109
+ }
110
+ });
111
+ },
112
+
113
+ removeUniqueId: function() {
114
+ return this.each(function() {
115
+ if ( runiqueId.test( this.id ) ) {
116
+ $( this ).removeAttr( "id" );
117
+ }
118
+ });
119
+ }
120
+ });
121
+
122
+ // selectors
123
+ function focusable( element, isTabIndexNotNaN ) {
124
+ var map, mapName, img,
125
+ nodeName = element.nodeName.toLowerCase();
126
+ if ( "area" === nodeName ) {
127
+ map = element.parentNode;
128
+ mapName = map.name;
129
+ if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
130
+ return false;
131
+ }
132
+ img = $( "img[usemap=#" + mapName + "]" )[0];
133
+ return !!img && visible( img );
134
+ }
135
+ return ( /input|select|textarea|button|object/.test( nodeName ) ?
136
+ !element.disabled :
137
+ "a" === nodeName ?
138
+ element.href || isTabIndexNotNaN :
139
+ isTabIndexNotNaN) &&
140
+ // the element and all of its ancestors must be visible
141
+ visible( element );
142
+ }
143
+
144
+ function visible( element ) {
145
+ return $.expr.filters.visible( element ) &&
146
+ !$( element ).parents().addBack().filter(function() {
147
+ return $.css( this, "visibility" ) === "hidden";
148
+ }).length;
149
+ }
150
+
151
+ $.extend( $.expr[ ":" ], {
152
+ data: $.expr.createPseudo ?
153
+ $.expr.createPseudo(function( dataName ) {
154
+ return function( elem ) {
155
+ return !!$.data( elem, dataName );
156
+ };
157
+ }) :
158
+ // support: jQuery <1.8
159
+ function( elem, i, match ) {
160
+ return !!$.data( elem, match[ 3 ] );
161
+ },
162
+
163
+ focusable: function( element ) {
164
+ return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
165
+ },
166
+
167
+ tabbable: function( element ) {
168
+ var tabIndex = $.attr( element, "tabindex" ),
169
+ isTabIndexNaN = isNaN( tabIndex );
170
+ return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
171
+ }
172
+ });
173
+
174
+ // support: jQuery <1.8
175
+ if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
176
+ $.each( [ "Width", "Height" ], function( i, name ) {
177
+ var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
178
+ type = name.toLowerCase(),
179
+ orig = {
180
+ innerWidth: $.fn.innerWidth,
181
+ innerHeight: $.fn.innerHeight,
182
+ outerWidth: $.fn.outerWidth,
183
+ outerHeight: $.fn.outerHeight
184
+ };
185
+
186
+ function reduce( elem, size, border, margin ) {
187
+ $.each( side, function() {
188
+ size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
189
+ if ( border ) {
190
+ size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
191
+ }
192
+ if ( margin ) {
193
+ size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
194
+ }
195
+ });
196
+ return size;
197
+ }
198
+
199
+ $.fn[ "inner" + name ] = function( size ) {
200
+ if ( size === undefined ) {
201
+ return orig[ "inner" + name ].call( this );
202
+ }
203
+
204
+ return this.each(function() {
205
+ $( this ).css( type, reduce( this, size ) + "px" );
206
+ });
207
+ };
208
+
209
+ $.fn[ "outer" + name] = function( size, margin ) {
210
+ if ( typeof size !== "number" ) {
211
+ return orig[ "outer" + name ].call( this, size );
212
+ }
213
+
214
+ return this.each(function() {
215
+ $( this).css( type, reduce( this, size, true, margin ) + "px" );
216
+ });
217
+ };
218
+ });
219
+ }
220
+
221
+ // support: jQuery <1.8
222
+ if ( !$.fn.addBack ) {
223
+ $.fn.addBack = function( selector ) {
224
+ return this.add( selector == null ?
225
+ this.prevObject : this.prevObject.filter( selector )
226
+ );
227
+ };
228
+ }
229
+
230
+ // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
231
+ if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
232
+ $.fn.removeData = (function( removeData ) {
233
+ return function( key ) {
234
+ if ( arguments.length ) {
235
+ return removeData.call( this, $.camelCase( key ) );
236
+ } else {
237
+ return removeData.call( this );
238
+ }
239
+ };
240
+ })( $.fn.removeData );
241
+ }
242
+
243
+
244
+
245
+
246
+
247
+ // deprecated
248
+ $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
249
+
250
+ $.support.selectstart = "onselectstart" in document.createElement( "div" );
251
+ $.fn.extend({
252
+ disableSelection: function() {
253
+ return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
254
+ ".ui-disableSelection", function( event ) {
255
+ event.preventDefault();
256
+ });
257
+ },
258
+
259
+ enableSelection: function() {
260
+ return this.unbind( ".ui-disableSelection" );
261
+ }
262
+ });
263
+
264
+ $.extend( $.ui, {
265
+ // $.ui.plugin is deprecated. Use $.widget() extensions instead.
266
+ plugin: {
267
+ add: function( module, option, set ) {
268
+ var i,
269
+ proto = $.ui[ module ].prototype;
270
+ for ( i in set ) {
271
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
272
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
273
+ }
274
+ },
275
+ call: function( instance, name, args ) {
276
+ var i,
277
+ set = instance.plugins[ name ];
278
+ if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
279
+ return;
280
+ }
281
+
282
+ for ( i = 0; i < set.length; i++ ) {
283
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
284
+ set[ i ][ 1 ].apply( instance.element, args );
285
+ }
286
+ }
287
+ }
288
+ },
289
+
290
+ // only used by resizable
291
+ hasScroll: function( el, a ) {
292
+
293
+ //If overflow is hidden, the element might have extra content, but the user wants to hide it
294
+ if ( $( el ).css( "overflow" ) === "hidden") {
295
+ return false;
296
+ }
297
+
298
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
299
+ has = false;
300
+
301
+ if ( el[ scroll ] > 0 ) {
302
+ return true;
303
+ }
304
+
305
+ // TODO: determine which cases actually cause this to happen
306
+ // if the element doesn't have the scroll set, see if it's possible to
307
+ // set the scroll
308
+ el[ scroll ] = 1;
309
+ has = ( el[ scroll ] > 0 );
310
+ el[ scroll ] = 0;
311
+ return has;
312
+ }
313
+ });
314
+
315
+ })( jQuery );
316
+ (function( $, undefined ) {
317
+
318
+ var uuid = 0,
319
+ slice = Array.prototype.slice,
320
+ _cleanData = $.cleanData;
321
+ $.cleanData = function( elems ) {
322
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
323
+ try {
324
+ $( elem ).triggerHandler( "remove" );
325
+ // http://bugs.jquery.com/ticket/8235
326
+ } catch( e ) {}
327
+ }
328
+ _cleanData( elems );
329
+ };
330
+
331
+ $.widget = function( name, base, prototype ) {
332
+ var fullName, existingConstructor, constructor, basePrototype,
333
+ // proxiedPrototype allows the provided prototype to remain unmodified
334
+ // so that it can be used as a mixin for multiple widgets (#8876)
335
+ proxiedPrototype = {},
336
+ namespace = name.split( "." )[ 0 ];
337
+
338
+ name = name.split( "." )[ 1 ];
339
+ fullName = namespace + "-" + name;
340
+
341
+ if ( !prototype ) {
342
+ prototype = base;
343
+ base = $.Widget;
344
+ }
345
+
346
+ // create selector for plugin
347
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
348
+ return !!$.data( elem, fullName );
349
+ };
350
+
351
+ $[ namespace ] = $[ namespace ] || {};
352
+ existingConstructor = $[ namespace ][ name ];
353
+ constructor = $[ namespace ][ name ] = function( options, element ) {
354
+ // allow instantiation without "new" keyword
355
+ if ( !this._createWidget ) {
356
+ return new constructor( options, element );
357
+ }
358
+
359
+ // allow instantiation without initializing for simple inheritance
360
+ // must use "new" keyword (the code above always passes args)
361
+ if ( arguments.length ) {
362
+ this._createWidget( options, element );
363
+ }
364
+ };
365
+ // extend with the existing constructor to carry over any static properties
366
+ $.extend( constructor, existingConstructor, {
367
+ version: prototype.version,
368
+ // copy the object used to create the prototype in case we need to
369
+ // redefine the widget later
370
+ _proto: $.extend( {}, prototype ),
371
+ // track widgets that inherit from this widget in case this widget is
372
+ // redefined after a widget inherits from it
373
+ _childConstructors: []
374
+ });
375
+
376
+ basePrototype = new base();
377
+ // we need to make the options hash a property directly on the new instance
378
+ // otherwise we'll modify the options hash on the prototype that we're
379
+ // inheriting from
380
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
381
+ $.each( prototype, function( prop, value ) {
382
+ if ( !$.isFunction( value ) ) {
383
+ proxiedPrototype[ prop ] = value;
384
+ return;
385
+ }
386
+ proxiedPrototype[ prop ] = (function() {
387
+ var _super = function() {
388
+ return base.prototype[ prop ].apply( this, arguments );
389
+ },
390
+ _superApply = function( args ) {
391
+ return base.prototype[ prop ].apply( this, args );
392
+ };
393
+ return function() {
394
+ var __super = this._super,
395
+ __superApply = this._superApply,
396
+ returnValue;
397
+
398
+ this._super = _super;
399
+ this._superApply = _superApply;
400
+
401
+ returnValue = value.apply( this, arguments );
402
+
403
+ this._super = __super;
404
+ this._superApply = __superApply;
405
+
406
+ return returnValue;
407
+ };
408
+ })();
409
+ });
410
+ constructor.prototype = $.widget.extend( basePrototype, {
411
+ // TODO: remove support for widgetEventPrefix
412
+ // always use the name + a colon as the prefix, e.g., draggable:start
413
+ // don't prefix for widgets that aren't DOM-based
414
+ widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
415
+ }, proxiedPrototype, {
416
+ constructor: constructor,
417
+ namespace: namespace,
418
+ widgetName: name,
419
+ widgetFullName: fullName
420
+ });
421
+
422
+ // If this widget is being redefined then we need to find all widgets that
423
+ // are inheriting from it and redefine all of them so that they inherit from
424
+ // the new version of this widget. We're essentially trying to replace one
425
+ // level in the prototype chain.
426
+ if ( existingConstructor ) {
427
+ $.each( existingConstructor._childConstructors, function( i, child ) {
428
+ var childPrototype = child.prototype;
429
+
430
+ // redefine the child widget using the same prototype that was
431
+ // originally used, but inherit from the new version of the base
432
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
433
+ });
434
+ // remove the list of existing child constructors from the old constructor
435
+ // so the old child constructors can be garbage collected
436
+ delete existingConstructor._childConstructors;
437
+ } else {
438
+ base._childConstructors.push( constructor );
439
+ }
440
+
441
+ $.widget.bridge( name, constructor );
442
+ };
443
+
444
+ $.widget.extend = function( target ) {
445
+ var input = slice.call( arguments, 1 ),
446
+ inputIndex = 0,
447
+ inputLength = input.length,
448
+ key,
449
+ value;
450
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
451
+ for ( key in input[ inputIndex ] ) {
452
+ value = input[ inputIndex ][ key ];
453
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
454
+ // Clone objects
455
+ if ( $.isPlainObject( value ) ) {
456
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
457
+ $.widget.extend( {}, target[ key ], value ) :
458
+ // Don't extend strings, arrays, etc. with objects
459
+ $.widget.extend( {}, value );
460
+ // Copy everything else by reference
461
+ } else {
462
+ target[ key ] = value;
463
+ }
464
+ }
465
+ }
466
+ }
467
+ return target;
468
+ };
469
+
470
+ $.widget.bridge = function( name, object ) {
471
+ var fullName = object.prototype.widgetFullName || name;
472
+ $.fn[ name ] = function( options ) {
473
+ var isMethodCall = typeof options === "string",
474
+ args = slice.call( arguments, 1 ),
475
+ returnValue = this;
476
+
477
+ // allow multiple hashes to be passed on init
478
+ options = !isMethodCall && args.length ?
479
+ $.widget.extend.apply( null, [ options ].concat(args) ) :
480
+ options;
481
+
482
+ if ( isMethodCall ) {
483
+ this.each(function() {
484
+ var methodValue,
485
+ instance = $.data( this, fullName );
486
+ if ( !instance ) {
487
+ return $.error( "cannot call methods on " + name + " prior to initialization; " +
488
+ "attempted to call method '" + options + "'" );
489
+ }
490
+ if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
491
+ return $.error( "no such method '" + options + "' for " + name + " widget instance" );
492
+ }
493
+ methodValue = instance[ options ].apply( instance, args );
494
+ if ( methodValue !== instance && methodValue !== undefined ) {
495
+ returnValue = methodValue && methodValue.jquery ?
496
+ returnValue.pushStack( methodValue.get() ) :
497
+ methodValue;
498
+ return false;
499
+ }
500
+ });
501
+ } else {
502
+ this.each(function() {
503
+ var instance = $.data( this, fullName );
504
+ if ( instance ) {
505
+ instance.option( options || {} )._init();
506
+ } else {
507
+ $.data( this, fullName, new object( options, this ) );
508
+ }
509
+ });
510
+ }
511
+
512
+ return returnValue;
513
+ };
514
+ };
515
+
516
+ $.Widget = function( /* options, element */ ) {};
517
+ $.Widget._childConstructors = [];
518
+
519
+ $.Widget.prototype = {
520
+ widgetName: "widget",
521
+ widgetEventPrefix: "",
522
+ defaultElement: "<div>",
523
+ options: {
524
+ disabled: false,
525
+
526
+ // callbacks
527
+ create: null
528
+ },
529
+ _createWidget: function( options, element ) {
530
+ element = $( element || this.defaultElement || this )[ 0 ];
531
+ this.element = $( element );
532
+ this.uuid = uuid++;
533
+ this.eventNamespace = "." + this.widgetName + this.uuid;
534
+ this.options = $.widget.extend( {},
535
+ this.options,
536
+ this._getCreateOptions(),
537
+ options );
538
+
539
+ this.bindings = $();
540
+ this.hoverable = $();
541
+ this.focusable = $();
542
+
543
+ if ( element !== this ) {
544
+ $.data( element, this.widgetFullName, this );
545
+ this._on( true, this.element, {
546
+ remove: function( event ) {
547
+ if ( event.target === element ) {
548
+ this.destroy();
549
+ }
550
+ }
551
+ });
552
+ this.document = $( element.style ?
553
+ // element within the document
554
+ element.ownerDocument :
555
+ // element is window or document
556
+ element.document || element );
557
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
558
+ }
559
+
560
+ this._create();
561
+ this._trigger( "create", null, this._getCreateEventData() );
562
+ this._init();
563
+ },
564
+ _getCreateOptions: $.noop,
565
+ _getCreateEventData: $.noop,
566
+ _create: $.noop,
567
+ _init: $.noop,
568
+
569
+ destroy: function() {
570
+ this._destroy();
571
+ // we can probably remove the unbind calls in 2.0
572
+ // all event bindings should go through this._on()
573
+ this.element
574
+ .unbind( this.eventNamespace )
575
+ // 1.9 BC for #7810
576
+ // TODO remove dual storage
577
+ .removeData( this.widgetName )
578
+ .removeData( this.widgetFullName )
579
+ // support: jquery <1.6.3
580
+ // http://bugs.jquery.com/ticket/9413
581
+ .removeData( $.camelCase( this.widgetFullName ) );
582
+ this.widget()
583
+ .unbind( this.eventNamespace )
584
+ .removeAttr( "aria-disabled" )
585
+ .removeClass(
586
+ this.widgetFullName + "-disabled " +
587
+ "ui-state-disabled" );
588
+
589
+ // clean up events and states
590
+ this.bindings.unbind( this.eventNamespace );
591
+ this.hoverable.removeClass( "ui-state-hover" );
592
+ this.focusable.removeClass( "ui-state-focus" );
593
+ },
594
+ _destroy: $.noop,
595
+
596
+ widget: function() {
597
+ return this.element;
598
+ },
599
+
600
+ option: function( key, value ) {
601
+ var options = key,
602
+ parts,
603
+ curOption,
604
+ i;
605
+
606
+ if ( arguments.length === 0 ) {
607
+ // don't return a reference to the internal hash
608
+ return $.widget.extend( {}, this.options );
609
+ }
610
+
611
+ if ( typeof key === "string" ) {
612
+ // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
613
+ options = {};
614
+ parts = key.split( "." );
615
+ key = parts.shift();
616
+ if ( parts.length ) {
617
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
618
+ for ( i = 0; i < parts.length - 1; i++ ) {
619
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
620
+ curOption = curOption[ parts[ i ] ];
621
+ }
622
+ key = parts.pop();
623
+ if ( arguments.length === 1 ) {
624
+ return curOption[ key ] === undefined ? null : curOption[ key ];
625
+ }
626
+ curOption[ key ] = value;
627
+ } else {
628
+ if ( arguments.length === 1 ) {
629
+ return this.options[ key ] === undefined ? null : this.options[ key ];
630
+ }
631
+ options[ key ] = value;
632
+ }
633
+ }
634
+
635
+ this._setOptions( options );
636
+
637
+ return this;
638
+ },
639
+ _setOptions: function( options ) {
640
+ var key;
641
+
642
+ for ( key in options ) {
643
+ this._setOption( key, options[ key ] );
644
+ }
645
+
646
+ return this;
647
+ },
648
+ _setOption: function( key, value ) {
649
+ this.options[ key ] = value;
650
+
651
+ if ( key === "disabled" ) {
652
+ this.widget()
653
+ .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
654
+ .attr( "aria-disabled", value );
655
+ this.hoverable.removeClass( "ui-state-hover" );
656
+ this.focusable.removeClass( "ui-state-focus" );
657
+ }
658
+
659
+ return this;
660
+ },
661
+
662
+ enable: function() {
663
+ return this._setOption( "disabled", false );
664
+ },
665
+ disable: function() {
666
+ return this._setOption( "disabled", true );
667
+ },
668
+
669
+ _on: function( suppressDisabledCheck, element, handlers ) {
670
+ var delegateElement,
671
+ instance = this;
672
+
673
+ // no suppressDisabledCheck flag, shuffle arguments
674
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
675
+ handlers = element;
676
+ element = suppressDisabledCheck;
677
+ suppressDisabledCheck = false;
678
+ }
679
+
680
+ // no element argument, shuffle and use this.element
681
+ if ( !handlers ) {
682
+ handlers = element;
683
+ element = this.element;
684
+ delegateElement = this.widget();
685
+ } else {
686
+ // accept selectors, DOM elements
687
+ element = delegateElement = $( element );
688
+ this.bindings = this.bindings.add( element );
689
+ }
690
+
691
+ $.each( handlers, function( event, handler ) {
692
+ function handlerProxy() {
693
+ // allow widgets to customize the disabled handling
694
+ // - disabled as an array instead of boolean
695
+ // - disabled class as method for disabling individual parts
696
+ if ( !suppressDisabledCheck &&
697
+ ( instance.options.disabled === true ||
698
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
699
+ return;
700
+ }
701
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
702
+ .apply( instance, arguments );
703
+ }
704
+
705
+ // copy the guid so direct unbinding works
706
+ if ( typeof handler !== "string" ) {
707
+ handlerProxy.guid = handler.guid =
708
+ handler.guid || handlerProxy.guid || $.guid++;
709
+ }
710
+
711
+ var match = event.match( /^(\w+)\s*(.*)$/ ),
712
+ eventName = match[1] + instance.eventNamespace,
713
+ selector = match[2];
714
+ if ( selector ) {
715
+ delegateElement.delegate( selector, eventName, handlerProxy );
716
+ } else {
717
+ element.bind( eventName, handlerProxy );
718
+ }
719
+ });
720
+ },
721
+
722
+ _off: function( element, eventName ) {
723
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
724
+ element.unbind( eventName ).undelegate( eventName );
725
+ },
726
+
727
+ _delay: function( handler, delay ) {
728
+ function handlerProxy() {
729
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
730
+ .apply( instance, arguments );
731
+ }
732
+ var instance = this;
733
+ return setTimeout( handlerProxy, delay || 0 );
734
+ },
735
+
736
+ _hoverable: function( element ) {
737
+ this.hoverable = this.hoverable.add( element );
738
+ this._on( element, {
739
+ mouseenter: function( event ) {
740
+ $( event.currentTarget ).addClass( "ui-state-hover" );
741
+ },
742
+ mouseleave: function( event ) {
743
+ $( event.currentTarget ).removeClass( "ui-state-hover" );
744
+ }
745
+ });
746
+ },
747
+
748
+ _focusable: function( element ) {
749
+ this.focusable = this.focusable.add( element );
750
+ this._on( element, {
751
+ focusin: function( event ) {
752
+ $( event.currentTarget ).addClass( "ui-state-focus" );
753
+ },
754
+ focusout: function( event ) {
755
+ $( event.currentTarget ).removeClass( "ui-state-focus" );
756
+ }
757
+ });
758
+ },
759
+
760
+ _trigger: function( type, event, data ) {
761
+ var prop, orig,
762
+ callback = this.options[ type ];
763
+
764
+ data = data || {};
765
+ event = $.Event( event );
766
+ event.type = ( type === this.widgetEventPrefix ?
767
+ type :
768
+ this.widgetEventPrefix + type ).toLowerCase();
769
+ // the original event may come from any element
770
+ // so we need to reset the target on the new event
771
+ event.target = this.element[ 0 ];
772
+
773
+ // copy original event properties over to the new event
774
+ orig = event.originalEvent;
775
+ if ( orig ) {
776
+ for ( prop in orig ) {
777
+ if ( !( prop in event ) ) {
778
+ event[ prop ] = orig[ prop ];
779
+ }
780
+ }
781
+ }
782
+
783
+ this.element.trigger( event, data );
784
+ return !( $.isFunction( callback ) &&
785
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
786
+ event.isDefaultPrevented() );
787
+ }
788
+ };
789
+
790
+ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
791
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
792
+ if ( typeof options === "string" ) {
793
+ options = { effect: options };
794
+ }
795
+ var hasOptions,
796
+ effectName = !options ?
797
+ method :
798
+ options === true || typeof options === "number" ?
799
+ defaultEffect :
800
+ options.effect || defaultEffect;
801
+ options = options || {};
802
+ if ( typeof options === "number" ) {
803
+ options = { duration: options };
804
+ }
805
+ hasOptions = !$.isEmptyObject( options );
806
+ options.complete = callback;
807
+ if ( options.delay ) {
808
+ element.delay( options.delay );
809
+ }
810
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
811
+ element[ method ]( options );
812
+ } else if ( effectName !== method && element[ effectName ] ) {
813
+ element[ effectName ]( options.duration, options.easing, callback );
814
+ } else {
815
+ element.queue(function( next ) {
816
+ $( this )[ method ]();
817
+ if ( callback ) {
818
+ callback.call( element[ 0 ] );
819
+ }
820
+ next();
821
+ });
822
+ }
823
+ };
824
+ });
825
+
826
+ })( jQuery );
827
+ (function( $, undefined ) {
828
+
829
+ var mouseHandled = false;
830
+ $( document ).mouseup( function() {
831
+ mouseHandled = false;
832
+ });
833
+
834
+ $.widget("ui.mouse", {
835
+ version: "1.10.4",
836
+ options: {
837
+ cancel: "input,textarea,button,select,option",
838
+ distance: 1,
839
+ delay: 0
840
+ },
841
+ _mouseInit: function() {
842
+ var that = this;
843
+
844
+ this.element
845
+ .bind("mousedown."+this.widgetName, function(event) {
846
+ return that._mouseDown(event);
847
+ })
848
+ .bind("click."+this.widgetName, function(event) {
849
+ if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
850
+ $.removeData(event.target, that.widgetName + ".preventClickEvent");
851
+ event.stopImmediatePropagation();
852
+ return false;
853
+ }
854
+ });
855
+
856
+ this.started = false;
857
+ },
858
+
859
+ // TODO: make sure destroying one instance of mouse doesn't mess with
860
+ // other instances of mouse
861
+ _mouseDestroy: function() {
862
+ this.element.unbind("."+this.widgetName);
863
+ if ( this._mouseMoveDelegate ) {
864
+ $(document)
865
+ .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
866
+ .unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
867
+ }
868
+ },
869
+
870
+ _mouseDown: function(event) {
871
+ // don't let more than one widget handle mouseStart
872
+ if( mouseHandled ) { return; }
873
+
874
+ // we may have missed mouseup (out of window)
875
+ (this._mouseStarted && this._mouseUp(event));
876
+
877
+ this._mouseDownEvent = event;
878
+
879
+ var that = this,
880
+ btnIsLeft = (event.which === 1),
881
+ // event.target.nodeName works around a bug in IE 8 with
882
+ // disabled inputs (#7620)
883
+ elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
884
+ if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
885
+ return true;
886
+ }
887
+
888
+ this.mouseDelayMet = !this.options.delay;
889
+ if (!this.mouseDelayMet) {
890
+ this._mouseDelayTimer = setTimeout(function() {
891
+ that.mouseDelayMet = true;
892
+ }, this.options.delay);
893
+ }
894
+
895
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
896
+ this._mouseStarted = (this._mouseStart(event) !== false);
897
+ if (!this._mouseStarted) {
898
+ event.preventDefault();
899
+ return true;
900
+ }
901
+ }
902
+
903
+ // Click event may never have fired (Gecko & Opera)
904
+ if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
905
+ $.removeData(event.target, this.widgetName + ".preventClickEvent");
906
+ }
907
+
908
+ // these delegates are required to keep context
909
+ this._mouseMoveDelegate = function(event) {
910
+ return that._mouseMove(event);
911
+ };
912
+ this._mouseUpDelegate = function(event) {
913
+ return that._mouseUp(event);
914
+ };
915
+ $(document)
916
+ .bind("mousemove."+this.widgetName, this._mouseMoveDelegate)
917
+ .bind("mouseup."+this.widgetName, this._mouseUpDelegate);
918
+
919
+ event.preventDefault();
920
+
921
+ mouseHandled = true;
922
+ return true;
923
+ },
924
+
925
+ _mouseMove: function(event) {
926
+ // IE mouseup check - mouseup happened when mouse was out of window
927
+ if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
928
+ return this._mouseUp(event);
929
+ }
930
+
931
+ if (this._mouseStarted) {
932
+ this._mouseDrag(event);
933
+ return event.preventDefault();
934
+ }
935
+
936
+ if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
937
+ this._mouseStarted =
938
+ (this._mouseStart(this._mouseDownEvent, event) !== false);
939
+ (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
940
+ }
941
+
942
+ return !this._mouseStarted;
943
+ },
944
+
945
+ _mouseUp: function(event) {
946
+ $(document)
947
+ .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
948
+ .unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
949
+
950
+ if (this._mouseStarted) {
951
+ this._mouseStarted = false;
952
+
953
+ if (event.target === this._mouseDownEvent.target) {
954
+ $.data(event.target, this.widgetName + ".preventClickEvent", true);
955
+ }
956
+
957
+ this._mouseStop(event);
958
+ }
959
+
960
+ return false;
961
+ },
962
+
963
+ _mouseDistanceMet: function(event) {
964
+ return (Math.max(
965
+ Math.abs(this._mouseDownEvent.pageX - event.pageX),
966
+ Math.abs(this._mouseDownEvent.pageY - event.pageY)
967
+ ) >= this.options.distance
968
+ );
969
+ },
970
+
971
+ _mouseDelayMet: function(/* event */) {
972
+ return this.mouseDelayMet;
973
+ },
974
+
975
+ // These are placeholder methods, to be overriden by extending plugin
976
+ _mouseStart: function(/* event */) {},
977
+ _mouseDrag: function(/* event */) {},
978
+ _mouseStop: function(/* event */) {},
979
+ _mouseCapture: function(/* event */) { return true; }
980
+ });
981
+
982
+ })(jQuery);
983
+ (function( $, undefined ) {
984
+
985
+ function isOverAxis( x, reference, size ) {
986
+ return ( x > reference ) && ( x < ( reference + size ) );
987
+ }
988
+
989
+ function isFloating(item) {
990
+ return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
991
+ }
992
+
993
+ $.widget("ui.sortable", $.ui.mouse, {
994
+ version: "1.10.4",
995
+ widgetEventPrefix: "sort",
996
+ ready: false,
997
+ options: {
998
+ appendTo: "parent",
999
+ axis: false,
1000
+ connectWith: false,
1001
+ containment: false,
1002
+ cursor: "auto",
1003
+ cursorAt: false,
1004
+ dropOnEmpty: true,
1005
+ forcePlaceholderSize: false,
1006
+ forceHelperSize: false,
1007
+ grid: false,
1008
+ handle: false,
1009
+ helper: "original",
1010
+ items: "> *",
1011
+ opacity: false,
1012
+ placeholder: false,
1013
+ revert: false,
1014
+ scroll: true,
1015
+ scrollSensitivity: 20,
1016
+ scrollSpeed: 20,
1017
+ scope: "default",
1018
+ tolerance: "intersect",
1019
+ zIndex: 1000,
1020
+
1021
+ // callbacks
1022
+ activate: null,
1023
+ beforeStop: null,
1024
+ change: null,
1025
+ deactivate: null,
1026
+ out: null,
1027
+ over: null,
1028
+ receive: null,
1029
+ remove: null,
1030
+ sort: null,
1031
+ start: null,
1032
+ stop: null,
1033
+ update: null
1034
+ },
1035
+ _create: function() {
1036
+
1037
+ var o = this.options;
1038
+ this.containerCache = {};
1039
+ this.element.addClass("ui-sortable");
1040
+
1041
+ //Get the items
1042
+ this.refresh();
1043
+
1044
+ //Let's determine if the items are being displayed horizontally
1045
+ this.floating = this.items.length ? o.axis === "x" || isFloating(this.items[0].item) : false;
1046
+
1047
+ //Let's determine the parent's offset
1048
+ this.offset = this.element.offset();
1049
+
1050
+ //Initialize mouse events for interaction
1051
+ this._mouseInit();
1052
+
1053
+ //We're ready to go
1054
+ this.ready = true;
1055
+
1056
+ },
1057
+
1058
+ _destroy: function() {
1059
+ this.element
1060
+ .removeClass("ui-sortable ui-sortable-disabled");
1061
+ this._mouseDestroy();
1062
+
1063
+ for ( var i = this.items.length - 1; i >= 0; i-- ) {
1064
+ this.items[i].item.removeData(this.widgetName + "-item");
1065
+ }
1066
+
1067
+ return this;
1068
+ },
1069
+
1070
+ _setOption: function(key, value){
1071
+ if ( key === "disabled" ) {
1072
+ this.options[ key ] = value;
1073
+
1074
+ this.widget().toggleClass( "ui-sortable-disabled", !!value );
1075
+ } else {
1076
+ // Don't call widget base _setOption for disable as it adds ui-state-disabled class
1077
+ $.Widget.prototype._setOption.apply(this, arguments);
1078
+ }
1079
+ },
1080
+
1081
+ _mouseCapture: function(event, overrideHandle) {
1082
+ var currentItem = null,
1083
+ validHandle = false,
1084
+ that = this;
1085
+
1086
+ if (this.reverting) {
1087
+ return false;
1088
+ }
1089
+
1090
+ if(this.options.disabled || this.options.type === "static") {
1091
+ return false;
1092
+ }
1093
+
1094
+ //We have to refresh the items data once first
1095
+ this._refreshItems(event);
1096
+
1097
+ //Find out if the clicked node (or one of its parents) is a actual item in this.items
1098
+ $(event.target).parents().each(function() {
1099
+ if($.data(this, that.widgetName + "-item") === that) {
1100
+ currentItem = $(this);
1101
+ return false;
1102
+ }
1103
+ });
1104
+ if($.data(event.target, that.widgetName + "-item") === that) {
1105
+ currentItem = $(event.target);
1106
+ }
1107
+
1108
+ if(!currentItem) {
1109
+ return false;
1110
+ }
1111
+ if(this.options.handle && !overrideHandle) {
1112
+ $(this.options.handle, currentItem).find("*").addBack().each(function() {
1113
+ if(this === event.target) {
1114
+ validHandle = true;
1115
+ }
1116
+ });
1117
+ if(!validHandle) {
1118
+ return false;
1119
+ }
1120
+ }
1121
+
1122
+ this.currentItem = currentItem;
1123
+ this._removeCurrentsFromItems();
1124
+ return true;
1125
+
1126
+ },
1127
+
1128
+ _mouseStart: function(event, overrideHandle, noActivation) {
1129
+
1130
+ var i, body,
1131
+ o = this.options;
1132
+
1133
+ this.currentContainer = this;
1134
+
1135
+ //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
1136
+ this.refreshPositions();
1137
+
1138
+ //Create and append the visible helper
1139
+ this.helper = this._createHelper(event);
1140
+
1141
+ //Cache the helper size
1142
+ this._cacheHelperProportions();
1143
+
1144
+ /*
1145
+ * - Position generation -
1146
+ * This block generates everything position related - it's the core of draggables.
1147
+ */
1148
+
1149
+ //Cache the margins of the original element
1150
+ this._cacheMargins();
1151
+
1152
+ //Get the next scrolling parent
1153
+ this.scrollParent = this.helper.scrollParent();
1154
+
1155
+ //The element's absolute position on the page minus margins
1156
+ this.offset = this.currentItem.offset();
1157
+ this.offset = {
1158
+ top: this.offset.top - this.margins.top,
1159
+ left: this.offset.left - this.margins.left
1160
+ };
1161
+
1162
+ $.extend(this.offset, {
1163
+ click: { //Where the click happened, relative to the element
1164
+ left: event.pageX - this.offset.left,
1165
+ top: event.pageY - this.offset.top
1166
+ },
1167
+ parent: this._getParentOffset(),
1168
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
1169
+ });
1170
+
1171
+ // Only after we got the offset, we can change the helper's position to absolute
1172
+ // TODO: Still need to figure out a way to make relative sorting possible
1173
+ this.helper.css("position", "absolute");
1174
+ this.cssPosition = this.helper.css("position");
1175
+
1176
+ //Generate the original position
1177
+ this.originalPosition = this._generatePosition(event);
1178
+ this.originalPageX = event.pageX;
1179
+ this.originalPageY = event.pageY;
1180
+
1181
+ //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
1182
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
1183
+
1184
+ //Cache the former DOM position
1185
+ this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
1186
+
1187
+ //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
1188
+ if(this.helper[0] !== this.currentItem[0]) {
1189
+ this.currentItem.hide();
1190
+ }
1191
+
1192
+ //Create the placeholder
1193
+ this._createPlaceholder();
1194
+
1195
+ //Set a containment if given in the options
1196
+ if(o.containment) {
1197
+ this._setContainment();
1198
+ }
1199
+
1200
+ if( o.cursor && o.cursor !== "auto" ) { // cursor option
1201
+ body = this.document.find( "body" );
1202
+
1203
+ // support: IE
1204
+ this.storedCursor = body.css( "cursor" );
1205
+ body.css( "cursor", o.cursor );
1206
+
1207
+ this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
1208
+ }
1209
+
1210
+ if(o.opacity) { // opacity option
1211
+ if (this.helper.css("opacity")) {
1212
+ this._storedOpacity = this.helper.css("opacity");
1213
+ }
1214
+ this.helper.css("opacity", o.opacity);
1215
+ }
1216
+
1217
+ if(o.zIndex) { // zIndex option
1218
+ if (this.helper.css("zIndex")) {
1219
+ this._storedZIndex = this.helper.css("zIndex");
1220
+ }
1221
+ this.helper.css("zIndex", o.zIndex);
1222
+ }
1223
+
1224
+ //Prepare scrolling
1225
+ if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
1226
+ this.overflowOffset = this.scrollParent.offset();
1227
+ }
1228
+
1229
+ //Call callbacks
1230
+ this._trigger("start", event, this._uiHash());
1231
+
1232
+ //Recache the helper size
1233
+ if(!this._preserveHelperProportions) {
1234
+ this._cacheHelperProportions();
1235
+ }
1236
+
1237
+
1238
+ //Post "activate" events to possible containers
1239
+ if( !noActivation ) {
1240
+ for ( i = this.containers.length - 1; i >= 0; i-- ) {
1241
+ this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
1242
+ }
1243
+ }
1244
+
1245
+ //Prepare possible droppables
1246
+ if($.ui.ddmanager) {
1247
+ $.ui.ddmanager.current = this;
1248
+ }
1249
+
1250
+ if ($.ui.ddmanager && !o.dropBehaviour) {
1251
+ $.ui.ddmanager.prepareOffsets(this, event);
1252
+ }
1253
+
1254
+ this.dragging = true;
1255
+
1256
+ this.helper.addClass("ui-sortable-helper");
1257
+ this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
1258
+ return true;
1259
+
1260
+ },
1261
+
1262
+ _mouseDrag: function(event) {
1263
+ var i, item, itemElement, intersection,
1264
+ o = this.options,
1265
+ scrolled = false;
1266
+
1267
+ //Compute the helpers position
1268
+ this.position = this._generatePosition(event);
1269
+ this.positionAbs = this._convertPositionTo("absolute");
1270
+
1271
+ if (!this.lastPositionAbs) {
1272
+ this.lastPositionAbs = this.positionAbs;
1273
+ }
1274
+
1275
+ //Do scrolling
1276
+ if(this.options.scroll) {
1277
+ if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
1278
+
1279
+ if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
1280
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
1281
+ } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
1282
+ this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
1283
+ }
1284
+
1285
+ if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
1286
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
1287
+ } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
1288
+ this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
1289
+ }
1290
+
1291
+ } else {
1292
+
1293
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
1294
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
1295
+ } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
1296
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
1297
+ }
1298
+
1299
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
1300
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
1301
+ } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
1302
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
1303
+ }
1304
+
1305
+ }
1306
+
1307
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
1308
+ $.ui.ddmanager.prepareOffsets(this, event);
1309
+ }
1310
+ }
1311
+
1312
+ //Regenerate the absolute position used for position checks
1313
+ this.positionAbs = this._convertPositionTo("absolute");
1314
+
1315
+ //Set the helper position
1316
+ if(!this.options.axis || this.options.axis !== "y") {
1317
+ this.helper[0].style.left = this.position.left+"px";
1318
+ }
1319
+ if(!this.options.axis || this.options.axis !== "x") {
1320
+ this.helper[0].style.top = this.position.top+"px";
1321
+ }
1322
+
1323
+ //Rearrange
1324
+ for (i = this.items.length - 1; i >= 0; i--) {
1325
+
1326
+ //Cache variables and intersection, continue if no intersection
1327
+ item = this.items[i];
1328
+ itemElement = item.item[0];
1329
+ intersection = this._intersectsWithPointer(item);
1330
+ if (!intersection) {
1331
+ continue;
1332
+ }
1333
+
1334
+ // Only put the placeholder inside the current Container, skip all
1335
+ // items from other containers. This works because when moving
1336
+ // an item from one container to another the
1337
+ // currentContainer is switched before the placeholder is moved.
1338
+ //
1339
+ // Without this, moving items in "sub-sortables" can cause
1340
+ // the placeholder to jitter beetween the outer and inner container.
1341
+ if (item.instance !== this.currentContainer) {
1342
+ continue;
1343
+ }
1344
+
1345
+ // cannot intersect with itself
1346
+ // no useless actions that have been done before
1347
+ // no action if the item moved is the parent of the item checked
1348
+ if (itemElement !== this.currentItem[0] &&
1349
+ this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
1350
+ !$.contains(this.placeholder[0], itemElement) &&
1351
+ (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
1352
+ ) {
1353
+
1354
+ this.direction = intersection === 1 ? "down" : "up";
1355
+
1356
+ if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
1357
+ this._rearrange(event, item);
1358
+ } else {
1359
+ break;
1360
+ }
1361
+
1362
+ this._trigger("change", event, this._uiHash());
1363
+ break;
1364
+ }
1365
+ }
1366
+
1367
+ //Post events to containers
1368
+ this._contactContainers(event);
1369
+
1370
+ //Interconnect with droppables
1371
+ if($.ui.ddmanager) {
1372
+ $.ui.ddmanager.drag(this, event);
1373
+ }
1374
+
1375
+ //Call callbacks
1376
+ this._trigger("sort", event, this._uiHash());
1377
+
1378
+ this.lastPositionAbs = this.positionAbs;
1379
+ return false;
1380
+
1381
+ },
1382
+
1383
+ _mouseStop: function(event, noPropagation) {
1384
+
1385
+ if(!event) {
1386
+ return;
1387
+ }
1388
+
1389
+ //If we are using droppables, inform the manager about the drop
1390
+ if ($.ui.ddmanager && !this.options.dropBehaviour) {
1391
+ $.ui.ddmanager.drop(this, event);
1392
+ }
1393
+
1394
+ if(this.options.revert) {
1395
+ var that = this,
1396
+ cur = this.placeholder.offset(),
1397
+ axis = this.options.axis,
1398
+ animation = {};
1399
+
1400
+ if ( !axis || axis === "x" ) {
1401
+ animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft);
1402
+ }
1403
+ if ( !axis || axis === "y" ) {
1404
+ animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop);
1405
+ }
1406
+ this.reverting = true;
1407
+ $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
1408
+ that._clear(event);
1409
+ });
1410
+ } else {
1411
+ this._clear(event, noPropagation);
1412
+ }
1413
+
1414
+ return false;
1415
+
1416
+ },
1417
+
1418
+ cancel: function() {
1419
+
1420
+ if(this.dragging) {
1421
+
1422
+ this._mouseUp({ target: null });
1423
+
1424
+ if(this.options.helper === "original") {
1425
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
1426
+ } else {
1427
+ this.currentItem.show();
1428
+ }
1429
+
1430
+ //Post deactivating events to containers
1431
+ for (var i = this.containers.length - 1; i >= 0; i--){
1432
+ this.containers[i]._trigger("deactivate", null, this._uiHash(this));
1433
+ if(this.containers[i].containerCache.over) {
1434
+ this.containers[i]._trigger("out", null, this._uiHash(this));
1435
+ this.containers[i].containerCache.over = 0;
1436
+ }
1437
+ }
1438
+
1439
+ }
1440
+
1441
+ if (this.placeholder) {
1442
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
1443
+ if(this.placeholder[0].parentNode) {
1444
+ this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
1445
+ }
1446
+ if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
1447
+ this.helper.remove();
1448
+ }
1449
+
1450
+ $.extend(this, {
1451
+ helper: null,
1452
+ dragging: false,
1453
+ reverting: false,
1454
+ _noFinalSort: null
1455
+ });
1456
+
1457
+ if(this.domPosition.prev) {
1458
+ $(this.domPosition.prev).after(this.currentItem);
1459
+ } else {
1460
+ $(this.domPosition.parent).prepend(this.currentItem);
1461
+ }
1462
+ }
1463
+
1464
+ return this;
1465
+
1466
+ },
1467
+
1468
+ serialize: function(o) {
1469
+
1470
+ var items = this._getItemsAsjQuery(o && o.connected),
1471
+ str = [];
1472
+ o = o || {};
1473
+
1474
+ $(items).each(function() {
1475
+ var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
1476
+ if (res) {
1477
+ str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
1478
+ }
1479
+ });
1480
+
1481
+ if(!str.length && o.key) {
1482
+ str.push(o.key + "=");
1483
+ }
1484
+
1485
+ return str.join("&");
1486
+
1487
+ },
1488
+
1489
+ toArray: function(o) {
1490
+
1491
+ var items = this._getItemsAsjQuery(o && o.connected),
1492
+ ret = [];
1493
+
1494
+ o = o || {};
1495
+
1496
+ items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
1497
+ return ret;
1498
+
1499
+ },
1500
+
1501
+ /* Be careful with the following core functions */
1502
+ _intersectsWith: function(item) {
1503
+
1504
+ var x1 = this.positionAbs.left,
1505
+ x2 = x1 + this.helperProportions.width,
1506
+ y1 = this.positionAbs.top,
1507
+ y2 = y1 + this.helperProportions.height,
1508
+ l = item.left,
1509
+ r = l + item.width,
1510
+ t = item.top,
1511
+ b = t + item.height,
1512
+ dyClick = this.offset.click.top,
1513
+ dxClick = this.offset.click.left,
1514
+ isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
1515
+ isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
1516
+ isOverElement = isOverElementHeight && isOverElementWidth;
1517
+
1518
+ if ( this.options.tolerance === "pointer" ||
1519
+ this.options.forcePointerForContainers ||
1520
+ (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
1521
+ ) {
1522
+ return isOverElement;
1523
+ } else {
1524
+
1525
+ return (l < x1 + (this.helperProportions.width / 2) && // Right Half
1526
+ x2 - (this.helperProportions.width / 2) < r && // Left Half
1527
+ t < y1 + (this.helperProportions.height / 2) && // Bottom Half
1528
+ y2 - (this.helperProportions.height / 2) < b ); // Top Half
1529
+
1530
+ }
1531
+ },
1532
+
1533
+ _intersectsWithPointer: function(item) {
1534
+
1535
+ var isOverElementHeight = (this.options.axis === "x") || isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
1536
+ isOverElementWidth = (this.options.axis === "y") || isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
1537
+ isOverElement = isOverElementHeight && isOverElementWidth,
1538
+ verticalDirection = this._getDragVerticalDirection(),
1539
+ horizontalDirection = this._getDragHorizontalDirection();
1540
+
1541
+ if (!isOverElement) {
1542
+ return false;
1543
+ }
1544
+
1545
+ return this.floating ?
1546
+ ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
1547
+ : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
1548
+
1549
+ },
1550
+
1551
+ _intersectsWithSides: function(item) {
1552
+
1553
+ var isOverBottomHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
1554
+ isOverRightHalf = isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
1555
+ verticalDirection = this._getDragVerticalDirection(),
1556
+ horizontalDirection = this._getDragHorizontalDirection();
1557
+
1558
+ if (this.floating && horizontalDirection) {
1559
+ return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
1560
+ } else {
1561
+ return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
1562
+ }
1563
+
1564
+ },
1565
+
1566
+ _getDragVerticalDirection: function() {
1567
+ var delta = this.positionAbs.top - this.lastPositionAbs.top;
1568
+ return delta !== 0 && (delta > 0 ? "down" : "up");
1569
+ },
1570
+
1571
+ _getDragHorizontalDirection: function() {
1572
+ var delta = this.positionAbs.left - this.lastPositionAbs.left;
1573
+ return delta !== 0 && (delta > 0 ? "right" : "left");
1574
+ },
1575
+
1576
+ refresh: function(event) {
1577
+ this._refreshItems(event);
1578
+ this.refreshPositions();
1579
+ return this;
1580
+ },
1581
+
1582
+ _connectWith: function() {
1583
+ var options = this.options;
1584
+ return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
1585
+ },
1586
+
1587
+ _getItemsAsjQuery: function(connected) {
1588
+
1589
+ var i, j, cur, inst,
1590
+ items = [],
1591
+ queries = [],
1592
+ connectWith = this._connectWith();
1593
+
1594
+ if(connectWith && connected) {
1595
+ for (i = connectWith.length - 1; i >= 0; i--){
1596
+ cur = $(connectWith[i]);
1597
+ for ( j = cur.length - 1; j >= 0; j--){
1598
+ inst = $.data(cur[j], this.widgetFullName);
1599
+ if(inst && inst !== this && !inst.options.disabled) {
1600
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
1601
+ }
1602
+ }
1603
+ }
1604
+ }
1605
+
1606
+ queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
1607
+
1608
+ function addItems() {
1609
+ items.push( this );
1610
+ }
1611
+ for (i = queries.length - 1; i >= 0; i--){
1612
+ queries[i][0].each( addItems );
1613
+ }
1614
+
1615
+ return $(items);
1616
+
1617
+ },
1618
+
1619
+ _removeCurrentsFromItems: function() {
1620
+
1621
+ var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
1622
+
1623
+ this.items = $.grep(this.items, function (item) {
1624
+ for (var j=0; j < list.length; j++) {
1625
+ if(list[j] === item.item[0]) {
1626
+ return false;
1627
+ }
1628
+ }
1629
+ return true;
1630
+ });
1631
+
1632
+ },
1633
+
1634
+ _refreshItems: function(event) {
1635
+
1636
+ this.items = [];
1637
+ this.containers = [this];
1638
+
1639
+ var i, j, cur, inst, targetData, _queries, item, queriesLength,
1640
+ items = this.items,
1641
+ queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
1642
+ connectWith = this._connectWith();
1643
+
1644
+ if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
1645
+ for (i = connectWith.length - 1; i >= 0; i--){
1646
+ cur = $(connectWith[i]);
1647
+ for (j = cur.length - 1; j >= 0; j--){
1648
+ inst = $.data(cur[j], this.widgetFullName);
1649
+ if(inst && inst !== this && !inst.options.disabled) {
1650
+ queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
1651
+ this.containers.push(inst);
1652
+ }
1653
+ }
1654
+ }
1655
+ }
1656
+
1657
+ for (i = queries.length - 1; i >= 0; i--) {
1658
+ targetData = queries[i][1];
1659
+ _queries = queries[i][0];
1660
+
1661
+ for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
1662
+ item = $(_queries[j]);
1663
+
1664
+ item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
1665
+
1666
+ items.push({
1667
+ item: item,
1668
+ instance: targetData,
1669
+ width: 0, height: 0,
1670
+ left: 0, top: 0
1671
+ });
1672
+ }
1673
+ }
1674
+
1675
+ },
1676
+
1677
+ refreshPositions: function(fast) {
1678
+
1679
+ //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
1680
+ if(this.offsetParent && this.helper) {
1681
+ this.offset.parent = this._getParentOffset();
1682
+ }
1683
+
1684
+ var i, item, t, p;
1685
+
1686
+ for (i = this.items.length - 1; i >= 0; i--){
1687
+ item = this.items[i];
1688
+
1689
+ //We ignore calculating positions of all connected containers when we're not over them
1690
+ if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
1691
+ continue;
1692
+ }
1693
+
1694
+ t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
1695
+
1696
+ if (!fast) {
1697
+ item.width = t.outerWidth();
1698
+ item.height = t.outerHeight();
1699
+ }
1700
+
1701
+ p = t.offset();
1702
+ item.left = p.left;
1703
+ item.top = p.top;
1704
+ }
1705
+
1706
+ if(this.options.custom && this.options.custom.refreshContainers) {
1707
+ this.options.custom.refreshContainers.call(this);
1708
+ } else {
1709
+ for (i = this.containers.length - 1; i >= 0; i--){
1710
+ p = this.containers[i].element.offset();
1711
+ this.containers[i].containerCache.left = p.left;
1712
+ this.containers[i].containerCache.top = p.top;
1713
+ this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
1714
+ this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
1715
+ }
1716
+ }
1717
+
1718
+ return this;
1719
+ },
1720
+
1721
+ _createPlaceholder: function(that) {
1722
+ that = that || this;
1723
+ var className,
1724
+ o = that.options;
1725
+
1726
+ if(!o.placeholder || o.placeholder.constructor === String) {
1727
+ className = o.placeholder;
1728
+ o.placeholder = {
1729
+ element: function() {
1730
+
1731
+ var nodeName = that.currentItem[0].nodeName.toLowerCase(),
1732
+ element = $( "<" + nodeName + ">", that.document[0] )
1733
+ .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
1734
+ .removeClass("ui-sortable-helper");
1735
+
1736
+ if ( nodeName === "tr" ) {
1737
+ that.currentItem.children().each(function() {
1738
+ $( "<td>&#160;</td>", that.document[0] )
1739
+ .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
1740
+ .appendTo( element );
1741
+ });
1742
+ } else if ( nodeName === "img" ) {
1743
+ element.attr( "src", that.currentItem.attr( "src" ) );
1744
+ }
1745
+
1746
+ if ( !className ) {
1747
+ element.css( "visibility", "hidden" );
1748
+ }
1749
+
1750
+ return element;
1751
+ },
1752
+ update: function(container, p) {
1753
+
1754
+ // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
1755
+ // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
1756
+ if(className && !o.forcePlaceholderSize) {
1757
+ return;
1758
+ }
1759
+
1760
+ //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
1761
+ if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
1762
+ if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
1763
+ }
1764
+ };
1765
+ }
1766
+
1767
+ //Create the placeholder
1768
+ that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
1769
+
1770
+ //Append it after the actual current item
1771
+ that.currentItem.after(that.placeholder);
1772
+
1773
+ //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
1774
+ o.placeholder.update(that, that.placeholder);
1775
+
1776
+ },
1777
+
1778
+ _contactContainers: function(event) {
1779
+ var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, base, cur, nearBottom, floating,
1780
+ innermostContainer = null,
1781
+ innermostIndex = null;
1782
+
1783
+ // get innermost container that intersects with item
1784
+ for (i = this.containers.length - 1; i >= 0; i--) {
1785
+
1786
+ // never consider a container that's located within the item itself
1787
+ if($.contains(this.currentItem[0], this.containers[i].element[0])) {
1788
+ continue;
1789
+ }
1790
+
1791
+ if(this._intersectsWith(this.containers[i].containerCache)) {
1792
+
1793
+ // if we've already found a container and it's more "inner" than this, then continue
1794
+ if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
1795
+ continue;
1796
+ }
1797
+
1798
+ innermostContainer = this.containers[i];
1799
+ innermostIndex = i;
1800
+
1801
+ } else {
1802
+ // container doesn't intersect. trigger "out" event if necessary
1803
+ if(this.containers[i].containerCache.over) {
1804
+ this.containers[i]._trigger("out", event, this._uiHash(this));
1805
+ this.containers[i].containerCache.over = 0;
1806
+ }
1807
+ }
1808
+
1809
+ }
1810
+
1811
+ // if no intersecting containers found, return
1812
+ if(!innermostContainer) {
1813
+ return;
1814
+ }
1815
+
1816
+ // move the item into the container if it's not there already
1817
+ if(this.containers.length === 1) {
1818
+ if (!this.containers[innermostIndex].containerCache.over) {
1819
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
1820
+ this.containers[innermostIndex].containerCache.over = 1;
1821
+ }
1822
+ } else {
1823
+
1824
+ //When entering a new container, we will find the item with the least distance and append our item near it
1825
+ dist = 10000;
1826
+ itemWithLeastDistance = null;
1827
+ floating = innermostContainer.floating || isFloating(this.currentItem);
1828
+ posProperty = floating ? "left" : "top";
1829
+ sizeProperty = floating ? "width" : "height";
1830
+ base = this.positionAbs[posProperty] + this.offset.click[posProperty];
1831
+ for (j = this.items.length - 1; j >= 0; j--) {
1832
+ if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
1833
+ continue;
1834
+ }
1835
+ if(this.items[j].item[0] === this.currentItem[0]) {
1836
+ continue;
1837
+ }
1838
+ if (floating && !isOverAxis(this.positionAbs.top + this.offset.click.top, this.items[j].top, this.items[j].height)) {
1839
+ continue;
1840
+ }
1841
+ cur = this.items[j].item.offset()[posProperty];
1842
+ nearBottom = false;
1843
+ if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){
1844
+ nearBottom = true;
1845
+ cur += this.items[j][sizeProperty];
1846
+ }
1847
+
1848
+ if(Math.abs(cur - base) < dist) {
1849
+ dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
1850
+ this.direction = nearBottom ? "up": "down";
1851
+ }
1852
+ }
1853
+
1854
+ //Check if dropOnEmpty is enabled
1855
+ if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
1856
+ return;
1857
+ }
1858
+
1859
+ if(this.currentContainer === this.containers[innermostIndex]) {
1860
+ return;
1861
+ }
1862
+
1863
+ itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
1864
+ this._trigger("change", event, this._uiHash());
1865
+ this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
1866
+ this.currentContainer = this.containers[innermostIndex];
1867
+
1868
+ //Update the placeholder
1869
+ this.options.placeholder.update(this.currentContainer, this.placeholder);
1870
+
1871
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
1872
+ this.containers[innermostIndex].containerCache.over = 1;
1873
+ }
1874
+
1875
+
1876
+ },
1877
+
1878
+ _createHelper: function(event) {
1879
+
1880
+ var o = this.options,
1881
+ helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
1882
+
1883
+ //Add the helper to the DOM if that didn't happen already
1884
+ if(!helper.parents("body").length) {
1885
+ $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
1886
+ }
1887
+
1888
+ if(helper[0] === this.currentItem[0]) {
1889
+ this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
1890
+ }
1891
+
1892
+ if(!helper[0].style.width || o.forceHelperSize) {
1893
+ helper.width(this.currentItem.width());
1894
+ }
1895
+ if(!helper[0].style.height || o.forceHelperSize) {
1896
+ helper.height(this.currentItem.height());
1897
+ }
1898
+
1899
+ return helper;
1900
+
1901
+ },
1902
+
1903
+ _adjustOffsetFromHelper: function(obj) {
1904
+ if (typeof obj === "string") {
1905
+ obj = obj.split(" ");
1906
+ }
1907
+ if ($.isArray(obj)) {
1908
+ obj = {left: +obj[0], top: +obj[1] || 0};
1909
+ }
1910
+ if ("left" in obj) {
1911
+ this.offset.click.left = obj.left + this.margins.left;
1912
+ }
1913
+ if ("right" in obj) {
1914
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
1915
+ }
1916
+ if ("top" in obj) {
1917
+ this.offset.click.top = obj.top + this.margins.top;
1918
+ }
1919
+ if ("bottom" in obj) {
1920
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
1921
+ }
1922
+ },
1923
+
1924
+ _getParentOffset: function() {
1925
+
1926
+
1927
+ //Get the offsetParent and cache its position
1928
+ this.offsetParent = this.helper.offsetParent();
1929
+ var po = this.offsetParent.offset();
1930
+
1931
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
1932
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
1933
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
1934
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
1935
+ if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
1936
+ po.left += this.scrollParent.scrollLeft();
1937
+ po.top += this.scrollParent.scrollTop();
1938
+ }
1939
+
1940
+ // This needs to be actually done for all browsers, since pageX/pageY includes this information
1941
+ // with an ugly IE fix
1942
+ if( this.offsetParent[0] === document.body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
1943
+ po = { top: 0, left: 0 };
1944
+ }
1945
+
1946
+ return {
1947
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
1948
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
1949
+ };
1950
+
1951
+ },
1952
+
1953
+ _getRelativeOffset: function() {
1954
+
1955
+ if(this.cssPosition === "relative") {
1956
+ var p = this.currentItem.position();
1957
+ return {
1958
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
1959
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
1960
+ };
1961
+ } else {
1962
+ return { top: 0, left: 0 };
1963
+ }
1964
+
1965
+ },
1966
+
1967
+ _cacheMargins: function() {
1968
+ this.margins = {
1969
+ left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
1970
+ top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
1971
+ };
1972
+ },
1973
+
1974
+ _cacheHelperProportions: function() {
1975
+ this.helperProportions = {
1976
+ width: this.helper.outerWidth(),
1977
+ height: this.helper.outerHeight()
1978
+ };
1979
+ },
1980
+
1981
+ _setContainment: function() {
1982
+
1983
+ var ce, co, over,
1984
+ o = this.options;
1985
+ if(o.containment === "parent") {
1986
+ o.containment = this.helper[0].parentNode;
1987
+ }
1988
+ if(o.containment === "document" || o.containment === "window") {
1989
+ this.containment = [
1990
+ 0 - this.offset.relative.left - this.offset.parent.left,
1991
+ 0 - this.offset.relative.top - this.offset.parent.top,
1992
+ $(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left,
1993
+ ($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
1994
+ ];
1995
+ }
1996
+
1997
+ if(!(/^(document|window|parent)$/).test(o.containment)) {
1998
+ ce = $(o.containment)[0];
1999
+ co = $(o.containment).offset();
2000
+ over = ($(ce).css("overflow") !== "hidden");
2001
+
2002
+ this.containment = [
2003
+ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
2004
+ co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
2005
+ co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
2006
+ co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
2007
+ ];
2008
+ }
2009
+
2010
+ },
2011
+
2012
+ _convertPositionTo: function(d, pos) {
2013
+
2014
+ if(!pos) {
2015
+ pos = this.position;
2016
+ }
2017
+ var mod = d === "absolute" ? 1 : -1,
2018
+ scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
2019
+ scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
2020
+
2021
+ return {
2022
+ top: (
2023
+ pos.top + // The absolute mouse position
2024
+ this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
2025
+ this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
2026
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
2027
+ ),
2028
+ left: (
2029
+ pos.left + // The absolute mouse position
2030
+ this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
2031
+ this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
2032
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
2033
+ )
2034
+ };
2035
+
2036
+ },
2037
+
2038
+ _generatePosition: function(event) {
2039
+
2040
+ var top, left,
2041
+ o = this.options,
2042
+ pageX = event.pageX,
2043
+ pageY = event.pageY,
2044
+ scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
2045
+
2046
+ // This is another very weird special case that only happens for relative elements:
2047
+ // 1. If the css position is relative
2048
+ // 2. and the scroll parent is the document or similar to the offset parent
2049
+ // we have to refresh the relative offset during the scroll so there are no jumps
2050
+ if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) {
2051
+ this.offset.relative = this._getRelativeOffset();
2052
+ }
2053
+
2054
+ /*
2055
+ * - Position constraining -
2056
+ * Constrain the position to a mix of grid, containment.
2057
+ */
2058
+
2059
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
2060
+
2061
+ if(this.containment) {
2062
+ if(event.pageX - this.offset.click.left < this.containment[0]) {
2063
+ pageX = this.containment[0] + this.offset.click.left;
2064
+ }
2065
+ if(event.pageY - this.offset.click.top < this.containment[1]) {
2066
+ pageY = this.containment[1] + this.offset.click.top;
2067
+ }
2068
+ if(event.pageX - this.offset.click.left > this.containment[2]) {
2069
+ pageX = this.containment[2] + this.offset.click.left;
2070
+ }
2071
+ if(event.pageY - this.offset.click.top > this.containment[3]) {
2072
+ pageY = this.containment[3] + this.offset.click.top;
2073
+ }
2074
+ }
2075
+
2076
+ if(o.grid) {
2077
+ top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
2078
+ pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
2079
+
2080
+ left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
2081
+ pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
2082
+ }
2083
+
2084
+ }
2085
+
2086
+ return {
2087
+ top: (
2088
+ pageY - // The absolute mouse position
2089
+ this.offset.click.top - // Click offset (relative to the element)
2090
+ this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
2091
+ this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
2092
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
2093
+ ),
2094
+ left: (
2095
+ pageX - // The absolute mouse position
2096
+ this.offset.click.left - // Click offset (relative to the element)
2097
+ this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
2098
+ this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
2099
+ ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
2100
+ )
2101
+ };
2102
+
2103
+ },
2104
+
2105
+ _rearrange: function(event, i, a, hardRefresh) {
2106
+
2107
+ a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
2108
+
2109
+ //Various things done here to improve the performance:
2110
+ // 1. we create a setTimeout, that calls refreshPositions
2111
+ // 2. on the instance, we have a counter variable, that get's higher after every append
2112
+ // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
2113
+ // 4. this lets only the last addition to the timeout stack through
2114
+ this.counter = this.counter ? ++this.counter : 1;
2115
+ var counter = this.counter;
2116
+
2117
+ this._delay(function() {
2118
+ if(counter === this.counter) {
2119
+ this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
2120
+ }
2121
+ });
2122
+
2123
+ },
2124
+
2125
+ _clear: function(event, noPropagation) {
2126
+
2127
+ this.reverting = false;
2128
+ // We delay all events that have to be triggered to after the point where the placeholder has been removed and
2129
+ // everything else normalized again
2130
+ var i,
2131
+ delayedTriggers = [];
2132
+
2133
+ // We first have to update the dom position of the actual currentItem
2134
+ // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
2135
+ if(!this._noFinalSort && this.currentItem.parent().length) {
2136
+ this.placeholder.before(this.currentItem);
2137
+ }
2138
+ this._noFinalSort = null;
2139
+
2140
+ if(this.helper[0] === this.currentItem[0]) {
2141
+ for(i in this._storedCSS) {
2142
+ if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
2143
+ this._storedCSS[i] = "";
2144
+ }
2145
+ }
2146
+ this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
2147
+ } else {
2148
+ this.currentItem.show();
2149
+ }
2150
+
2151
+ if(this.fromOutside && !noPropagation) {
2152
+ delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
2153
+ }
2154
+ if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
2155
+ delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
2156
+ }
2157
+
2158
+ // Check if the items Container has Changed and trigger appropriate
2159
+ // events.
2160
+ if (this !== this.currentContainer) {
2161
+ if(!noPropagation) {
2162
+ delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
2163
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
2164
+ delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
2165
+ }
2166
+ }
2167
+
2168
+
2169
+ //Post events to containers
2170
+ function delayEvent( type, instance, container ) {
2171
+ return function( event ) {
2172
+ container._trigger( type, event, instance._uiHash( instance ) );
2173
+ };
2174
+ }
2175
+ for (i = this.containers.length - 1; i >= 0; i--){
2176
+ if (!noPropagation) {
2177
+ delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
2178
+ }
2179
+ if(this.containers[i].containerCache.over) {
2180
+ delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
2181
+ this.containers[i].containerCache.over = 0;
2182
+ }
2183
+ }
2184
+
2185
+ //Do what was originally in plugins
2186
+ if ( this.storedCursor ) {
2187
+ this.document.find( "body" ).css( "cursor", this.storedCursor );
2188
+ this.storedStylesheet.remove();
2189
+ }
2190
+ if(this._storedOpacity) {
2191
+ this.helper.css("opacity", this._storedOpacity);
2192
+ }
2193
+ if(this._storedZIndex) {
2194
+ this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
2195
+ }
2196
+
2197
+ this.dragging = false;
2198
+ if(this.cancelHelperRemoval) {
2199
+ if(!noPropagation) {
2200
+ this._trigger("beforeStop", event, this._uiHash());
2201
+ for (i=0; i < delayedTriggers.length; i++) {
2202
+ delayedTriggers[i].call(this, event);
2203
+ } //Trigger all delayed events
2204
+ this._trigger("stop", event, this._uiHash());
2205
+ }
2206
+
2207
+ this.fromOutside = false;
2208
+ return false;
2209
+ }
2210
+
2211
+ if(!noPropagation) {
2212
+ this._trigger("beforeStop", event, this._uiHash());
2213
+ }
2214
+
2215
+ //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
2216
+ this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
2217
+
2218
+ if(this.helper[0] !== this.currentItem[0]) {
2219
+ this.helper.remove();
2220
+ }
2221
+ this.helper = null;
2222
+
2223
+ if(!noPropagation) {
2224
+ for (i=0; i < delayedTriggers.length; i++) {
2225
+ delayedTriggers[i].call(this, event);
2226
+ } //Trigger all delayed events
2227
+ this._trigger("stop", event, this._uiHash());
2228
+ }
2229
+
2230
+ this.fromOutside = false;
2231
+ return true;
2232
+
2233
+ },
2234
+
2235
+ _trigger: function() {
2236
+ if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
2237
+ this.cancel();
2238
+ }
2239
+ },
2240
+
2241
+ _uiHash: function(_inst) {
2242
+ var inst = _inst || this;
2243
+ return {
2244
+ helper: inst.helper,
2245
+ placeholder: inst.placeholder || $([]),
2246
+ position: inst.position,
2247
+ originalPosition: inst.originalPosition,
2248
+ offset: inst.positionAbs,
2249
+ item: inst.currentItem,
2250
+ sender: _inst ? _inst.element : null
2251
+ };
2252
+ }
2253
+
2254
+ });
2255
+
2256
+ })(jQuery);