geoblacklight 2.2.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +212 -112
  3. data/.rubocop.yml +16 -14
  4. data/.rubocop_todo.yml +28 -151
  5. data/Gemfile +3 -8
  6. data/README.md +1 -1
  7. data/Rakefile +1 -0
  8. data/app/assets/images/blacklight/arrow-circle-down.svg +1 -2
  9. data/app/assets/images/blacklight/baruch-cuny.svg +1 -4
  10. data/app/assets/images/blacklight/berkeley.svg +1 -4
  11. data/app/assets/images/blacklight/book.svg +1 -4
  12. data/app/assets/images/blacklight/bookmark.svg +1 -4
  13. data/app/assets/images/blacklight/cd-rom.svg +1 -4
  14. data/app/assets/images/blacklight/chicago.svg +1 -4
  15. data/app/assets/images/blacklight/citation.svg +3 -0
  16. data/app/assets/images/blacklight/collection.svg +3 -0
  17. data/app/assets/images/blacklight/columbia.svg +1 -4
  18. data/app/assets/images/blacklight/cornell.svg +1 -4
  19. data/app/assets/images/blacklight/dvd-rom.svg +1 -4
  20. data/app/assets/images/blacklight/email.svg +1 -4
  21. data/app/assets/images/blacklight/esri-globe.svg +1 -4
  22. data/app/assets/images/blacklight/globe.svg +1 -2
  23. data/app/assets/images/blacklight/harvard.svg +1 -4
  24. data/app/assets/images/blacklight/home.svg +1 -2
  25. data/app/assets/images/blacklight/illinois.svg +1 -4
  26. data/app/assets/images/blacklight/image.svg +1 -4
  27. data/app/assets/images/blacklight/indiana.svg +1 -4
  28. data/app/assets/images/blacklight/iowa.svg +1 -4
  29. data/app/assets/images/blacklight/leaf.svg +1 -4
  30. data/app/assets/images/blacklight/lewis-clark.svg +1 -4
  31. data/app/assets/images/blacklight/line.svg +1 -4
  32. data/app/assets/images/blacklight/map-marker.svg +1 -4
  33. data/app/assets/images/blacklight/map.svg +1 -4
  34. data/app/assets/images/blacklight/maryland.svg +1 -4
  35. data/app/assets/images/blacklight/massgis.svg +1 -4
  36. data/app/assets/images/blacklight/metadata.svg +1 -4
  37. data/app/assets/images/blacklight/michigan-state.svg +1 -4
  38. data/app/assets/images/blacklight/michigan.svg +1 -4
  39. data/app/assets/images/blacklight/minnesota.svg +1 -4
  40. data/app/assets/images/blacklight/mit.svg +1 -4
  41. data/app/assets/images/blacklight/mixed.svg +1 -4
  42. data/app/assets/images/blacklight/multilinestring.svg +1 -4
  43. data/app/assets/images/blacklight/multipoint.svg +1 -4
  44. data/app/assets/images/blacklight/multipolygon.svg +1 -4
  45. data/app/assets/images/blacklight/nyu.svg +1 -4
  46. data/app/assets/images/blacklight/ohio-state.svg +1 -4
  47. data/app/assets/images/blacklight/pagelines-brands.svg +1 -4
  48. data/app/assets/images/blacklight/paper-map.svg +1 -4
  49. data/app/assets/images/blacklight/penn-state.svg +1 -4
  50. data/app/assets/images/blacklight/point.svg +1 -4
  51. data/app/assets/images/blacklight/polygon.svg +1 -4
  52. data/app/assets/images/blacklight/polyline.svg +1 -4
  53. data/app/assets/images/blacklight/princeton.svg +1 -4
  54. data/app/assets/images/blacklight/public.svg +1 -4
  55. data/app/assets/images/blacklight/purdue.svg +1 -4
  56. data/app/assets/images/blacklight/raster.svg +1 -4
  57. data/app/assets/images/blacklight/restricted.svg +1 -4
  58. data/app/assets/images/blacklight/sms.svg +1 -4
  59. data/app/assets/images/blacklight/stanford.svg +1 -4
  60. data/app/assets/images/blacklight/table.svg +1 -4
  61. data/app/assets/images/blacklight/tags.svg +1 -2
  62. data/app/assets/images/blacklight/texas.svg +1 -4
  63. data/app/assets/images/blacklight/tufts.svg +1 -4
  64. data/app/assets/images/blacklight/ucla.svg +1 -4
  65. data/app/assets/images/blacklight/uva.svg +1 -4
  66. data/app/assets/images/blacklight/web_services.svg +1 -4
  67. data/app/assets/images/blacklight/wisconsin.svg +1 -4
  68. data/app/assets/javascripts/geoblacklight/basemaps.js +18 -0
  69. data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +1 -1
  70. data/app/assets/javascripts/geoblacklight/modules/geosearch.js +1 -1
  71. data/app/assets/javascripts/geoblacklight/modules/home.js +1 -1
  72. data/app/assets/javascripts/geoblacklight/modules/item.js +20 -1
  73. data/app/assets/javascripts/geoblacklight/modules/results.js +4 -2
  74. data/app/assets/javascripts/geoblacklight/modules/svg_tooltips.js +31 -0
  75. data/app/assets/javascripts/geoblacklight/viewers/esri.js +2 -2
  76. data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +1 -1
  77. data/app/assets/javascripts/geoblacklight/viewers/wms.js +2 -2
  78. data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +2 -0
  79. data/app/assets/stylesheets/geoblacklight/modules/_base.scss +33 -0
  80. data/app/assets/stylesheets/geoblacklight/{_blacklight_overrides.scss → modules/_blacklight_overrides.scss} +2 -11
  81. data/app/assets/stylesheets/geoblacklight/{_styles.scss → modules/_styles.scss} +1 -0
  82. data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +37 -54
  83. data/app/assets/stylesheets/geoblacklight/modules/item.scss +13 -0
  84. data/app/assets/stylesheets/geoblacklight/modules/results.scss +26 -29
  85. data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +12 -42
  86. data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +17 -59
  87. data/app/controllers/download_controller.rb +12 -12
  88. data/app/controllers/relation_controller.rb +1 -0
  89. data/app/controllers/wms_controller.rb +1 -0
  90. data/app/helpers/arcgis_helper.rb +1 -0
  91. data/app/helpers/blacklight_helper.rb +1 -0
  92. data/app/helpers/carto_helper.rb +1 -0
  93. data/app/helpers/geoblacklight_helper.rb +33 -71
  94. data/app/models/concerns/geoblacklight/solr_document.rb +15 -9
  95. data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +2 -1
  96. data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -13
  97. data/app/models/concerns/geoblacklight/solr_document/citation.rb +29 -0
  98. data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
  99. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +2 -1
  100. data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +3 -1
  101. data/app/presenters/geoblacklight/document_presenter.rb +2 -1
  102. data/app/views/catalog/_arcgis.html.erb +4 -0
  103. data/app/views/catalog/_carto.html.erb +4 -0
  104. data/app/views/catalog/_citation.html.erb +11 -0
  105. data/app/views/catalog/_data_dictionary.html.erb +1 -1
  106. data/app/views/catalog/_document_action.html.erb +1 -1
  107. data/app/views/catalog/_document_split.html.erb +1 -1
  108. data/app/views/catalog/_downloads_primary.html.erb +8 -1
  109. data/app/views/catalog/_header_icons.html.erb +3 -3
  110. data/app/views/catalog/_home_text.html.erb +4 -1
  111. data/app/views/catalog/_index_split_default.html.erb +22 -14
  112. data/app/views/catalog/_show_default_viewer_container.html.erb +1 -1
  113. data/app/views/catalog/_web_services_wfs.html.erb +3 -3
  114. data/app/views/catalog/_web_services_wms.html.erb +3 -3
  115. data/app/views/catalog/metadata.html.erb +3 -1
  116. data/app/views/catalog/web_services.html.erb +9 -7
  117. data/app/views/relation/_ancestors.html.erb +2 -5
  118. data/app/views/relation/_descendants.html.erb +3 -6
  119. data/app/views/relation/index.html.erb +20 -8
  120. data/app/views/relation/index.json.jbuilder +2 -1
  121. data/app/views/shared/_header_navbar.html.erb +1 -3
  122. data/bin/coverage.rb +36 -0
  123. data/config/initializers/rails_config.rb +1 -0
  124. data/config/locales/geoblacklight.en.yml +46 -61
  125. data/geoblacklight.gemspec +5 -8
  126. data/lib/generators/geoblacklight/assets_generator.rb +46 -0
  127. data/lib/generators/geoblacklight/install_generator.rb +8 -9
  128. data/lib/generators/geoblacklight/templates/assets/_blacklight.scss +1 -0
  129. data/lib/generators/geoblacklight/templates/assets/_customizations.scss +28 -0
  130. data/{app/assets/stylesheets/geoblacklight/application.scss → lib/generators/geoblacklight/templates/assets/_geoblacklight.scss} +0 -1
  131. data/lib/generators/geoblacklight/templates/assets/application.scss +7 -0
  132. data/lib/generators/geoblacklight/templates/{geoblacklight.js → assets/geoblacklight.js} +0 -1
  133. data/lib/generators/geoblacklight/templates/catalog_controller.rb +6 -2
  134. data/lib/generators/geoblacklight/templates/settings.yml +4 -6
  135. data/lib/generators/geoblacklight/webpacker_generator.rb +2 -1
  136. data/lib/geoblacklight.rb +1 -0
  137. data/lib/geoblacklight/bounding_box.rb +1 -0
  138. data/lib/geoblacklight/catalog_helper_override.rb +2 -1
  139. data/lib/geoblacklight/constants.rb +1 -0
  140. data/lib/geoblacklight/download.rb +6 -5
  141. data/lib/geoblacklight/download/geojson_download.rb +1 -0
  142. data/lib/geoblacklight/download/geotiff_download.rb +1 -0
  143. data/lib/geoblacklight/download/hgl_download.rb +1 -0
  144. data/lib/geoblacklight/download/kmz_download.rb +2 -1
  145. data/lib/geoblacklight/download/shapefile_download.rb +1 -0
  146. data/lib/geoblacklight/engine.rb +2 -2
  147. data/lib/geoblacklight/exceptions.rb +1 -0
  148. data/lib/geoblacklight/geoblacklight_helper_behavior.rb +1 -0
  149. data/lib/geoblacklight/item_viewer.rb +1 -0
  150. data/lib/geoblacklight/metadata.rb +1 -0
  151. data/lib/geoblacklight/metadata/base.rb +3 -2
  152. data/lib/geoblacklight/metadata/fgdc.rb +1 -0
  153. data/lib/geoblacklight/metadata/html.rb +2 -2
  154. data/lib/geoblacklight/metadata/iso19139.rb +1 -0
  155. data/lib/geoblacklight/metadata_transformer.rb +1 -0
  156. data/lib/geoblacklight/metadata_transformer/base.rb +1 -0
  157. data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
  158. data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
  159. data/lib/geoblacklight/reference.rb +1 -0
  160. data/lib/geoblacklight/references.rb +7 -3
  161. data/lib/geoblacklight/relation/ancestors.rb +2 -1
  162. data/lib/geoblacklight/relation/descendants.rb +2 -1
  163. data/lib/geoblacklight/relation/relation_response.rb +2 -1
  164. data/lib/geoblacklight/routes.rb +1 -0
  165. data/lib/geoblacklight/routes/downloadable.rb +1 -0
  166. data/lib/geoblacklight/routes/exportable.rb +1 -0
  167. data/lib/geoblacklight/routes/wms.rb +1 -0
  168. data/lib/geoblacklight/version.rb +2 -1
  169. data/lib/geoblacklight/view_helper_override.rb +2 -1
  170. data/lib/geoblacklight/wms_layer.rb +3 -2
  171. data/lib/geoblacklight/wms_layer/feature_info_response.rb +1 -0
  172. data/lib/tasks/geoblacklight.rake +33 -32
  173. data/solr/conf/schema.xml +5 -5
  174. data/spec/controllers/catalog_controller_spec.rb +1 -0
  175. data/spec/controllers/download_controller_spec.rb +2 -1
  176. data/spec/controllers/relation_controller_spec.rb +1 -0
  177. data/spec/controllers/wms_controller_spec.rb +2 -1
  178. data/spec/factories/user.rb +1 -0
  179. data/spec/features/bookmarks_spec.rb +1 -0
  180. data/spec/features/configurable_basemap_spec.rb +10 -0
  181. data/spec/features/data_dictionary_download_spec.rb +1 -0
  182. data/spec/features/download_layer_spec.rb +1 -0
  183. data/spec/features/empty_search_spec.rb +1 -0
  184. data/spec/features/esri_viewer_spec.rb +1 -6
  185. data/spec/features/exports_spec.rb +4 -12
  186. data/spec/features/help_text_spec.rb +1 -0
  187. data/spec/features/home_page_spec.rb +6 -0
  188. data/spec/features/iiif_viewer_spec.rb +1 -0
  189. data/spec/features/index_map_spec.rb +1 -0
  190. data/spec/features/layer_inspection_spec.rb +1 -0
  191. data/spec/features/layer_opacity_spec.rb +1 -0
  192. data/spec/features/layer_preview_spec.rb +1 -0
  193. data/spec/features/layer_with_no_references_spec.rb +1 -0
  194. data/spec/features/linkified_attribute_table_spec.rb +1 -0
  195. data/spec/features/metadata_panel_spec.rb +1 -0
  196. data/spec/features/missing_metadata_spec.rb +13 -0
  197. data/spec/features/multiple_downloads_spec.rb +15 -0
  198. data/spec/features/oembed_spec.rb +1 -0
  199. data/spec/features/relations_spec.rb +10 -28
  200. data/spec/features/saved_searches_spec.rb +1 -0
  201. data/spec/features/search_bar_spec.rb +1 -0
  202. data/spec/features/search_results_map_spec.rb +1 -6
  203. data/spec/features/search_results_overlap_ratio_spec.rb +4 -3
  204. data/spec/features/search_spec.rb +1 -0
  205. data/spec/features/show_page_metadata_spec.rb +1 -0
  206. data/spec/features/sms_spec.rb +1 -0
  207. data/spec/features/split_view.html.erb_spec.rb +4 -3
  208. data/spec/features/suppressed_records_spec.rb +1 -0
  209. data/spec/features/web_services_modal_spec.rb +1 -0
  210. data/spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json +30 -0
  211. data/spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json +17 -0
  212. data/spec/fixtures/solr_documents/metadata_no_solr_geom.json +23 -0
  213. data/spec/fixtures/solr_documents/multiple-downloads.json +30 -0
  214. data/spec/helpers/arcgis_helper_spec.rb +1 -0
  215. data/spec/helpers/carto_helper_spec.rb +1 -0
  216. data/spec/helpers/geoblacklight_helper_spec.rb +51 -5
  217. data/spec/javascripts/geoblacklight/viewers/esri/tiled_map_layer_spec.js +12 -0
  218. data/spec/javascripts/geoblacklight_spec.js +0 -4
  219. data/spec/lib/geoblacklight/bounding_box_spec.rb +1 -0
  220. data/spec/lib/geoblacklight/controller_override_spec.rb +1 -0
  221. data/spec/lib/geoblacklight/document_presenter_spec.rb +3 -2
  222. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -0
  223. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -0
  224. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -0
  225. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +1 -0
  226. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -0
  227. data/spec/lib/geoblacklight/download_spec.rb +4 -3
  228. data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +1 -0
  229. data/spec/lib/geoblacklight/item_viewer_spec.rb +1 -0
  230. data/spec/lib/geoblacklight/metadata/base_spec.rb +4 -3
  231. data/spec/lib/geoblacklight/metadata/html_spec.rb +1 -0
  232. data/spec/lib/geoblacklight/metadata_spec.rb +1 -0
  233. data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +3 -2
  234. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +3 -2
  235. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +3 -2
  236. data/spec/lib/geoblacklight/metadata_transformer_spec.rb +4 -3
  237. data/spec/lib/geoblacklight/reference_spec.rb +1 -0
  238. data/spec/lib/geoblacklight/references_spec.rb +2 -3
  239. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +2 -1
  240. data/spec/lib/geoblacklight/relation/descendants_spec.rb +2 -1
  241. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +1 -0
  242. data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
  243. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +5 -4
  244. data/spec/lib/geoblacklight/wms_layer_spec.rb +3 -2
  245. data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +1 -20
  246. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +14 -0
  247. data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +1 -0
  248. data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +1 -0
  249. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +27 -0
  250. data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +15 -2
  251. data/spec/routing/catalog_routing_spec.rb +1 -0
  252. data/spec/spec_helper.rb +12 -9
  253. data/spec/support/backport_test_helpers.rb +1 -0
  254. data/spec/support/features.rb +1 -0
  255. data/spec/support/features/session_helpers.rb +1 -0
  256. data/spec/support/fixtures.rb +8 -0
  257. data/spec/tasks/geoblacklight_spec.rb +19 -0
  258. data/spec/teaspoon_env.rb +1 -0
  259. data/spec/test_app_templates/Gemfile.extra +1 -0
  260. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -0
  261. data/spec/views/catalog/_document_split.html.erb_spec.rb +1 -0
  262. data/spec/views/catalog/_index_split.html.erb_spec.rb +1 -0
  263. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +1 -0
  264. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +1 -0
  265. data/spec/views/catalog/_show_tools.html.erb_spec.rb +2 -4
  266. data/template.rb +1 -0
  267. data/vendor/assets/stylesheets/leaflet.css +0 -1
  268. metadata +69 -79
  269. data/app/assets/images/blacklight/logo.png +0 -0
  270. data/app/assets/javascripts/geoblacklight/modules/collapse.js +0 -7
  271. data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +0 -36
  272. data/app/assets/stylesheets/geoblacklight/modules/relations.scss +0 -15
  273. data/app/views/catalog/_exports.html.erb +0 -3
  274. data/app/views/catalog/_show_tools.html.erb +0 -25
  275. data/lib/generators/geoblacklight/templates/geoblacklight.scss +0 -4
  276. data/vendor/assets/javascripts/readmore.js +0 -618
  277. data/vendor/assets/javascripts/readmore.js.map +0 -1
@@ -1,15 +0,0 @@
1
- .relations {
2
- @include sidebar-children;
3
-
4
- .list-group {
5
- .relations-ancestors {
6
- padding-left: 16px;
7
- padding-right: 16px;
8
- }
9
-
10
- .relations-descendants {
11
- padding-left: 16px;
12
- padding-right: 16px;
13
- }
14
- }
15
- }
@@ -1,3 +0,0 @@
1
- <% document ||= @document %>
2
- <%= display_carto %>
3
- <%= display_arcgis %>
@@ -1,25 +0,0 @@
1
- <%-
2
- # Compare with render_document_functions_partial helper, and
3
- # _document_functions partial. BL actually has two groups
4
- # of document-related tools. "document functions" by default
5
- # contains Bookmark functionality shown on both results and
6
- # item view. While "document tools" contains external export type
7
- # functions by default only on detail.
8
- -%>
9
- <% if show_doc_actions? %>
10
- <div class="card show-tools">
11
- <div class="card-header">
12
- <h2><%= t('blacklight.tools.title') %></h2>
13
- </div>
14
-
15
- <ul class="list-group list-group-flush">
16
- <%= render_show_doc_actions @document do |config, inner| %>
17
- <% if inner.present? %>
18
- <li class="list-group-item <%= config.key %>">
19
- <%= inner %>
20
- </li>
21
- <% end %>
22
- <% end %>
23
- </ul>
24
- </div>
25
- <% end %>
@@ -1,4 +0,0 @@
1
- /*
2
- *= require geoblacklight/application
3
- *= require leaflet-label
4
- */
@@ -1,618 +0,0 @@
1
- /*!
2
- * @preserve
3
- *
4
- * Readmore.js plugin
5
- * Author: @jed_foster
6
- * Project home: jedfoster.com/Readmore.js
7
- * Version: 3.0.0-beta-1
8
- * Licensed under the MIT license
9
- *
10
- * Debounce function from davidwalsh.name/javascript-debounce-function
11
- */
12
- (function webpackUniversalModuleDefinition(root, factory) {
13
- if(typeof exports === 'object' && typeof module === 'object')
14
- module.exports = factory();
15
- else if(typeof define === 'function' && define.amd)
16
- define("Readmore", [], factory);
17
- else if(typeof exports === 'object')
18
- exports["Readmore"] = factory();
19
- else
20
- root["Readmore"] = factory();
21
- })(window, function() {
22
- return /******/ (function(modules) { // webpackBootstrap
23
- /******/ // The module cache
24
- /******/ var installedModules = {};
25
- /******/
26
- /******/ // The require function
27
- /******/ function __webpack_require__(moduleId) {
28
- /******/
29
- /******/ // Check if module is in cache
30
- /******/ if(installedModules[moduleId]) {
31
- /******/ return installedModules[moduleId].exports;
32
- /******/ }
33
- /******/ // Create a new module (and put it into the cache)
34
- /******/ var module = installedModules[moduleId] = {
35
- /******/ i: moduleId,
36
- /******/ l: false,
37
- /******/ exports: {}
38
- /******/ };
39
- /******/
40
- /******/ // Execute the module function
41
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
42
- /******/
43
- /******/ // Flag the module as loaded
44
- /******/ module.l = true;
45
- /******/
46
- /******/ // Return the exports of the module
47
- /******/ return module.exports;
48
- /******/ }
49
- /******/
50
- /******/
51
- /******/ // expose the modules object (__webpack_modules__)
52
- /******/ __webpack_require__.m = modules;
53
- /******/
54
- /******/ // expose the module cache
55
- /******/ __webpack_require__.c = installedModules;
56
- /******/
57
- /******/ // define getter function for harmony exports
58
- /******/ __webpack_require__.d = function(exports, name, getter) {
59
- /******/ if(!__webpack_require__.o(exports, name)) {
60
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
61
- /******/ }
62
- /******/ };
63
- /******/
64
- /******/ // define __esModule on exports
65
- /******/ __webpack_require__.r = function(exports) {
66
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
67
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
68
- /******/ }
69
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
70
- /******/ };
71
- /******/
72
- /******/ // create a fake namespace object
73
- /******/ // mode & 1: value is a module id, require it
74
- /******/ // mode & 2: merge all properties of value into the ns
75
- /******/ // mode & 4: return value when already ns object
76
- /******/ // mode & 8|1: behave like require
77
- /******/ __webpack_require__.t = function(value, mode) {
78
- /******/ if(mode & 1) value = __webpack_require__(value);
79
- /******/ if(mode & 8) return value;
80
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
81
- /******/ var ns = Object.create(null);
82
- /******/ __webpack_require__.r(ns);
83
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
84
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
85
- /******/ return ns;
86
- /******/ };
87
- /******/
88
- /******/ // getDefaultExport function for compatibility with non-harmony modules
89
- /******/ __webpack_require__.n = function(module) {
90
- /******/ var getter = module && module.__esModule ?
91
- /******/ function getDefault() { return module['default']; } :
92
- /******/ function getModuleExports() { return module; };
93
- /******/ __webpack_require__.d(getter, 'a', getter);
94
- /******/ return getter;
95
- /******/ };
96
- /******/
97
- /******/ // Object.prototype.hasOwnProperty.call
98
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
99
- /******/
100
- /******/ // __webpack_public_path__
101
- /******/ __webpack_require__.p = "";
102
- /******/
103
- /******/
104
- /******/ // Load entry module and return exports
105
- /******/ return __webpack_require__(__webpack_require__.s = 0);
106
- /******/ })
107
- /************************************************************************/
108
- /******/ ({
109
-
110
- /***/ "./node_modules/@babel/runtime/helpers/classCallCheck.js":
111
- /*!***************************************************************!*\
112
- !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
113
- \***************************************************************/
114
- /*! no static exports found */
115
- /***/ (function(module, exports) {
116
-
117
- function _classCallCheck(instance, Constructor) {
118
- if (!(instance instanceof Constructor)) {
119
- throw new TypeError("Cannot call a class as a function");
120
- }
121
- }
122
-
123
- module.exports = _classCallCheck;
124
-
125
- /***/ }),
126
-
127
- /***/ "./node_modules/@babel/runtime/helpers/createClass.js":
128
- /*!************************************************************!*\
129
- !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
130
- \************************************************************/
131
- /*! no static exports found */
132
- /***/ (function(module, exports) {
133
-
134
- function _defineProperties(target, props) {
135
- for (var i = 0; i < props.length; i++) {
136
- var descriptor = props[i];
137
- descriptor.enumerable = descriptor.enumerable || false;
138
- descriptor.configurable = true;
139
- if ("value" in descriptor) descriptor.writable = true;
140
- Object.defineProperty(target, descriptor.key, descriptor);
141
- }
142
- }
143
-
144
- function _createClass(Constructor, protoProps, staticProps) {
145
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
146
- if (staticProps) _defineProperties(Constructor, staticProps);
147
- return Constructor;
148
- }
149
-
150
- module.exports = _createClass;
151
-
152
- /***/ }),
153
-
154
- /***/ "./node_modules/@babel/runtime/helpers/typeof.js":
155
- /*!*******************************************************!*\
156
- !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
157
- \*******************************************************/
158
- /*! no static exports found */
159
- /***/ (function(module, exports) {
160
-
161
- function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
162
-
163
- function _typeof(obj) {
164
- if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
165
- module.exports = _typeof = function _typeof(obj) {
166
- return _typeof2(obj);
167
- };
168
- } else {
169
- module.exports = _typeof = function _typeof(obj) {
170
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
171
- };
172
- }
173
-
174
- return _typeof(obj);
175
- }
176
-
177
- module.exports = _typeof;
178
-
179
- /***/ }),
180
-
181
- /***/ "./src/readmore.js":
182
- /*!*************************!*\
183
- !*** ./src/readmore.js ***!
184
- \*************************/
185
- /*! exports provided: default */
186
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
187
-
188
- "use strict";
189
- __webpack_require__.r(__webpack_exports__);
190
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js");
191
- /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
192
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js");
193
- /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
194
- /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
195
- /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_2__);
196
-
197
-
198
-
199
- var uniqueIdCounter = 0;
200
- var isCssEmbeddedFor = []; // from:https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md
201
-
202
- (function removePolyfill(arr) {
203
- arr.forEach(function (item) {
204
- if (Object.prototype.hasOwnProperty.call(item, 'remove')) {
205
- return;
206
- }
207
-
208
- Object.defineProperty(item, 'remove', {
209
- configurable: true,
210
- enumerable: true,
211
- writable: true,
212
- value: function remove() {
213
- if (this.parentNode !== null) {
214
- this.parentNode.removeChild(this);
215
- }
216
- }
217
- });
218
- });
219
- })([Element.prototype, CharacterData.prototype, DocumentType.prototype]);
220
-
221
- function forEach(arr, callback, scope) {
222
- for (var i = 0; i < arr.length; i += 1) {
223
- callback.call(scope, arr[i], i);
224
- }
225
- }
226
-
227
- function extend() {
228
- for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
229
- objects[_key] = arguments[_key];
230
- }
231
-
232
- var hasProp = {}.hasOwnProperty;
233
- var child = objects[0];
234
- var parent = objects[1];
235
-
236
- if (objects.length > 2) {
237
- var args = [];
238
- Object.keys(objects).forEach(function (key) {
239
- args.push(objects[key]);
240
- });
241
-
242
- while (args.length > 2) {
243
- var c1 = args.shift();
244
- var p1 = args.shift();
245
- args.unshift(extend(c1, p1));
246
- }
247
-
248
- child = args.shift();
249
- parent = args.shift();
250
- }
251
-
252
- if (parent) {
253
- Object.keys(parent).forEach(function (key) {
254
- if (hasProp.call(parent, key)) {
255
- if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_2___default()(parent[key]) === 'object') {
256
- child[key] = child[key] || {};
257
- child[key] = extend(child[key], parent[key]);
258
- } else {
259
- child[key] = parent[key];
260
- }
261
- }
262
- });
263
- }
264
-
265
- return child;
266
- }
267
-
268
- function debounce(func, wait, immediate) {
269
- var timeout;
270
- return function debouncedFunc() {
271
- var _this = this;
272
-
273
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
274
- args[_key2] = arguments[_key2];
275
- }
276
-
277
- var callNow = immediate && !timeout;
278
-
279
- var later = function later() {
280
- timeout = null;
281
- if (!immediate) func.apply(_this, args);
282
- };
283
-
284
- clearTimeout(timeout);
285
- timeout = setTimeout(later, wait);
286
- if (callNow) func.apply(this, args);
287
- };
288
- }
289
-
290
- function uniqueId() {
291
- uniqueIdCounter += 1;
292
- return "rmjs-".concat(uniqueIdCounter);
293
- }
294
-
295
- function setBoxHeights(element) {
296
- element.style.height = 'auto';
297
- var expandedHeight = parseInt(element.getBoundingClientRect().height, 10);
298
- var cssMaxHeight = parseInt(window.getComputedStyle(element).maxHeight, 10);
299
- var defaultHeight = parseInt(element.readmore.defaultHeight, 10); // Store our measurements.
300
-
301
- element.readmore.expandedHeight = expandedHeight;
302
- element.readmore.maxHeight = cssMaxHeight;
303
- element.readmore.collapsedHeight = cssMaxHeight || element.readmore.collapsedHeight || defaultHeight;
304
- element.style.maxHeight = 'none';
305
- }
306
-
307
- function createElementFromString(htmlString) {
308
- var div = document.createElement('div');
309
- div.innerHTML = htmlString;
310
- return div.firstChild;
311
- }
312
-
313
- function embedCSS(selector, options) {
314
- if (!isCssEmbeddedFor[selector]) {
315
- var styles = '';
316
-
317
- if (options.embedCSS && options.blockCSS !== '') {
318
- styles += "".concat(selector, " + [data-readmore-toggle], ").concat(selector, "[data-readmore] {\n ").concat(options.blockCSS, "\n }");
319
- } // Include the transition CSS even if embedCSS is false
320
-
321
-
322
- styles += "".concat(selector, "[data-readmore] {\n transition: height ").concat(options.speed, "ms;\n overflow: hidden;\n }");
323
-
324
- (function (d, u) {
325
- var css = d.createElement('style');
326
- css.type = 'text/css';
327
-
328
- if (css.styleSheet) {
329
- css.styleSheet.cssText = u;
330
- } else {
331
- css.appendChild(d.createTextNode(u));
332
- }
333
-
334
- d.getElementsByTagName('head')[0].appendChild(css);
335
- })(document, styles);
336
-
337
- isCssEmbeddedFor[selector] = true;
338
- }
339
- }
340
-
341
- function buildToggle(link, element, scope) {
342
- function clickHandler(event) {
343
- this.toggle(element, event);
344
- }
345
-
346
- var text = link;
347
-
348
- if (typeof link === 'function') {
349
- text = link(element);
350
- }
351
-
352
- var toggleLink = createElementFromString(text);
353
- toggleLink.setAttribute('data-readmore-toggle', element.id);
354
- toggleLink.setAttribute('aria-controls', element.id);
355
- toggleLink.addEventListener('click', clickHandler.bind(scope));
356
- return toggleLink;
357
- }
358
-
359
- function isEnvironmentSupported() {
360
- return typeof window !== 'undefined' && typeof document !== 'undefined' && !!document.querySelectorAll && !!window.addEventListener;
361
- }
362
-
363
- var resizeBoxes = debounce(function () {
364
- var elements = document.querySelectorAll('[data-readmore]');
365
- forEach(elements, function (element) {
366
- var expanded = element.getAttribute('aria-expanded') === 'true';
367
- setBoxHeights(element);
368
- element.style.height = "".concat(expanded ? element.readmore.expandedHeight : element.readmore.collapsedHeight, "px");
369
- });
370
- }, 100);
371
- var defaults = {
372
- speed: 100,
373
- collapsedHeight: 200,
374
- heightMargin: 16,
375
- moreLink: '<a href="#">Read More</a>',
376
- lessLink: '<a href="#">Close</a>',
377
- embedCSS: true,
378
- blockCSS: 'display: block; width: 100%;',
379
- startOpen: false,
380
- sourceOrder: 'after',
381
- // callbacks
382
- blockProcessed: function blockProcessed() {},
383
- beforeToggle: function beforeToggle() {},
384
- afterToggle: function afterToggle() {}
385
- };
386
-
387
- var Readmore =
388
- /*#__PURE__*/
389
- function () {
390
- function Readmore() {
391
- var _this2 = this;
392
-
393
- _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Readmore);
394
-
395
- if (!isEnvironmentSupported()) return;
396
-
397
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
398
- args[_key3] = arguments[_key3];
399
- }
400
-
401
- var selector = args[0],
402
- options = args[1];
403
- var elements;
404
-
405
- if (typeof selector === 'string') {
406
- elements = document.querySelectorAll(selector);
407
- } else if (selector.nodeName) {
408
- elements = [selector]; // emulate a NodeList by casting a single Node as an array
409
- } else {
410
- elements = selector;
411
- } // After all that, if we _still_ don't have iteratable NodeList, bail out.
412
-
413
-
414
- if (!elements.length) return;
415
- this.options = extend({}, defaults, options);
416
-
417
- if (typeof selector === 'string') {
418
- embedCSS(selector, this.options);
419
- } else {
420
- // Instances need distinct selectors so they don't stomp on each other.
421
- this.instanceSelector = ".".concat(uniqueId());
422
- embedCSS(this.instanceSelector, this.options);
423
- } // Need to resize boxes when the page has fully loaded.
424
-
425
-
426
- window.addEventListener('load', resizeBoxes);
427
- window.addEventListener('resize', resizeBoxes);
428
- this.elements = [];
429
- forEach(elements, function (element) {
430
- if (_this2.instanceSelector) {
431
- element.classList.add(_this2.instanceSelector.substr(1));
432
- }
433
-
434
- var expanded = _this2.options.startOpen;
435
- element.readmore = {
436
- defaultHeight: _this2.options.collapsedHeight,
437
- heightMargin: _this2.options.heightMargin
438
- };
439
- setBoxHeights(element);
440
- var heightMargin = element.readmore.heightMargin;
441
-
442
- if (element.getBoundingClientRect().height <= element.readmore.collapsedHeight + heightMargin) {
443
- if (typeof _this2.options.blockProcessed === 'function') {
444
- _this2.options.blockProcessed(element, false);
445
- }
446
-
447
- return;
448
- }
449
-
450
- element.setAttribute('data-readmore', '');
451
- element.setAttribute('aria-expanded', expanded);
452
- element.id = element.id || uniqueId();
453
- var toggleLink = expanded ? _this2.options.lessLink : _this2.options.moreLink;
454
- var toggleElement = buildToggle(toggleLink, element, _this2);
455
- element.parentNode.insertBefore(toggleElement, _this2.options.sourceOrder === 'before' ? element : element.nextSibling);
456
- element.style.height = "".concat(expanded ? element.readmore.expandedHeight : element.readmore.collapsedHeight, "px");
457
-
458
- if (typeof _this2.options.blockProcessed === 'function') {
459
- _this2.options.blockProcessed(element, true);
460
- }
461
-
462
- _this2.elements.push(element);
463
- });
464
- } // Signature when called internally by the toggleLink click handler:
465
- // toggle(element, event)
466
- //
467
- // When called externally by an instance,
468
- // e.g. readmoreDemo.toggle(document.querySelector('article:nth-of-type(1)')):
469
- // toggle(elementOrQuerySelector)
470
-
471
-
472
- _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Readmore, [{
473
- key: "toggle",
474
- value: function toggle() {
475
- var _this3 = this;
476
-
477
- var el = arguments.length <= 0 ? undefined : arguments[0];
478
-
479
- var toggleElement = function toggleElement(element) {
480
- var trigger = document.querySelector("[aria-controls=\"".concat(element.id, "\"]"));
481
- var expanded = element.getBoundingClientRect().height <= element.readmore.collapsedHeight;
482
- var newHeight = expanded ? element.readmore.expandedHeight : element.readmore.collapsedHeight; // Fire beforeToggle callback
483
- // Since we determined the new "expanded" state above we're now out of sync
484
- // with our true current state, so we need to flip the value of `expanded`
485
-
486
- if (typeof _this3.options.beforeToggle === 'function') {
487
- var shouldContinueToggle = _this3.options.beforeToggle(trigger, element, !expanded); // if the beforeToggle callback returns false, stop toggling
488
-
489
-
490
- if (shouldContinueToggle === false) {
491
- return;
492
- }
493
- }
494
-
495
- element.style.height = "".concat(newHeight, "px");
496
-
497
- var transitionendHandler = function transitionendHandler(transitionEvent) {
498
- // Fire afterToggle callback
499
- if (typeof _this3.options.afterToggle === 'function') {
500
- _this3.options.afterToggle(trigger, element, expanded);
501
- }
502
-
503
- transitionEvent.stopPropagation();
504
- element.setAttribute('aria-expanded', expanded);
505
- element.removeEventListener('transitionend', transitionendHandler, false);
506
- };
507
-
508
- element.addEventListener('transitionend', transitionendHandler, false);
509
-
510
- if (_this3.options.speed < 1) {
511
- transitionendHandler.call(_this3, {
512
- target: element
513
- });
514
- }
515
-
516
- var toggleLink = expanded ? _this3.options.lessLink : _this3.options.moreLink;
517
-
518
- if (!toggleLink) {
519
- trigger.remove();
520
- } else if (trigger && trigger.parentNode) {
521
- trigger.parentNode.replaceChild(buildToggle(toggleLink, element, _this3), trigger);
522
- }
523
- };
524
-
525
- if (typeof el === 'string') {
526
- el = document.querySelectorAll(el);
527
- }
528
-
529
- if (!el) {
530
- throw new Error('Element MUST be either an HTML node or querySelector string');
531
- }
532
-
533
- var event = arguments.length <= 1 ? undefined : arguments[1];
534
-
535
- if (event) {
536
- event.preventDefault();
537
- event.stopPropagation();
538
- }
539
-
540
- if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_2___default()(el) === 'object' && !el.nodeName) {
541
- // element is likely a NodeList
542
- forEach(el, toggleElement);
543
- } else {
544
- toggleElement(el);
545
- }
546
- }
547
- }, {
548
- key: "destroy",
549
- value: function destroy(selector) {
550
- var _this4 = this;
551
-
552
- var elements;
553
-
554
- if (!selector) {
555
- elements = this.elements; // eslint-disable-line
556
- } else if (typeof selector === 'string') {
557
- elements = document.querySelectorAll(selector);
558
- } else if (selector.nodeName) {
559
- elements = [selector]; // emulate a NodeList by casting a single Node as an array
560
- } else {
561
- elements = selector;
562
- }
563
-
564
- forEach(elements, function (element) {
565
- if (_this4.elements.indexOf(element) === -1) {
566
- return;
567
- }
568
-
569
- _this4.elements = _this4.elements.filter(function (el) {
570
- return el !== element;
571
- });
572
-
573
- if (_this4.instanceSelector) {
574
- element.classList.remove(_this4.instanceSelector.substr(1));
575
- }
576
-
577
- delete element.readmore;
578
- element.style.height = 'initial';
579
- element.style.maxHeight = 'initial';
580
- element.removeAttribute('data-readmore');
581
- element.removeAttribute('aria-expanded');
582
- var trigger = document.querySelector("[aria-controls=\"".concat(element.id, "\"]"));
583
-
584
- if (trigger) {
585
- trigger.remove();
586
- }
587
-
588
- if (element.id.indexOf('rmjs-') !== -1) {
589
- element.removeAttribute('id');
590
- }
591
- });
592
- delete this;
593
- }
594
- }]);
595
-
596
- return Readmore;
597
- }();
598
-
599
- Readmore.VERSION = "3.0.0-beta-1";
600
- /* harmony default export */ __webpack_exports__["default"] = (Readmore);
601
-
602
- /***/ }),
603
-
604
- /***/ 0:
605
- /*!*******************************!*\
606
- !*** multi ./src/readmore.js ***!
607
- \*******************************/
608
- /*! no static exports found */
609
- /***/ (function(module, exports, __webpack_require__) {
610
-
611
- module.exports = __webpack_require__(/*! ./src/readmore.js */"./src/readmore.js");
612
-
613
-
614
- /***/ })
615
-
616
- /******/ })["default"];
617
- });
618
- //# sourceMappingURL=readmore.js.map