enju_leaf 1.3.5 → 2.0.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -4
  3. data/app/assets/javascripts/enju_leaf/application.js +12 -0
  4. data/app/assets/javascripts/{autocomplete_agent.js → enju_leaf/autocomplete_agent.js} +0 -0
  5. data/app/assets/javascripts/{menu.js → enju_leaf/menu.js} +0 -0
  6. data/app/assets/javascripts/enju_leaf/mobile.js +5 -0
  7. data/app/assets/javascripts/{portlets.js → enju_leaf/portlets.js} +0 -0
  8. data/app/assets/javascripts/{select_locale.js → enju_leaf/select_locale.js} +0 -0
  9. data/app/assets/stylesheets/{enju_leaf.css → enju_leaf/application.scss} +6 -6
  10. data/app/assets/stylesheets/{enju.css → enju_leaf/enju.css} +0 -0
  11. data/app/assets/stylesheets/{enju_mobile.css → enju_leaf/enju_mobile.css} +0 -0
  12. data/app/assets/stylesheets/{enju_print.css → enju_leaf/enju_print.css} +0 -0
  13. data/app/assets/stylesheets/{mobile.css → enju_leaf/mobile.css} +1 -1
  14. data/app/assets/stylesheets/{pagination.css → enju_leaf/pagination.css} +0 -0
  15. data/app/assets/stylesheets/{portlets.css → enju_leaf/portlets.css} +0 -0
  16. data/app/assets/stylesheets/{print.css → enju_leaf/print.css} +1 -1
  17. data/app/assets/stylesheets/{scaffold_modified.css → enju_leaf/scaffold_modified.css} +0 -0
  18. data/app/views/devise/registrations/edit.html.erb +1 -1
  19. data/app/views/layouts/application.html.erb +4 -4
  20. data/app/views/page/_include.html.erb +1 -1
  21. data/app/views/page/_index.html+phone.erb +1 -1
  22. data/app/views/page/_menu.html.erb +1 -1
  23. data/app/views/page/_mobile.html+phone.erb +2 -2
  24. data/app/views/page/about.en.html.erb +4 -4
  25. data/app/views/page/about.ja.html.erb +4 -4
  26. data/app/views/page/advanced_search.html.erb +5 -5
  27. data/app/views/page/configuration.html.erb +0 -2
  28. data/app/views/page/opensearch.xml.builder +2 -2
  29. data/config/initializers/mime_types.rb +1 -0
  30. data/config/locales/en.yml +0 -4
  31. data/config/locales/ja.yml +0 -4
  32. data/lib/enju_leaf/engine.rb +1 -1
  33. data/lib/enju_leaf/version.rb +1 -1
  34. data/lib/generators/enju_leaf/quick_install/quick_install_generator.rb +5 -2
  35. data/lib/generators/enju_leaf/setup/setup_generator.rb +22 -17
  36. data/lib/generators/enju_leaf/setup/templates/Procfile +2 -2
  37. data/lib/generators/enju_leaf/setup/templates/config/schedule.rb +2 -2
  38. data/lib/generators/enju_leaf/setup/templates/db/seeds.rb +0 -4
  39. data/lib/tasks/enju_leaf_tasks.rake +2 -5
  40. data/spec/acceptance/profile.rb +9 -0
  41. data/spec/controllers/page_controller_spec.rb +1 -1
  42. data/spec/dummy/app/assets/javascripts/application.js +3 -0
  43. data/spec/dummy/app/assets/stylesheets/application.css +1 -0
  44. data/spec/dummy/app/controllers/application_controller.rb +0 -1
  45. data/spec/dummy/bin/bundle +1 -1
  46. data/spec/dummy/bin/setup +1 -3
  47. data/spec/dummy/bin/update +4 -2
  48. data/spec/dummy/bin/yarn +3 -3
  49. data/spec/dummy/config/application.rb +3 -2
  50. data/spec/dummy/config/boot.rb +4 -9
  51. data/spec/dummy/config/cable.yml +10 -0
  52. data/spec/dummy/config/database.yml +70 -9
  53. data/spec/dummy/config/environments/development.rb +9 -2
  54. data/spec/dummy/config/environments/production.rb +7 -4
  55. data/spec/dummy/config/environments/test.rb +7 -1
  56. data/spec/dummy/config/initializers/assets.rb +1 -2
  57. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  58. data/spec/dummy/config/locales/en.yml +30 -2
  59. data/spec/dummy/config/puma.rb +34 -0
  60. data/spec/dummy/config/routes.rb +2 -58
  61. data/spec/dummy/config/spring.rb +6 -0
  62. data/spec/dummy/config/storage.yml +34 -0
  63. data/spec/dummy/config.ru +3 -2
  64. data/spec/dummy/db/development.sqlite3 +0 -0
  65. data/spec/dummy/db/migrate/005_create_manifestations.rb +3 -3
  66. data/spec/dummy/db/migrate/127_create_use_restrictions.rb +3 -7
  67. data/spec/dummy/db/migrate/132_create_circulation_statuses.rb +3 -7
  68. data/spec/dummy/db/migrate/149_create_message_templates.rb +3 -8
  69. data/spec/dummy/db/migrate/154_create_messages.rb +6 -14
  70. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +4 -4
  71. data/spec/dummy/db/migrate/20081025083323_create_countries.rb +6 -5
  72. data/spec/dummy/db/migrate/20081025083905_create_languages.rb +1 -0
  73. data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +1 -1
  74. data/spec/dummy/db/migrate/20090705212043_add_attachments_attachment_to_manifestation.rb +15 -0
  75. data/spec/dummy/db/migrate/20100606065209_create_user_has_roles.rb +2 -4
  76. data/spec/dummy/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +1 -1
  77. data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +1 -1
  78. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +1 -1
  79. data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +1 -0
  80. data/spec/dummy/db/migrate/20120129020544_add_budget_type_id_to_item.rb +1 -0
  81. data/spec/dummy/db/migrate/20120319120638_add_content_type_id_to_manifestation.rb +1 -0
  82. data/spec/dummy/db/migrate/20120415164821_add_attachment_meta_to_manifestation.rb +5 -0
  83. data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +1 -1
  84. data/spec/dummy/db/migrate/20130506175834_create_identifiers.rb +1 -1
  85. data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +4 -5
  86. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +4 -9
  87. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +4 -9
  88. data/spec/dummy/db/migrate/20140519170214_create_resource_import_file_transitions.rb +1 -1
  89. data/spec/dummy/db/migrate/20140519171220_create_import_request_transitions.rb +1 -1
  90. data/spec/dummy/db/migrate/20140524020735_create_agent_import_file_transitions.rb +1 -1
  91. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +1 -1
  92. data/spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb +1 -1
  93. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +1 -1
  94. data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +11 -0
  95. data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +11 -0
  96. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +1 -1
  97. data/spec/dummy/db/migrate/20160813191533_add_book_jacket_source_to_library_group.rb +1 -1
  98. data/spec/dummy/db/migrate/20160813191820_add_screenshot_generator_to_library_group.rb +1 -1
  99. data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
  100. data/spec/dummy/db/migrate/20160820004638_add_attachment_attachment_to_carrier_types.rb +11 -0
  101. data/spec/dummy/db/migrate/20170114174536_add_profile_id_to_user.rb +5 -0
  102. data/spec/dummy/db/migrate/20170116134107_create_issn_record_and_manifestations.rb +11 -0
  103. data/spec/dummy/db/migrate/20170116134120_create_isbn_record_and_manifestations.rb +11 -0
  104. data/spec/dummy/db/migrate/20171014084528_add_header_logo_to_library_group.rb +5 -0
  105. data/spec/dummy/db/migrate/20180107160726_add_constraints_to_most_recent_for_user_import_file_transitions.rb +13 -0
  106. data/spec/dummy/db/migrate/20180107160740_add_constraints_to_most_recent_for_user_export_file_transitions.rb +13 -0
  107. data/spec/dummy/db/migrate/20180107161311_add_constraints_to_most_recent_for_agent_import_file_transitions.rb +13 -0
  108. data/spec/dummy/db/migrate/20180107161331_add_constraints_to_most_recent_for_resource_import_file_transitions.rb +13 -0
  109. data/spec/dummy/db/migrate/20180107161347_add_constraints_to_most_recent_for_resource_export_file_transitions.rb +13 -0
  110. data/spec/dummy/db/migrate/20180107161410_add_constraints_to_most_recent_for_import_request_transitions.rb +13 -0
  111. data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +13 -0
  112. data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +13 -0
  113. data/spec/dummy/db/migrate/20181030072731_add_not_null_to_position_on_carrier_type.rb +14 -0
  114. data/spec/dummy/db/migrate/20190102034126_create_doi_records.rb +13 -0
  115. data/spec/dummy/db/migrate/20190208135957_create_active_storage_tables.active_storage.rb +27 -0
  116. data/spec/dummy/db/migrate/20190630113817_add_display_name_translations_to_library_group.rb +12 -0
  117. data/spec/dummy/db/migrate/20190630115523_add_login_banner_translations_to_library_group.rb +6 -0
  118. data/spec/dummy/db/migrate/20190630151446_add_display_name_translations_to_role.rb +5 -0
  119. data/spec/dummy/db/migrate/20190712163038_add_display_name_translations_to_carrier_type.rb +21 -0
  120. data/spec/dummy/db/schema.rb +265 -135
  121. data/spec/dummy/db/test.sqlite3 +0 -0
  122. data/spec/dummy/node_modules/jquery/AUTHORS.txt +278 -0
  123. data/spec/dummy/node_modules/jquery/LICENSE.txt +36 -0
  124. data/spec/dummy/node_modules/jquery/README.md +65 -0
  125. data/spec/dummy/node_modules/jquery/bower.json +14 -0
  126. data/spec/dummy/node_modules/jquery/dist/jquery.js +9814 -0
  127. data/spec/dummy/node_modules/jquery/dist/jquery.min.js +4 -0
  128. data/spec/dummy/node_modules/jquery/dist/jquery.min.map +1 -0
  129. data/spec/dummy/node_modules/jquery/external/sizzle/LICENSE.txt +36 -0
  130. data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.js +2143 -0
  131. data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.min.js +3 -0
  132. data/spec/dummy/node_modules/jquery/external/sizzle/dist/sizzle.min.map +1 -0
  133. data/spec/dummy/node_modules/jquery/package.json +84 -0
  134. data/spec/dummy/node_modules/jquery/src/ajax/jsonp.js +100 -0
  135. data/spec/dummy/node_modules/jquery/src/ajax/load.js +83 -0
  136. data/spec/dummy/node_modules/jquery/src/ajax/parseJSON.js +13 -0
  137. data/spec/dummy/node_modules/jquery/src/ajax/parseXML.js +27 -0
  138. data/spec/dummy/node_modules/jquery/src/ajax/script.js +68 -0
  139. data/spec/dummy/node_modules/jquery/src/ajax/var/location.js +3 -0
  140. data/spec/dummy/node_modules/jquery/src/ajax/var/nonce.js +5 -0
  141. data/spec/dummy/node_modules/jquery/src/ajax/var/rquery.js +3 -0
  142. data/spec/dummy/node_modules/jquery/src/ajax/xhr.js +167 -0
  143. data/spec/dummy/node_modules/jquery/src/ajax.js +845 -0
  144. data/spec/dummy/node_modules/jquery/src/attributes/attr.js +142 -0
  145. data/spec/dummy/node_modules/jquery/src/attributes/classes.js +177 -0
  146. data/spec/dummy/node_modules/jquery/src/attributes/prop.js +125 -0
  147. data/spec/dummy/node_modules/jquery/src/attributes/support.js +36 -0
  148. data/spec/dummy/node_modules/jquery/src/attributes/val.js +177 -0
  149. data/spec/dummy/node_modules/jquery/src/attributes.js +11 -0
  150. data/spec/dummy/node_modules/jquery/src/callbacks.js +232 -0
  151. data/spec/dummy/node_modules/jquery/src/core/access.js +65 -0
  152. data/spec/dummy/node_modules/jquery/src/core/init.js +134 -0
  153. data/spec/dummy/node_modules/jquery/src/core/parseHTML.js +41 -0
  154. data/spec/dummy/node_modules/jquery/src/core/ready.js +103 -0
  155. data/spec/dummy/node_modules/jquery/src/core/var/rsingleTag.js +5 -0
  156. data/spec/dummy/node_modules/jquery/src/core.js +494 -0
  157. data/spec/dummy/node_modules/jquery/src/css/addGetHookIf.js +24 -0
  158. data/spec/dummy/node_modules/jquery/src/css/adjustCSS.js +65 -0
  159. data/spec/dummy/node_modules/jquery/src/css/curCSS.js +60 -0
  160. data/spec/dummy/node_modules/jquery/src/css/defaultDisplay.js +72 -0
  161. data/spec/dummy/node_modules/jquery/src/css/hiddenVisibleSelectors.js +18 -0
  162. data/spec/dummy/node_modules/jquery/src/css/showHide.js +48 -0
  163. data/spec/dummy/node_modules/jquery/src/css/support.js +121 -0
  164. data/spec/dummy/node_modules/jquery/src/css/var/cssExpand.js +3 -0
  165. data/spec/dummy/node_modules/jquery/src/css/var/getStyles.js +15 -0
  166. data/spec/dummy/node_modules/jquery/src/css/var/isHidden.js +16 -0
  167. data/spec/dummy/node_modules/jquery/src/css/var/rmargin.js +3 -0
  168. data/spec/dummy/node_modules/jquery/src/css/var/rnumnonpx.js +5 -0
  169. data/spec/dummy/node_modules/jquery/src/css/var/swap.js +24 -0
  170. data/spec/dummy/node_modules/jquery/src/css.js +502 -0
  171. data/spec/dummy/node_modules/jquery/src/data/Data.js +200 -0
  172. data/spec/dummy/node_modules/jquery/src/data/var/acceptData.js +18 -0
  173. data/spec/dummy/node_modules/jquery/src/data/var/dataPriv.js +5 -0
  174. data/spec/dummy/node_modules/jquery/src/data/var/dataUser.js +5 -0
  175. data/spec/dummy/node_modules/jquery/src/data.js +187 -0
  176. data/spec/dummy/node_modules/jquery/src/deferred.js +158 -0
  177. data/spec/dummy/node_modules/jquery/src/deprecated.js +32 -0
  178. data/spec/dummy/node_modules/jquery/src/dimensions.js +54 -0
  179. data/spec/dummy/node_modules/jquery/src/effects/Tween.js +121 -0
  180. data/spec/dummy/node_modules/jquery/src/effects/animatedSelector.js +13 -0
  181. data/spec/dummy/node_modules/jquery/src/effects.js +629 -0
  182. data/spec/dummy/node_modules/jquery/src/event/ajax.js +20 -0
  183. data/spec/dummy/node_modules/jquery/src/event/alias.js +27 -0
  184. data/spec/dummy/node_modules/jquery/src/event/focusin.js +53 -0
  185. data/spec/dummy/node_modules/jquery/src/event/support.js +9 -0
  186. data/spec/dummy/node_modules/jquery/src/event/trigger.js +183 -0
  187. data/spec/dummy/node_modules/jquery/src/event.js +711 -0
  188. data/spec/dummy/node_modules/jquery/src/exports/amd.js +24 -0
  189. data/spec/dummy/node_modules/jquery/src/exports/global.js +26 -0
  190. data/spec/dummy/node_modules/jquery/src/intro.js +44 -0
  191. data/spec/dummy/node_modules/jquery/src/jquery.js +37 -0
  192. data/spec/dummy/node_modules/jquery/src/manipulation/_evalUrl.js +20 -0
  193. data/spec/dummy/node_modules/jquery/src/manipulation/buildFragment.js +102 -0
  194. data/spec/dummy/node_modules/jquery/src/manipulation/getAll.js +21 -0
  195. data/spec/dummy/node_modules/jquery/src/manipulation/setGlobalEval.js +20 -0
  196. data/spec/dummy/node_modules/jquery/src/manipulation/support.js +33 -0
  197. data/spec/dummy/node_modules/jquery/src/manipulation/var/rcheckableType.js +3 -0
  198. data/spec/dummy/node_modules/jquery/src/manipulation/var/rscriptType.js +3 -0
  199. data/spec/dummy/node_modules/jquery/src/manipulation/var/rtagName.js +3 -0
  200. data/spec/dummy/node_modules/jquery/src/manipulation/wrapMap.js +27 -0
  201. data/spec/dummy/node_modules/jquery/src/manipulation.js +481 -0
  202. data/spec/dummy/node_modules/jquery/src/offset.js +218 -0
  203. data/spec/dummy/node_modules/jquery/src/outro.js +2 -0
  204. data/spec/dummy/node_modules/jquery/src/queue/delay.js +22 -0
  205. data/spec/dummy/node_modules/jquery/src/queue.js +143 -0
  206. data/spec/dummy/node_modules/jquery/src/selector-native.js +211 -0
  207. data/spec/dummy/node_modules/jquery/src/selector-sizzle.js +14 -0
  208. data/spec/dummy/node_modules/jquery/src/selector.js +1 -0
  209. data/spec/dummy/node_modules/jquery/src/serialize.js +125 -0
  210. data/spec/dummy/node_modules/jquery/src/traversing/findFilter.js +100 -0
  211. data/spec/dummy/node_modules/jquery/src/traversing/var/dir.js +20 -0
  212. data/spec/dummy/node_modules/jquery/src/traversing/var/rneedsContext.js +6 -0
  213. data/spec/dummy/node_modules/jquery/src/traversing/var/siblings.js +15 -0
  214. data/spec/dummy/node_modules/jquery/src/traversing.js +175 -0
  215. data/spec/dummy/node_modules/jquery/src/var/arr.js +3 -0
  216. data/spec/dummy/node_modules/jquery/src/var/class2type.js +5 -0
  217. data/spec/dummy/node_modules/jquery/src/var/concat.js +5 -0
  218. data/spec/dummy/node_modules/jquery/src/var/document.js +3 -0
  219. data/spec/dummy/node_modules/jquery/src/var/documentElement.js +5 -0
  220. data/spec/dummy/node_modules/jquery/src/var/hasOwn.js +5 -0
  221. data/spec/dummy/node_modules/jquery/src/var/indexOf.js +5 -0
  222. data/spec/dummy/node_modules/jquery/src/var/pnum.js +3 -0
  223. data/spec/dummy/node_modules/jquery/src/var/push.js +5 -0
  224. data/spec/dummy/node_modules/jquery/src/var/rcssNum.js +7 -0
  225. data/spec/dummy/node_modules/jquery/src/var/rnotwhite.js +3 -0
  226. data/spec/dummy/node_modules/jquery/src/var/slice.js +5 -0
  227. data/spec/dummy/node_modules/jquery/src/var/support.js +5 -0
  228. data/spec/dummy/node_modules/jquery/src/var/toString.js +5 -0
  229. data/spec/dummy/node_modules/jquery/src/wrap.js +79 -0
  230. data/spec/dummy/package.json +5 -0
  231. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20141214-44379-1fdvvdb.txt +8 -0
  232. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20141225-67268-nerc4o.txt +8 -0
  233. data/spec/dummy/public/system/user_export_files/user_exports/000/000/003/original/user_export_file_20150123-14447-1lf8lc5.txt +8 -0
  234. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141214-44379-1exy9mg.txt +8 -0
  235. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-58343-ztcmne.txt +8 -0
  236. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-58490-hnqvxg.txt +8 -0
  237. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-58609-5iyax7.txt +8 -0
  238. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-58776-1e9gg8b.txt +8 -0
  239. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-58951-zfxzc6.txt +8 -0
  240. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-59095-l3yd2t.txt +8 -0
  241. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-59220-1mgboh1.txt +8 -0
  242. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-59533-1ie807t.txt +8 -0
  243. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-59716-m8uy9h.txt +8 -0
  244. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-59834-1fcv3ir.txt +8 -0
  245. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-59932-14y6v8m.txt +8 -0
  246. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-60422-ksg8ww.txt +8 -0
  247. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-60507-j2u5ra.txt +8 -0
  248. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-60619-2j2h65.txt +8 -0
  249. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-60822-1xdqwcc.txt +8 -0
  250. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-60925-4d4ce1.txt +8 -0
  251. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-61046-y4nspn.txt +8 -0
  252. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-62053-1qsuqzd.txt +8 -0
  253. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-62204-3quf6j.txt +8 -0
  254. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141217-62472-w05wkf.txt +8 -0
  255. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141218-67112-1viizrs.txt +8 -0
  256. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141218-67232-11tcrfq.txt +8 -0
  257. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141218-67342-1bajplt.txt +8 -0
  258. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141218-67475-gmnmq4.txt +8 -0
  259. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-74670-mxvkc6.txt +8 -0
  260. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-74954-1m11avl.txt +8 -0
  261. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-75054-1ac0xmz.txt +8 -0
  262. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-75135-1r3z1p.txt +8 -0
  263. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-75289-18xm9sx.txt +8 -0
  264. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-75372-1ab1rn4.txt +8 -0
  265. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-75612-14gavh8.txt +8 -0
  266. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-75709-xgjjja.txt +8 -0
  267. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-75832-uej6ye.txt +8 -0
  268. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-75905-13kbauv.txt +8 -0
  269. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-76001-13yt1kv.txt +8 -0
  270. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-76158-1pitds8.txt +8 -0
  271. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-76526-q0rb2j.txt +8 -0
  272. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-76848-ya95k2.txt +8 -0
  273. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-88475-165899e.txt +8 -0
  274. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-89902-paupo2.txt +8 -0
  275. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-90001-1eg9w1e.txt +8 -0
  276. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141220-90157-bcu8m7.txt +8 -0
  277. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141221-7985-u6s6l1.txt +8 -0
  278. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141224-44711-1amcibm.txt +8 -0
  279. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141224-44828-ap6n8d.txt +8 -0
  280. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-48701-14hbzl1.txt +8 -0
  281. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-49875-1pc6esj.txt +8 -0
  282. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-64608-1wo1bpq.txt +8 -0
  283. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-64763-daej3l.txt +8 -0
  284. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-65000-1a7srlh.txt +8 -0
  285. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-65196-ggad1c.txt +8 -0
  286. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-65273-tt5ev2.txt +8 -0
  287. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-65424-1d17hts.txt +8 -0
  288. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-65662-1gqvlj3.txt +8 -0
  289. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-65725-1qpz2tm.txt +8 -0
  290. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-65807-t7cfln.txt +8 -0
  291. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-65962-161pm01.txt +8 -0
  292. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-66069-h9ftv6.txt +8 -0
  293. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-66327-hsz0j4.txt +8 -0
  294. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20141225-67268-hqxt6v.txt +8 -0
  295. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20150119-54567-1exwx4r.txt +8 -0
  296. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20150120-80886-1whqn2s.txt +8 -0
  297. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20150120-81115-hlvwc4.txt +8 -0
  298. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20150121-86495-navftm.txt +8 -0
  299. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20150121-86986-894a3i.txt +8 -0
  300. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20150122-4492-vaml86.txt +8 -0
  301. data/spec/dummy/public/system/user_export_files/user_exports/000/000/004/original/user_export_file_20150123-14447-gy0ver.txt +8 -0
  302. data/spec/dummy/yarn.lock +8 -0
  303. data/spec/factories/agent.rb +1 -1
  304. data/spec/factories/library.rb +1 -1
  305. data/spec/factories/profile.rb +3 -3
  306. data/spec/factories/user.rb +25 -31
  307. data/spec/fixtures/carrier_types.yml +23 -24
  308. data/spec/fixtures/content_types.yml +78 -22
  309. data/spec/fixtures/libraries.yml +28 -31
  310. data/spec/fixtures/library_groups.yml +33 -16
  311. data/spec/fixtures/manifestations.yml +32 -27
  312. data/spec/fixtures/roles.yml +11 -12
  313. data/spec/fixtures/shelves.yml +14 -15
  314. data/spec/fixtures/user_groups.yml +9 -16
  315. data/spec/fixtures/user_has_roles.yml +2 -1
  316. data/spec/rails_helper.rb +11 -1
  317. data/spec/system/page_spec.rb +35 -0
  318. data/spec/views/page/configuration.html.erb_spec.rb +1 -1
  319. metadata +723 -337
  320. data/app/assets/javascripts/enju_leaf.js +0 -12
  321. data/app/assets/javascripts/mobile.js +0 -4
  322. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -25
  323. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +0 -22
  324. data/vendor/assets/javascripts/jquery.colorbox.js +0 -1105
  325. data/vendor/assets/javascripts/jquery.powertip.js +0 -1395
  326. data/vendor/assets/stylesheets/colorbox.css +0 -70
  327. data/vendor/assets/stylesheets/jquery.powertip.css +0 -105
@@ -1,1395 +0,0 @@
1
- /*!
2
- PowerTip v1.3.1 (2018-04-15)
3
- https://stevenbenner.github.io/jquery-powertip/
4
- Copyright (c) 2018 Steven Benner (http://stevenbenner.com/).
5
- Released under MIT license.
6
- https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt
7
- */
8
- (function(root, factory) {
9
- // support loading the plugin via common patterns
10
- if (typeof define === 'function' && define.amd) {
11
- // load the plugin as an amd module
12
- define([ 'jquery' ], factory);
13
- } else if (typeof module === 'object' && module.exports) {
14
- // load the plugin as a commonjs module
15
- module.exports = factory(require('jquery'));
16
- } else {
17
- // load the plugin as a global
18
- factory(root.jQuery);
19
- }
20
- }(this, function($) {
21
- // useful private variables
22
- var $document = $(document),
23
- $window = $(window),
24
- $body = $('body');
25
-
26
- // constants
27
- var DATA_DISPLAYCONTROLLER = 'displayController',
28
- DATA_HASACTIVEHOVER = 'hasActiveHover',
29
- DATA_FORCEDOPEN = 'forcedOpen',
30
- DATA_HASMOUSEMOVE = 'hasMouseMove',
31
- DATA_MOUSEONTOTIP = 'mouseOnToPopup',
32
- DATA_ORIGINALTITLE = 'originalTitle',
33
- DATA_POWERTIP = 'powertip',
34
- DATA_POWERTIPJQ = 'powertipjq',
35
- DATA_POWERTIPTARGET = 'powertiptarget',
36
- EVENT_NAMESPACE = '.powertip',
37
- RAD2DEG = 180 / Math.PI,
38
- MOUSE_EVENTS = [
39
- 'click',
40
- 'dblclick',
41
- 'mousedown',
42
- 'mouseup',
43
- 'mousemove',
44
- 'mouseover',
45
- 'mouseout',
46
- 'mouseenter',
47
- 'mouseleave',
48
- 'contextmenu'
49
- ];
50
-
51
- /**
52
- * Session data
53
- * Private properties global to all powerTip instances
54
- */
55
- var session = {
56
- elements: null,
57
- tooltips: null,
58
- isTipOpen: false,
59
- isFixedTipOpen: false,
60
- isClosing: false,
61
- tipOpenImminent: false,
62
- activeHover: null,
63
- currentX: 0,
64
- currentY: 0,
65
- previousX: 0,
66
- previousY: 0,
67
- desyncTimeout: null,
68
- closeDelayTimeout: null,
69
- mouseTrackingActive: false,
70
- delayInProgress: false,
71
- windowWidth: 0,
72
- windowHeight: 0,
73
- scrollTop: 0,
74
- scrollLeft: 0
75
- };
76
-
77
- /**
78
- * Collision enumeration
79
- * @enum {number}
80
- */
81
- var Collision = {
82
- none: 0,
83
- top: 1,
84
- bottom: 2,
85
- left: 4,
86
- right: 8
87
- };
88
-
89
- /**
90
- * Display hover tooltips on the matched elements.
91
- * @param {(Object|string)=} opts The options object to use for the plugin, or
92
- * the name of a method to invoke on the first matched element.
93
- * @param {*=} [arg] Argument for an invoked method (optional).
94
- * @return {jQuery} jQuery object for the matched selectors.
95
- */
96
- $.fn.powerTip = function(opts, arg) {
97
- var targetElements = this,
98
- options,
99
- tipController;
100
-
101
- // don't do any work if there were no matched elements
102
- if (!targetElements.length) {
103
- return targetElements;
104
- }
105
-
106
- // handle api method calls on the plugin, e.g. powerTip('hide')
107
- if ($.type(opts) === 'string' && $.powerTip[opts]) {
108
- return $.powerTip[opts].call(targetElements, targetElements, arg);
109
- }
110
-
111
- // extend options
112
- options = $.extend({}, $.fn.powerTip.defaults, opts);
113
-
114
- // handle repeated powerTip calls on the same element by destroying any
115
- // original instance hooked to it and replacing it with this call
116
- $.powerTip.destroy(targetElements);
117
-
118
- // instantiate the TooltipController for this instance
119
- tipController = new TooltipController(options);
120
-
121
- // hook mouse and viewport dimension tracking
122
- initTracking();
123
-
124
- // setup the elements
125
- targetElements.each(function elementSetup() {
126
- var $this = $(this),
127
- dataPowertip = $this.data(DATA_POWERTIP),
128
- dataElem = $this.data(DATA_POWERTIPJQ),
129
- dataTarget = $this.data(DATA_POWERTIPTARGET),
130
- title = $this.attr('title');
131
-
132
- // attempt to use title attribute text if there is no data-powertip,
133
- // data-powertipjq or data-powertiptarget. If we do use the title
134
- // attribute, delete the attribute so the browser will not show it
135
- if (!dataPowertip && !dataTarget && !dataElem && title) {
136
- $this.data(DATA_POWERTIP, title);
137
- $this.data(DATA_ORIGINALTITLE, title);
138
- $this.removeAttr('title');
139
- }
140
-
141
- // create hover controllers for each element
142
- $this.data(
143
- DATA_DISPLAYCONTROLLER,
144
- new DisplayController($this, options, tipController)
145
- );
146
- });
147
-
148
- // attach events to matched elements if the manual option is not enabled
149
- if (!options.manual) {
150
- // attach open events
151
- $.each(options.openEvents, function(idx, evt) {
152
- if ($.inArray(evt, options.closeEvents) > -1) {
153
- // event is in both openEvents and closeEvents, so toggle it
154
- targetElements.on(evt + EVENT_NAMESPACE, function elementToggle(event) {
155
- $.powerTip.toggle(this, event);
156
- });
157
- } else {
158
- targetElements.on(evt + EVENT_NAMESPACE, function elementOpen(event) {
159
- $.powerTip.show(this, event);
160
- });
161
- }
162
- });
163
-
164
- // attach close events
165
- $.each(options.closeEvents, function(idx, evt) {
166
- if ($.inArray(evt, options.openEvents) < 0) {
167
- targetElements.on(evt + EVENT_NAMESPACE, function elementClose(event) {
168
- // set immediate to true for any event without mouse info
169
- $.powerTip.hide(this, !isMouseEvent(event));
170
- });
171
- }
172
- });
173
-
174
- // attach escape key close event
175
- targetElements.on('keydown' + EVENT_NAMESPACE, function elementKeyDown(event) {
176
- // always close tooltip when the escape key is pressed
177
- if (event.keyCode === 27) {
178
- $.powerTip.hide(this, true);
179
- }
180
- });
181
- }
182
-
183
- // remember elements that the plugin is attached to
184
- session.elements = session.elements ? session.elements.add(targetElements) : targetElements;
185
-
186
- return targetElements;
187
- };
188
-
189
- /**
190
- * Default options for the powerTip plugin.
191
- */
192
- $.fn.powerTip.defaults = {
193
- fadeInTime: 200,
194
- fadeOutTime: 100,
195
- followMouse: false,
196
- popupId: 'powerTip',
197
- popupClass: null,
198
- intentSensitivity: 7,
199
- intentPollInterval: 100,
200
- closeDelay: 100,
201
- placement: 'n',
202
- smartPlacement: false,
203
- offset: 10,
204
- mouseOnToPopup: false,
205
- manual: false,
206
- openEvents: [ 'mouseenter', 'focus' ],
207
- closeEvents: [ 'mouseleave', 'blur' ]
208
- };
209
-
210
- /**
211
- * Default smart placement priority lists.
212
- * The first item in the array is the highest priority, the last is the lowest.
213
- * The last item is also the default, which will be used if all previous options
214
- * do not fit.
215
- */
216
- $.fn.powerTip.smartPlacementLists = {
217
- n: [ 'n', 'ne', 'nw', 's' ],
218
- e: [ 'e', 'ne', 'se', 'w', 'nw', 'sw', 'n', 's', 'e' ],
219
- s: [ 's', 'se', 'sw', 'n' ],
220
- w: [ 'w', 'nw', 'sw', 'e', 'ne', 'se', 'n', 's', 'w' ],
221
- nw: [ 'nw', 'w', 'sw', 'n', 's', 'se', 'nw' ],
222
- ne: [ 'ne', 'e', 'se', 'n', 's', 'sw', 'ne' ],
223
- sw: [ 'sw', 'w', 'nw', 's', 'n', 'ne', 'sw' ],
224
- se: [ 'se', 'e', 'ne', 's', 'n', 'nw', 'se' ],
225
- 'nw-alt': [ 'nw-alt', 'n', 'ne-alt', 'sw-alt', 's', 'se-alt', 'w', 'e' ],
226
- 'ne-alt': [ 'ne-alt', 'n', 'nw-alt', 'se-alt', 's', 'sw-alt', 'e', 'w' ],
227
- 'sw-alt': [ 'sw-alt', 's', 'se-alt', 'nw-alt', 'n', 'ne-alt', 'w', 'e' ],
228
- 'se-alt': [ 'se-alt', 's', 'sw-alt', 'ne-alt', 'n', 'nw-alt', 'e', 'w' ]
229
- };
230
-
231
- /**
232
- * Public API
233
- */
234
- $.powerTip = {
235
- /**
236
- * Attempts to show the tooltip for the specified element.
237
- * @param {jQuery|Element} element The element to open the tooltip for.
238
- * @param {jQuery.Event=} event jQuery event for hover intent and mouse
239
- * tracking (optional).
240
- * @return {jQuery|Element} The original jQuery object or DOM Element.
241
- */
242
- show: function apiShowTip(element, event) {
243
- // if we were given a mouse event then run the hover intent testing,
244
- // otherwise, simply show the tooltip asap
245
- if (isMouseEvent(event)) {
246
- trackMouse(event);
247
- session.previousX = event.pageX;
248
- session.previousY = event.pageY;
249
- $(element).data(DATA_DISPLAYCONTROLLER).show();
250
- } else {
251
- $(element).first().data(DATA_DISPLAYCONTROLLER).show(true, true);
252
- }
253
- return element;
254
- },
255
-
256
- /**
257
- * Repositions the tooltip on the element.
258
- * @param {jQuery|Element} element The element the tooltip is shown for.
259
- * @return {jQuery|Element} The original jQuery object or DOM Element.
260
- */
261
- reposition: function apiResetPosition(element) {
262
- $(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();
263
- return element;
264
- },
265
-
266
- /**
267
- * Attempts to close any open tooltips.
268
- * @param {(jQuery|Element)=} element The element with the tooltip that
269
- * should be closed (optional).
270
- * @param {boolean=} immediate Disable close delay (optional).
271
- * @return {jQuery|Element|undefined} The original jQuery object or DOM
272
- * Element, if one was specified.
273
- */
274
- hide: function apiCloseTip(element, immediate) {
275
- var displayController;
276
-
277
- // set immediate to true when no element is specified
278
- immediate = element ? immediate : true;
279
-
280
- // find the relevant display controller
281
- if (element) {
282
- displayController = $(element).first().data(DATA_DISPLAYCONTROLLER);
283
- } else if (session.activeHover) {
284
- displayController = session.activeHover.data(DATA_DISPLAYCONTROLLER);
285
- }
286
-
287
- // if found, hide the tip
288
- if (displayController) {
289
- displayController.hide(immediate);
290
- }
291
-
292
- return element;
293
- },
294
-
295
- /**
296
- * Toggles the tooltip for the specified element. This will open a closed
297
- * tooltip, or close an open tooltip.
298
- * @param {jQuery|Element} element The element with the tooltip that
299
- * should be toggled.
300
- * @param {jQuery.Event=} event jQuery event for hover intent and mouse
301
- * tracking (optional).
302
- * @return {jQuery|Element} The original jQuery object or DOM Element.
303
- */
304
- toggle: function apiToggle(element, event) {
305
- if (session.activeHover && session.activeHover.is(element)) {
306
- // tooltip for element is active, so close it
307
- $.powerTip.hide(element, !isMouseEvent(event));
308
- } else {
309
- // tooltip for element is not active, so open it
310
- $.powerTip.show(element, event);
311
- }
312
- return element;
313
- },
314
-
315
- /**
316
- * Destroy and roll back any powerTip() instance on the specified elements.
317
- * If no elements are specified then all elements that the plugin is
318
- * currently attached to will be rolled back.
319
- * @param {(jQuery|Element)=} element The element with the powerTip instance.
320
- * @return {jQuery|Element|undefined} The original jQuery object or DOM
321
- * Element, if one was specified.
322
- */
323
- destroy: function apiDestroy(element) {
324
- var $element = element ? $(element) : session.elements;
325
-
326
- // if the plugin is not hooked to any elements then there is no point
327
- // trying to destroy anything, or dealing with the possible errors
328
- if (!session.elements || session.elements.length === 0) {
329
- return element;
330
- }
331
-
332
- // if a tooltip is currently open for an element we are being asked to
333
- // destroy then it should be forced to close
334
- if (session.isTipOpen && !session.isClosing && $element.filter(session.activeHover).length > 0) {
335
- // if the tooltip is waiting to close then cancel that delay timer
336
- if (session.delayInProgress) {
337
- session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel();
338
- }
339
- // hide the tooltip, immediately
340
- $.powerTip.hide(session.activeHover, true);
341
- }
342
-
343
- // unhook events and destroy plugin changes to each element
344
- $element.off(EVENT_NAMESPACE).each(function destroy() {
345
- var $this = $(this),
346
- dataAttributes = [
347
- DATA_ORIGINALTITLE,
348
- DATA_DISPLAYCONTROLLER,
349
- DATA_HASACTIVEHOVER,
350
- DATA_FORCEDOPEN
351
- ];
352
-
353
- // revert title attribute
354
- if ($this.data(DATA_ORIGINALTITLE)) {
355
- $this.attr('title', $this.data(DATA_ORIGINALTITLE));
356
- dataAttributes.push(DATA_POWERTIP);
357
- }
358
-
359
- // remove data attributes
360
- $this.removeData(dataAttributes);
361
- });
362
-
363
- // remove destroyed element from active elements collection
364
- session.elements = session.elements.not($element);
365
-
366
- // if there are no active elements left then we will unhook all of the
367
- // events that we've bound code to and remove the tooltip elements
368
- if (session.elements.length === 0) {
369
- $window.off(EVENT_NAMESPACE);
370
- $document.off(EVENT_NAMESPACE);
371
- session.mouseTrackingActive = false;
372
- session.tooltips.remove();
373
- session.tooltips = null;
374
- }
375
-
376
- return element;
377
- }
378
- };
379
-
380
- // API aliasing
381
- $.powerTip.showTip = $.powerTip.show;
382
- $.powerTip.closeTip = $.powerTip.hide;
383
-
384
- /**
385
- * Creates a new CSSCoordinates object.
386
- * @private
387
- * @constructor
388
- */
389
- function CSSCoordinates() {
390
- var me = this;
391
-
392
- // initialize object properties
393
- me.top = 'auto';
394
- me.left = 'auto';
395
- me.right = 'auto';
396
- me.bottom = 'auto';
397
-
398
- /**
399
- * Set a property to a value.
400
- * @private
401
- * @param {string} property The name of the property.
402
- * @param {number} value The value of the property.
403
- */
404
- me.set = function(property, value) {
405
- if ($.isNumeric(value)) {
406
- me[property] = Math.round(value);
407
- }
408
- };
409
- }
410
-
411
- /**
412
- * Creates a new tooltip display controller.
413
- * @private
414
- * @constructor
415
- * @param {jQuery} element The element that this controller will handle.
416
- * @param {Object} options Options object containing settings.
417
- * @param {TooltipController} tipController The TooltipController object for
418
- * this instance.
419
- */
420
- function DisplayController(element, options, tipController) {
421
- var hoverTimer = null,
422
- myCloseDelay = null;
423
-
424
- /**
425
- * Begins the process of showing a tooltip.
426
- * @private
427
- * @param {boolean=} immediate Skip intent testing (optional).
428
- * @param {boolean=} forceOpen Ignore cursor position and force tooltip to
429
- * open (optional).
430
- */
431
- function openTooltip(immediate, forceOpen) {
432
- cancelTimer();
433
- if (!element.data(DATA_HASACTIVEHOVER)) {
434
- if (!immediate) {
435
- session.tipOpenImminent = true;
436
- hoverTimer = setTimeout(
437
- function intentDelay() {
438
- hoverTimer = null;
439
- checkForIntent();
440
- },
441
- options.intentPollInterval
442
- );
443
- } else {
444
- if (forceOpen) {
445
- element.data(DATA_FORCEDOPEN, true);
446
- }
447
- closeAnyDelayed();
448
- tipController.showTip(element);
449
- }
450
- } else {
451
- // cursor left and returned to this element, cancel close
452
- cancelClose();
453
- }
454
- }
455
-
456
- /**
457
- * Begins the process of closing a tooltip.
458
- * @private
459
- * @param {boolean=} disableDelay Disable close delay (optional).
460
- */
461
- function closeTooltip(disableDelay) {
462
- // if this instance already has a close delay in progress then halt it
463
- if (myCloseDelay) {
464
- myCloseDelay = session.closeDelayTimeout = clearTimeout(myCloseDelay);
465
- session.delayInProgress = false;
466
- }
467
- cancelTimer();
468
- session.tipOpenImminent = false;
469
- if (element.data(DATA_HASACTIVEHOVER)) {
470
- element.data(DATA_FORCEDOPEN, false);
471
- if (!disableDelay) {
472
- session.delayInProgress = true;
473
- session.closeDelayTimeout = setTimeout(
474
- function closeDelay() {
475
- session.closeDelayTimeout = null;
476
- tipController.hideTip(element);
477
- session.delayInProgress = false;
478
- myCloseDelay = null;
479
- },
480
- options.closeDelay
481
- );
482
- // save internal reference close delay id so we can check if the
483
- // active close delay belongs to this instance
484
- myCloseDelay = session.closeDelayTimeout;
485
- } else {
486
- tipController.hideTip(element);
487
- }
488
- }
489
- }
490
-
491
- /**
492
- * Checks mouse position to make sure that the user intended to hover on the
493
- * specified element before showing the tooltip.
494
- * @private
495
- */
496
- function checkForIntent() {
497
- // calculate mouse position difference
498
- var xDifference = Math.abs(session.previousX - session.currentX),
499
- yDifference = Math.abs(session.previousY - session.currentY),
500
- totalDifference = xDifference + yDifference;
501
-
502
- // check if difference has passed the sensitivity threshold
503
- if (totalDifference < options.intentSensitivity) {
504
- cancelClose();
505
- closeAnyDelayed();
506
- tipController.showTip(element);
507
- } else {
508
- // try again
509
- session.previousX = session.currentX;
510
- session.previousY = session.currentY;
511
- openTooltip();
512
- }
513
- }
514
-
515
- /**
516
- * Cancels active hover timer.
517
- * @private
518
- * @param {boolean=} stopClose Cancel any active close delay timer.
519
- */
520
- function cancelTimer(stopClose) {
521
- hoverTimer = clearTimeout(hoverTimer);
522
- // cancel the current close delay if the active close delay is for this
523
- // element or the stopClose argument is true
524
- if (session.closeDelayTimeout && myCloseDelay === session.closeDelayTimeout || stopClose) {
525
- cancelClose();
526
- }
527
- }
528
-
529
- /**
530
- * Cancels any active close delay timer.
531
- * @private
532
- */
533
- function cancelClose() {
534
- session.closeDelayTimeout = clearTimeout(session.closeDelayTimeout);
535
- session.delayInProgress = false;
536
- }
537
-
538
- /**
539
- * Asks any tooltips waiting on their close delay to close now.
540
- * @private
541
- */
542
- function closeAnyDelayed() {
543
- // if another element is waiting for its close delay then we should ask
544
- // it to close immediately so we can proceed without unexpected timeout
545
- // code being run during this tooltip's lifecycle
546
- if (session.delayInProgress && session.activeHover && !session.activeHover.is(element)) {
547
- session.activeHover.data(DATA_DISPLAYCONTROLLER).hide(true);
548
- }
549
- }
550
-
551
- /**
552
- * Repositions the tooltip on this element.
553
- * @private
554
- */
555
- function repositionTooltip() {
556
- tipController.resetPosition(element);
557
- }
558
-
559
- // expose the methods
560
- this.show = openTooltip;
561
- this.hide = closeTooltip;
562
- this.cancel = cancelTimer;
563
- this.resetPosition = repositionTooltip;
564
- }
565
-
566
- /**
567
- * Creates a new Placement Calculator.
568
- * @private
569
- * @constructor
570
- */
571
- function PlacementCalculator() {
572
- /**
573
- * Compute the CSS position to display a tooltip at the specified placement
574
- * relative to the specified element.
575
- * @private
576
- * @param {jQuery} element The element that the tooltip should target.
577
- * @param {string} placement The placement for the tooltip.
578
- * @param {number} tipWidth Width of the tooltip element in pixels.
579
- * @param {number} tipHeight Height of the tooltip element in pixels.
580
- * @param {number} offset Distance to offset tooltips in pixels.
581
- * @return {CSSCoordinates} A CSSCoordinates object with the position.
582
- */
583
- function computePlacementCoords(element, placement, tipWidth, tipHeight, offset) {
584
- var placementBase = placement.split('-')[0], // ignore 'alt' for corners
585
- coords = new CSSCoordinates(),
586
- position;
587
-
588
- if (isSvgElement(element)) {
589
- position = getSvgPlacement(element, placementBase);
590
- } else {
591
- position = getHtmlPlacement(element, placementBase);
592
- }
593
-
594
- // calculate the appropriate x and y position in the document
595
- switch (placement) {
596
- case 'n':
597
- coords.set('left', position.left - (tipWidth / 2));
598
- coords.set('bottom', session.windowHeight - position.top + offset);
599
- break;
600
- case 'e':
601
- coords.set('left', position.left + offset);
602
- coords.set('top', position.top - (tipHeight / 2));
603
- break;
604
- case 's':
605
- coords.set('left', position.left - (tipWidth / 2));
606
- coords.set('top', position.top + offset);
607
- break;
608
- case 'w':
609
- coords.set('top', position.top - (tipHeight / 2));
610
- coords.set('right', session.windowWidth - position.left + offset);
611
- break;
612
- case 'nw':
613
- coords.set('bottom', session.windowHeight - position.top + offset);
614
- coords.set('right', session.windowWidth - position.left - 20);
615
- break;
616
- case 'nw-alt':
617
- coords.set('left', position.left);
618
- coords.set('bottom', session.windowHeight - position.top + offset);
619
- break;
620
- case 'ne':
621
- coords.set('left', position.left - 20);
622
- coords.set('bottom', session.windowHeight - position.top + offset);
623
- break;
624
- case 'ne-alt':
625
- coords.set('bottom', session.windowHeight - position.top + offset);
626
- coords.set('right', session.windowWidth - position.left);
627
- break;
628
- case 'sw':
629
- coords.set('top', position.top + offset);
630
- coords.set('right', session.windowWidth - position.left - 20);
631
- break;
632
- case 'sw-alt':
633
- coords.set('left', position.left);
634
- coords.set('top', position.top + offset);
635
- break;
636
- case 'se':
637
- coords.set('left', position.left - 20);
638
- coords.set('top', position.top + offset);
639
- break;
640
- case 'se-alt':
641
- coords.set('top', position.top + offset);
642
- coords.set('right', session.windowWidth - position.left);
643
- break;
644
- }
645
-
646
- return coords;
647
- }
648
-
649
- /**
650
- * Finds the tooltip attachment point in the document for a HTML DOM element
651
- * for the specified placement.
652
- * @private
653
- * @param {jQuery} element The element that the tooltip should target.
654
- * @param {string} placement The placement for the tooltip.
655
- * @return {Object} An object with the top,left position values.
656
- */
657
- function getHtmlPlacement(element, placement) {
658
- var objectOffset = element.offset(),
659
- objectWidth = element.outerWidth(),
660
- objectHeight = element.outerHeight(),
661
- left,
662
- top;
663
-
664
- // calculate the appropriate x and y position in the document
665
- switch (placement) {
666
- case 'n':
667
- left = objectOffset.left + objectWidth / 2;
668
- top = objectOffset.top;
669
- break;
670
- case 'e':
671
- left = objectOffset.left + objectWidth;
672
- top = objectOffset.top + objectHeight / 2;
673
- break;
674
- case 's':
675
- left = objectOffset.left + objectWidth / 2;
676
- top = objectOffset.top + objectHeight;
677
- break;
678
- case 'w':
679
- left = objectOffset.left;
680
- top = objectOffset.top + objectHeight / 2;
681
- break;
682
- case 'nw':
683
- left = objectOffset.left;
684
- top = objectOffset.top;
685
- break;
686
- case 'ne':
687
- left = objectOffset.left + objectWidth;
688
- top = objectOffset.top;
689
- break;
690
- case 'sw':
691
- left = objectOffset.left;
692
- top = objectOffset.top + objectHeight;
693
- break;
694
- case 'se':
695
- left = objectOffset.left + objectWidth;
696
- top = objectOffset.top + objectHeight;
697
- break;
698
- }
699
-
700
- return {
701
- top: top,
702
- left: left
703
- };
704
- }
705
-
706
- /**
707
- * Finds the tooltip attachment point in the document for a SVG element for
708
- * the specified placement.
709
- * @private
710
- * @param {jQuery} element The element that the tooltip should target.
711
- * @param {string} placement The placement for the tooltip.
712
- * @return {Object} An object with the top,left position values.
713
- */
714
- function getSvgPlacement(element, placement) {
715
- var svgElement = element.closest('svg')[0],
716
- domElement = element[0],
717
- point = svgElement.createSVGPoint(),
718
- boundingBox = domElement.getBBox(),
719
- matrix = domElement.getScreenCTM(),
720
- halfWidth = boundingBox.width / 2,
721
- halfHeight = boundingBox.height / 2,
722
- placements = [],
723
- placementKeys = [ 'nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w' ],
724
- coords,
725
- rotation,
726
- steps,
727
- x;
728
-
729
- /**
730
- * Transform and append the current points to the placements list.
731
- * @private
732
- */
733
- function pushPlacement() {
734
- placements.push(point.matrixTransform(matrix));
735
- }
736
-
737
- // get bounding box corners and midpoints
738
- point.x = boundingBox.x;
739
- point.y = boundingBox.y;
740
- pushPlacement();
741
- point.x += halfWidth;
742
- pushPlacement();
743
- point.x += halfWidth;
744
- pushPlacement();
745
- point.y += halfHeight;
746
- pushPlacement();
747
- point.y += halfHeight;
748
- pushPlacement();
749
- point.x -= halfWidth;
750
- pushPlacement();
751
- point.x -= halfWidth;
752
- pushPlacement();
753
- point.y -= halfHeight;
754
- pushPlacement();
755
-
756
- // determine rotation
757
- if (placements[0].y !== placements[1].y || placements[0].x !== placements[7].x) {
758
- rotation = Math.atan2(matrix.b, matrix.a) * RAD2DEG;
759
- steps = Math.ceil(((rotation % 360) - 22.5) / 45);
760
- if (steps < 1) {
761
- steps += 8;
762
- }
763
- while (steps--) {
764
- placementKeys.push(placementKeys.shift());
765
- }
766
- }
767
-
768
- // find placement
769
- for (x = 0; x < placements.length; x++) {
770
- if (placementKeys[x] === placement) {
771
- coords = placements[x];
772
- break;
773
- }
774
- }
775
-
776
- return {
777
- top: coords.y + session.scrollTop,
778
- left: coords.x + session.scrollLeft
779
- };
780
- }
781
-
782
- // expose methods
783
- this.compute = computePlacementCoords;
784
- }
785
-
786
- /**
787
- * Creates a new tooltip controller.
788
- * @private
789
- * @constructor
790
- * @param {Object} options Options object containing settings.
791
- */
792
- function TooltipController(options) {
793
- var placementCalculator = new PlacementCalculator(),
794
- tipElement = $('#' + options.popupId);
795
-
796
- // build and append tooltip div if it does not already exist
797
- if (tipElement.length === 0) {
798
- tipElement = $('<div/>', { id: options.popupId });
799
- // grab body element if it was not populated when the script loaded
800
- // note: this hack exists solely for jsfiddle support
801
- if ($body.length === 0) {
802
- $body = $('body');
803
- }
804
- $body.append(tipElement);
805
- // remember the tooltip elements that the plugin has created
806
- session.tooltips = session.tooltips ? session.tooltips.add(tipElement) : tipElement;
807
- }
808
-
809
- // hook mousemove for cursor follow tooltips
810
- if (options.followMouse) {
811
- // only one positionTipOnCursor hook per tooltip element, please
812
- if (!tipElement.data(DATA_HASMOUSEMOVE)) {
813
- $document.on('mousemove' + EVENT_NAMESPACE, positionTipOnCursor);
814
- $window.on('scroll' + EVENT_NAMESPACE, positionTipOnCursor);
815
- tipElement.data(DATA_HASMOUSEMOVE, true);
816
- }
817
- }
818
-
819
- /**
820
- * Gives the specified element the active-hover state and queues up the
821
- * showTip function.
822
- * @private
823
- * @param {jQuery} element The element that the tooltip should target.
824
- */
825
- function beginShowTip(element) {
826
- element.data(DATA_HASACTIVEHOVER, true);
827
- // show tooltip, asap
828
- tipElement.queue(function queueTipInit(next) {
829
- showTip(element);
830
- next();
831
- });
832
- }
833
-
834
- /**
835
- * Shows the tooltip, as soon as possible.
836
- * @private
837
- * @param {jQuery} element The element that the tooltip should target.
838
- */
839
- function showTip(element) {
840
- var tipContent;
841
-
842
- // it is possible, especially with keyboard navigation, to move on to
843
- // another element with a tooltip during the queue to get to this point
844
- // in the code. if that happens then we need to not proceed or we may
845
- // have the fadeout callback for the last tooltip execute immediately
846
- // after this code runs, causing bugs.
847
- if (!element.data(DATA_HASACTIVEHOVER)) {
848
- return;
849
- }
850
-
851
- // if the tooltip is open and we got asked to open another one then the
852
- // old one is still in its fadeOut cycle, so wait and try again
853
- if (session.isTipOpen) {
854
- if (!session.isClosing) {
855
- hideTip(session.activeHover);
856
- }
857
- tipElement.delay(100).queue(function queueTipAgain(next) {
858
- showTip(element);
859
- next();
860
- });
861
- return;
862
- }
863
-
864
- // trigger powerTipPreRender event
865
- element.trigger('powerTipPreRender');
866
-
867
- // set tooltip content
868
- tipContent = getTooltipContent(element);
869
- if (tipContent) {
870
- tipElement.empty().append(tipContent);
871
- } else {
872
- // we have no content to display, give up
873
- return;
874
- }
875
-
876
- // trigger powerTipRender event
877
- element.trigger('powerTipRender');
878
-
879
- session.activeHover = element;
880
- session.isTipOpen = true;
881
-
882
- tipElement.data(DATA_MOUSEONTOTIP, options.mouseOnToPopup);
883
-
884
- // add custom class to tooltip element
885
- tipElement.addClass(options.popupClass);
886
-
887
- // set tooltip position
888
- // revert to static placement when the "force open" flag was set because
889
- // that flag means that we do not have accurate mouse position info
890
- if (!options.followMouse || element.data(DATA_FORCEDOPEN)) {
891
- positionTipOnElement(element);
892
- session.isFixedTipOpen = true;
893
- } else {
894
- positionTipOnCursor();
895
- }
896
-
897
- // close tooltip when clicking anywhere on the page, with the exception
898
- // of the tooltip's trigger element and any elements that are within a
899
- // tooltip that has 'mouseOnToPopup' option enabled
900
- // always enable this feature when the "force open" flag is set on a
901
- // followMouse tooltip because we reverted to static placement above
902
- if (!element.data(DATA_FORCEDOPEN) && !options.followMouse) {
903
- $document.on('click' + EVENT_NAMESPACE, function documentClick(event) {
904
- var target = event.target;
905
- if (target !== element[0]) {
906
- if (options.mouseOnToPopup) {
907
- if (target !== tipElement[0] && !$.contains(tipElement[0], target)) {
908
- $.powerTip.hide();
909
- }
910
- } else {
911
- $.powerTip.hide();
912
- }
913
- }
914
- });
915
- }
916
-
917
- // if we want to be able to mouse on to the tooltip then we need to
918
- // attach hover events to the tooltip that will cancel a close request
919
- // on mouseenter and start a new close request on mouseleave
920
- // only hook these listeners if we're not in manual mode
921
- if (options.mouseOnToPopup && !options.manual) {
922
- tipElement.on('mouseenter' + EVENT_NAMESPACE, function tipMouseEnter() {
923
- // check activeHover in case the mouse cursor entered the
924
- // tooltip during the fadeOut and close cycle
925
- if (session.activeHover) {
926
- session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel();
927
- }
928
- });
929
- tipElement.on('mouseleave' + EVENT_NAMESPACE, function tipMouseLeave() {
930
- // check activeHover in case the mouse cursor left the tooltip
931
- // during the fadeOut and close cycle
932
- if (session.activeHover) {
933
- session.activeHover.data(DATA_DISPLAYCONTROLLER).hide();
934
- }
935
- });
936
- }
937
-
938
- // fadein
939
- tipElement.fadeIn(options.fadeInTime, function fadeInCallback() {
940
- // start desync polling
941
- if (!session.desyncTimeout) {
942
- session.desyncTimeout = setInterval(closeDesyncedTip, 500);
943
- }
944
-
945
- // trigger powerTipOpen event
946
- element.trigger('powerTipOpen');
947
- });
948
- }
949
-
950
- /**
951
- * Hides the tooltip.
952
- * @private
953
- * @param {jQuery} element The element that the tooltip should target.
954
- */
955
- function hideTip(element) {
956
- // reset session
957
- session.isClosing = true;
958
- session.isTipOpen = false;
959
-
960
- // stop desync polling
961
- session.desyncTimeout = clearInterval(session.desyncTimeout);
962
-
963
- // reset element state
964
- element.data(DATA_HASACTIVEHOVER, false);
965
- element.data(DATA_FORCEDOPEN, false);
966
-
967
- // remove document click handler
968
- $document.off('click' + EVENT_NAMESPACE);
969
-
970
- // unbind the mouseOnToPopup events if they were set
971
- tipElement.off(EVENT_NAMESPACE);
972
-
973
- // fade out
974
- tipElement.fadeOut(options.fadeOutTime, function fadeOutCallback() {
975
- var coords = new CSSCoordinates();
976
-
977
- // reset session and tooltip element
978
- session.activeHover = null;
979
- session.isClosing = false;
980
- session.isFixedTipOpen = false;
981
- tipElement.removeClass();
982
-
983
- // support mouse-follow and fixed position tips at the same time by
984
- // moving the tooltip to the last cursor location after it is hidden
985
- coords.set('top', session.currentY + options.offset);
986
- coords.set('left', session.currentX + options.offset);
987
- tipElement.css(coords);
988
-
989
- // trigger powerTipClose event
990
- element.trigger('powerTipClose');
991
- });
992
- }
993
-
994
- /**
995
- * Moves the tooltip to the users mouse cursor.
996
- * @private
997
- */
998
- function positionTipOnCursor() {
999
- var tipWidth,
1000
- tipHeight,
1001
- coords,
1002
- collisions,
1003
- collisionCount;
1004
-
1005
- // to support having fixed tooltips on the same page as cursor tooltips,
1006
- // where both instances are referencing the same tooltip element, we
1007
- // need to keep track of the mouse position constantly, but we should
1008
- // only set the tip location if a fixed tip is not currently open, a tip
1009
- // open is imminent or active, and the tooltip element in question does
1010
- // have a mouse-follow using it.
1011
- if (!session.isFixedTipOpen && (session.isTipOpen || (session.tipOpenImminent && tipElement.data(DATA_HASMOUSEMOVE)))) {
1012
- // grab measurements
1013
- tipWidth = tipElement.outerWidth();
1014
- tipHeight = tipElement.outerHeight();
1015
- coords = new CSSCoordinates();
1016
-
1017
- // grab collisions
1018
- coords.set('top', session.currentY + options.offset);
1019
- coords.set('left', session.currentX + options.offset);
1020
- collisions = getViewportCollisions(
1021
- coords,
1022
- tipWidth,
1023
- tipHeight
1024
- );
1025
-
1026
- // handle tooltip view port collisions
1027
- if (collisions !== Collision.none) {
1028
- collisionCount = countFlags(collisions);
1029
- if (collisionCount === 1) {
1030
- // if there is only one collision (bottom or right) then
1031
- // simply constrain the tooltip to the view port
1032
- if (collisions === Collision.right) {
1033
- coords.set('left', session.scrollLeft + session.windowWidth - tipWidth);
1034
- } else if (collisions === Collision.bottom) {
1035
- coords.set('top', session.scrollTop + session.windowHeight - tipHeight);
1036
- }
1037
- } else {
1038
- // if the tooltip has more than one collision then it is
1039
- // trapped in the corner and should be flipped to get it out
1040
- // of the users way
1041
- coords.set('left', session.currentX - tipWidth - options.offset);
1042
- coords.set('top', session.currentY - tipHeight - options.offset);
1043
- }
1044
- }
1045
-
1046
- // position the tooltip
1047
- tipElement.css(coords);
1048
- }
1049
- }
1050
-
1051
- /**
1052
- * Sets the tooltip to the correct position relative to the specified target
1053
- * element. Based on options settings.
1054
- * @private
1055
- * @param {jQuery} element The element that the tooltip should target.
1056
- */
1057
- function positionTipOnElement(element) {
1058
- var priorityList,
1059
- finalPlacement;
1060
-
1061
- // when the followMouse option is enabled and the "force open" flag is
1062
- // set we revert to static positioning. since the developer may not have
1063
- // considered this scenario we should use smart placement
1064
- if (options.smartPlacement || (options.followMouse && element.data(DATA_FORCEDOPEN))) {
1065
- priorityList = $.fn.powerTip.smartPlacementLists[options.placement];
1066
-
1067
- // iterate over the priority list and use the first placement option
1068
- // that does not collide with the view port. if they all collide
1069
- // then the last placement in the list will be used.
1070
- $.each(priorityList, function(idx, pos) {
1071
- // place tooltip and find collisions
1072
- var collisions = getViewportCollisions(
1073
- placeTooltip(element, pos),
1074
- tipElement.outerWidth(),
1075
- tipElement.outerHeight()
1076
- );
1077
-
1078
- // update the final placement variable
1079
- finalPlacement = pos;
1080
-
1081
- // break if there were no collisions
1082
- return collisions !== Collision.none;
1083
- });
1084
- } else {
1085
- // if we're not going to use the smart placement feature then just
1086
- // compute the coordinates and do it
1087
- placeTooltip(element, options.placement);
1088
- finalPlacement = options.placement;
1089
- }
1090
-
1091
- // add placement as class for CSS arrows
1092
- tipElement.removeClass('w nw sw e ne se n s w se-alt sw-alt ne-alt nw-alt');
1093
- tipElement.addClass(finalPlacement);
1094
- }
1095
-
1096
- /**
1097
- * Sets the tooltip position to the appropriate values to show the tip at
1098
- * the specified placement. This function will iterate and test the tooltip
1099
- * to support elastic tooltips.
1100
- * @private
1101
- * @param {jQuery} element The element that the tooltip should target.
1102
- * @param {string} placement The placement for the tooltip.
1103
- * @return {CSSCoordinates} A CSSCoordinates object with the top, left, and
1104
- * right position values.
1105
- */
1106
- function placeTooltip(element, placement) {
1107
- var iterationCount = 0,
1108
- tipWidth,
1109
- tipHeight,
1110
- coords = new CSSCoordinates();
1111
-
1112
- // set the tip to 0,0 to get the full expanded width
1113
- coords.set('top', 0);
1114
- coords.set('left', 0);
1115
- tipElement.css(coords);
1116
-
1117
- // to support elastic tooltips we need to check for a change in the
1118
- // rendered dimensions after the tooltip has been positioned
1119
- do {
1120
- // grab the current tip dimensions
1121
- tipWidth = tipElement.outerWidth();
1122
- tipHeight = tipElement.outerHeight();
1123
-
1124
- // get placement coordinates
1125
- coords = placementCalculator.compute(
1126
- element,
1127
- placement,
1128
- tipWidth,
1129
- tipHeight,
1130
- options.offset
1131
- );
1132
-
1133
- // place the tooltip
1134
- tipElement.css(coords);
1135
- } while (
1136
- // sanity check: limit to 5 iterations, and...
1137
- ++iterationCount <= 5 &&
1138
- // try again if the dimensions changed after placement
1139
- (tipWidth !== tipElement.outerWidth() || tipHeight !== tipElement.outerHeight())
1140
- );
1141
-
1142
- return coords;
1143
- }
1144
-
1145
- /**
1146
- * Checks for a tooltip desync and closes the tooltip if one occurs.
1147
- * @private
1148
- */
1149
- function closeDesyncedTip() {
1150
- var isDesynced = false,
1151
- hasDesyncableCloseEvent = $.grep(
1152
- [ 'mouseleave', 'mouseout', 'blur', 'focusout' ],
1153
- function(eventType) {
1154
- return $.inArray(eventType, options.closeEvents) !== -1;
1155
- }
1156
- ).length > 0;
1157
-
1158
- // It is possible for the mouse cursor to leave an element without
1159
- // firing the mouseleave or blur event. This most commonly happens when
1160
- // the element is disabled under mouse cursor. If this happens it will
1161
- // result in a desynced tooltip because the tooltip was never asked to
1162
- // close. So we should periodically check for a desync situation and
1163
- // close the tip if such a situation arises.
1164
- if (session.isTipOpen && !session.isClosing && !session.delayInProgress && hasDesyncableCloseEvent) {
1165
- if (session.activeHover.data(DATA_HASACTIVEHOVER) === false || session.activeHover.is(':disabled')) {
1166
- // user moused onto another tip or active hover is disabled
1167
- isDesynced = true;
1168
- } else if (!isMouseOver(session.activeHover) && !session.activeHover.is(':focus') && !session.activeHover.data(DATA_FORCEDOPEN)) {
1169
- // hanging tip - have to test if mouse position is not over the
1170
- // active hover and not over a tooltip set to let the user
1171
- // interact with it.
1172
- // for keyboard navigation: this only counts if the element does
1173
- // not have focus.
1174
- // for tooltips opened via the api: we need to check if it has
1175
- // the forcedOpen flag.
1176
- if (tipElement.data(DATA_MOUSEONTOTIP)) {
1177
- if (!isMouseOver(tipElement)) {
1178
- isDesynced = true;
1179
- }
1180
- } else {
1181
- isDesynced = true;
1182
- }
1183
- }
1184
-
1185
- if (isDesynced) {
1186
- // close the desynced tip
1187
- hideTip(session.activeHover);
1188
- }
1189
- }
1190
- }
1191
-
1192
- // expose methods
1193
- this.showTip = beginShowTip;
1194
- this.hideTip = hideTip;
1195
- this.resetPosition = positionTipOnElement;
1196
- }
1197
-
1198
- /**
1199
- * Determine whether a jQuery object is an SVG element
1200
- * @private
1201
- * @param {jQuery} element The element to check
1202
- * @return {boolean} Whether this is an SVG element
1203
- */
1204
- function isSvgElement(element) {
1205
- return Boolean(window.SVGElement && element[0] instanceof SVGElement);
1206
- }
1207
-
1208
- /**
1209
- * Determines if the specified jQuery.Event object has mouse data.
1210
- * @private
1211
- * @param {jQuery.Event=} event The jQuery.Event object to test.
1212
- * @return {boolean} True if there is mouse data, otherwise false.
1213
- */
1214
- function isMouseEvent(event) {
1215
- return Boolean(event && $.inArray(event.type, MOUSE_EVENTS) > -1 &&
1216
- typeof event.pageX === 'number');
1217
- }
1218
-
1219
- /**
1220
- * Initializes the viewport dimension cache and hooks up the mouse position
1221
- * tracking and viewport dimension tracking events.
1222
- * Prevents attaching the events more than once.
1223
- * @private
1224
- */
1225
- function initTracking() {
1226
- if (!session.mouseTrackingActive) {
1227
- session.mouseTrackingActive = true;
1228
-
1229
- // grab the current viewport dimensions on load
1230
- getViewportDimensions();
1231
- $(getViewportDimensions);
1232
-
1233
- // hook mouse move tracking
1234
- $document.on('mousemove' + EVENT_NAMESPACE, trackMouse);
1235
-
1236
- // hook viewport dimensions tracking
1237
- $window.on('resize' + EVENT_NAMESPACE, trackResize);
1238
- $window.on('scroll' + EVENT_NAMESPACE, trackScroll);
1239
- }
1240
- }
1241
-
1242
- /**
1243
- * Updates the viewport dimensions cache.
1244
- * @private
1245
- */
1246
- function getViewportDimensions() {
1247
- session.scrollLeft = $window.scrollLeft();
1248
- session.scrollTop = $window.scrollTop();
1249
- session.windowWidth = $window.width();
1250
- session.windowHeight = $window.height();
1251
- }
1252
-
1253
- /**
1254
- * Updates the window size info in the viewport dimensions cache.
1255
- * @private
1256
- */
1257
- function trackResize() {
1258
- session.windowWidth = $window.width();
1259
- session.windowHeight = $window.height();
1260
- }
1261
-
1262
- /**
1263
- * Updates the scroll offset info in the viewport dimensions cache.
1264
- * @private
1265
- */
1266
- function trackScroll() {
1267
- var x = $window.scrollLeft(),
1268
- y = $window.scrollTop();
1269
- if (x !== session.scrollLeft) {
1270
- session.currentX += x - session.scrollLeft;
1271
- session.scrollLeft = x;
1272
- }
1273
- if (y !== session.scrollTop) {
1274
- session.currentY += y - session.scrollTop;
1275
- session.scrollTop = y;
1276
- }
1277
- }
1278
-
1279
- /**
1280
- * Saves the current mouse coordinates to the session object.
1281
- * @private
1282
- * @param {jQuery.Event} event The mousemove event for the document.
1283
- */
1284
- function trackMouse(event) {
1285
- session.currentX = event.pageX;
1286
- session.currentY = event.pageY;
1287
- }
1288
-
1289
- /**
1290
- * Tests if the mouse is currently over the specified element.
1291
- * @private
1292
- * @param {jQuery} element The element to check for hover.
1293
- * @return {boolean} True if the mouse is over the element, otherwise false.
1294
- */
1295
- function isMouseOver(element) {
1296
- // use getBoundingClientRect() because jQuery's width() and height()
1297
- // methods do not work with SVG elements
1298
- // compute width/height because those properties do not exist on the object
1299
- // returned by getBoundingClientRect() in older versions of IE
1300
- var elementPosition = element.offset(),
1301
- elementBox = element[0].getBoundingClientRect(),
1302
- elementWidth = elementBox.right - elementBox.left,
1303
- elementHeight = elementBox.bottom - elementBox.top;
1304
-
1305
- return session.currentX >= elementPosition.left &&
1306
- session.currentX <= elementPosition.left + elementWidth &&
1307
- session.currentY >= elementPosition.top &&
1308
- session.currentY <= elementPosition.top + elementHeight;
1309
- }
1310
-
1311
- /**
1312
- * Fetches the tooltip content from the specified element's data attributes.
1313
- * @private
1314
- * @param {jQuery} element The element to get the tooltip content for.
1315
- * @return {(string|jQuery|undefined)} The text/HTML string, jQuery object, or
1316
- * undefined if there was no tooltip content for the element.
1317
- */
1318
- function getTooltipContent(element) {
1319
- var tipText = element.data(DATA_POWERTIP),
1320
- tipObject = element.data(DATA_POWERTIPJQ),
1321
- tipTarget = element.data(DATA_POWERTIPTARGET),
1322
- targetElement,
1323
- content;
1324
-
1325
- if (tipText) {
1326
- if ($.isFunction(tipText)) {
1327
- tipText = tipText.call(element[0]);
1328
- }
1329
- content = tipText;
1330
- } else if (tipObject) {
1331
- if ($.isFunction(tipObject)) {
1332
- tipObject = tipObject.call(element[0]);
1333
- }
1334
- if (tipObject.length > 0) {
1335
- content = tipObject.clone(true, true);
1336
- }
1337
- } else if (tipTarget) {
1338
- targetElement = $('#' + tipTarget);
1339
- if (targetElement.length > 0) {
1340
- content = targetElement.html();
1341
- }
1342
- }
1343
-
1344
- return content;
1345
- }
1346
-
1347
- /**
1348
- * Finds any viewport collisions that an element (the tooltip) would have if it
1349
- * were absolutely positioned at the specified coordinates.
1350
- * @private
1351
- * @param {CSSCoordinates} coords Coordinates for the element.
1352
- * @param {number} elementWidth Width of the element in pixels.
1353
- * @param {number} elementHeight Height of the element in pixels.
1354
- * @return {number} Value with the collision flags.
1355
- */
1356
- function getViewportCollisions(coords, elementWidth, elementHeight) {
1357
- var viewportTop = session.scrollTop,
1358
- viewportLeft = session.scrollLeft,
1359
- viewportBottom = viewportTop + session.windowHeight,
1360
- viewportRight = viewportLeft + session.windowWidth,
1361
- collisions = Collision.none;
1362
-
1363
- if (coords.top < viewportTop || Math.abs(coords.bottom - session.windowHeight) - elementHeight < viewportTop) {
1364
- collisions |= Collision.top;
1365
- }
1366
- if (coords.top + elementHeight > viewportBottom || Math.abs(coords.bottom - session.windowHeight) > viewportBottom) {
1367
- collisions |= Collision.bottom;
1368
- }
1369
- if (coords.left < viewportLeft || coords.right + elementWidth > viewportRight) {
1370
- collisions |= Collision.left;
1371
- }
1372
- if (coords.left + elementWidth > viewportRight || coords.right < viewportLeft) {
1373
- collisions |= Collision.right;
1374
- }
1375
-
1376
- return collisions;
1377
- }
1378
-
1379
- /**
1380
- * Counts the number of bits set on a flags value.
1381
- * @param {number} value The flags value.
1382
- * @return {number} The number of bits that have been set.
1383
- */
1384
- function countFlags(value) {
1385
- var count = 0;
1386
- while (value) {
1387
- value &= value - 1;
1388
- count++;
1389
- }
1390
- return count;
1391
- }
1392
-
1393
- // return api for commonjs and amd environments
1394
- return $.powerTip;
1395
- }));