geoblacklight 2.3.0
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.
- checksums.yaml +7 -0
- data/.circleci/config.yml +195 -0
- data/.github/ISSUE_TEMPLATE.md +17 -0
- data/.gitignore +21 -0
- data/.gitmodules +0 -0
- data/.hound.yml +8 -0
- data/.jshintignore +2 -0
- data/.jshintrc +67 -0
- data/.rubocop.yml +99 -0
- data/.rubocop_todo.yml +196 -0
- data/.solr_wrapper +5 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +49 -0
- data/Gemfile +39 -0
- data/LICENSE.txt +13 -0
- data/README.md +39 -0
- data/Rakefile +125 -0
- data/app/assets/images/blacklight/arrow-circle-down.svg +4 -0
- data/app/assets/images/blacklight/baruch-cuny.svg +6 -0
- data/app/assets/images/blacklight/berkeley.svg +7 -0
- data/app/assets/images/blacklight/book.svg +6 -0
- data/app/assets/images/blacklight/bookmark.svg +6 -0
- data/app/assets/images/blacklight/cd-rom.svg +6 -0
- data/app/assets/images/blacklight/chicago.svg +7 -0
- data/app/assets/images/blacklight/columbia.svg +6 -0
- data/app/assets/images/blacklight/cornell.svg +8 -0
- data/app/assets/images/blacklight/dvd-rom.svg +6 -0
- data/app/assets/images/blacklight/email.svg +6 -0
- data/app/assets/images/blacklight/esri-globe.svg +34 -0
- data/app/assets/images/blacklight/geoblacklight-icons.json +2079 -0
- data/app/assets/images/blacklight/globe.svg +4 -0
- data/app/assets/images/blacklight/harvard.svg +6 -0
- data/app/assets/images/blacklight/home.svg +4 -0
- data/app/assets/images/blacklight/illinois.svg +7 -0
- data/app/assets/images/blacklight/image.svg +6 -0
- data/app/assets/images/blacklight/indiana.svg +6 -0
- data/app/assets/images/blacklight/iowa.svg +6 -0
- data/app/assets/images/blacklight/leaf.svg +6 -0
- data/app/assets/images/blacklight/lewis-clark.svg +8 -0
- data/app/assets/images/blacklight/line.svg +7 -0
- data/app/assets/images/blacklight/logo.svg +1 -0
- data/app/assets/images/blacklight/map-marker.svg +6 -0
- data/app/assets/images/blacklight/map.svg +6 -0
- data/app/assets/images/blacklight/maryland.svg +6 -0
- data/app/assets/images/blacklight/massgis.svg +6 -0
- data/app/assets/images/blacklight/metadata.svg +6 -0
- data/app/assets/images/blacklight/michigan-state.svg +7 -0
- data/app/assets/images/blacklight/michigan.svg +6 -0
- data/app/assets/images/blacklight/minnesota.svg +6 -0
- data/app/assets/images/blacklight/mit.svg +6 -0
- data/app/assets/images/blacklight/mixed.svg +8 -0
- data/app/assets/images/blacklight/multilinestring.svg +9 -0
- data/app/assets/images/blacklight/multipoint.svg +6 -0
- data/app/assets/images/blacklight/multipolygon.svg +9 -0
- data/app/assets/images/blacklight/nyu.svg +9 -0
- data/app/assets/images/blacklight/ohio-state.svg +8 -0
- data/app/assets/images/blacklight/pagelines-brands.svg +6 -0
- data/app/assets/images/blacklight/paper-map.svg +6 -0
- data/app/assets/images/blacklight/penn-state.svg +7 -0
- data/app/assets/images/blacklight/point.svg +6 -0
- data/app/assets/images/blacklight/polygon.svg +7 -0
- data/app/assets/images/blacklight/polyline.svg +9 -0
- data/app/assets/images/blacklight/princeton.svg +6 -0
- data/app/assets/images/blacklight/public.svg +6 -0
- data/app/assets/images/blacklight/purdue.svg +7 -0
- data/app/assets/images/blacklight/raster.svg +6 -0
- data/app/assets/images/blacklight/restricted.svg +6 -0
- data/app/assets/images/blacklight/sms.svg +6 -0
- data/app/assets/images/blacklight/stanford.svg +6 -0
- data/app/assets/images/blacklight/table.svg +6 -0
- data/app/assets/images/blacklight/tags.svg +4 -0
- data/app/assets/images/blacklight/texas.svg +6 -0
- data/app/assets/images/blacklight/tufts.svg +6 -0
- data/app/assets/images/blacklight/ucla.svg +6 -0
- data/app/assets/images/blacklight/uva.svg +6 -0
- data/app/assets/images/blacklight/web_services.svg +6 -0
- data/app/assets/images/blacklight/wisconsin.svg +6 -0
- data/app/assets/javascripts/geoblacklight/basemaps.js +85 -0
- data/app/assets/javascripts/geoblacklight/controls.js +1 -0
- data/app/assets/javascripts/geoblacklight/controls/opacity.js +6 -0
- data/app/assets/javascripts/geoblacklight/downloaders.js +1 -0
- data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +61 -0
- data/app/assets/javascripts/geoblacklight/downloaders/hgl_downloader.js +32 -0
- data/app/assets/javascripts/geoblacklight/geoblacklight.js +42 -0
- data/app/assets/javascripts/geoblacklight/modules.js +1 -0
- data/app/assets/javascripts/geoblacklight/modules/collapse.js +7 -0
- data/app/assets/javascripts/geoblacklight/modules/download.js +11 -0
- data/app/assets/javascripts/geoblacklight/modules/geosearch.js +133 -0
- data/app/assets/javascripts/geoblacklight/modules/help_text.js +7 -0
- data/app/assets/javascripts/geoblacklight/modules/home.js +16 -0
- data/app/assets/javascripts/geoblacklight/modules/item.js +13 -0
- data/app/assets/javascripts/geoblacklight/modules/layer_opacity.js +68 -0
- data/app/assets/javascripts/geoblacklight/modules/metadata.js +15 -0
- data/app/assets/javascripts/geoblacklight/modules/metadata_download_button.js +53 -0
- data/app/assets/javascripts/geoblacklight/modules/relations.js +14 -0
- data/app/assets/javascripts/geoblacklight/modules/results.js +82 -0
- data/app/assets/javascripts/geoblacklight/modules/util.js +38 -0
- data/app/assets/javascripts/geoblacklight/templates/index_map_download.hbs +19 -0
- data/app/assets/javascripts/geoblacklight/templates/index_map_info.hbs +40 -0
- data/app/assets/javascripts/geoblacklight/viewers.js +1 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri.js +77 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/dynamic_map_layer.js +85 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/feature_layer.js +76 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/image_map_layer.js +14 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +50 -0
- data/app/assets/javascripts/geoblacklight/viewers/iiif.js +25 -0
- data/app/assets/javascripts/geoblacklight/viewers/index_map.js +70 -0
- data/app/assets/javascripts/geoblacklight/viewers/map.js +67 -0
- data/app/assets/javascripts/geoblacklight/viewers/oembed.js +13 -0
- data/app/assets/javascripts/geoblacklight/viewers/viewer.js +65 -0
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +74 -0
- data/app/assets/stylesheets/geoblacklight/_blacklight_overrides.scss +51 -0
- data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +36 -0
- data/app/assets/stylesheets/geoblacklight/_styles.scss +4 -0
- data/app/assets/stylesheets/geoblacklight/application.scss +2 -0
- data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +93 -0
- data/app/assets/stylesheets/geoblacklight/modules/facets.scss +5 -0
- data/app/assets/stylesheets/geoblacklight/modules/geosearch.scss +29 -0
- data/app/assets/stylesheets/geoblacklight/modules/home.scss +28 -0
- data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +50 -0
- data/app/assets/stylesheets/geoblacklight/modules/index_maps.scss +7 -0
- data/app/assets/stylesheets/geoblacklight/modules/item.scss +26 -0
- data/app/assets/stylesheets/geoblacklight/modules/layer_opacity.scss +87 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata.scss +31 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata_content.scss +43 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata_markup.scss +9 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata_missing.scss +7 -0
- data/app/assets/stylesheets/geoblacklight/modules/mixins.scss +5 -0
- data/app/assets/stylesheets/geoblacklight/modules/modal.scss +14 -0
- data/app/assets/stylesheets/geoblacklight/modules/relations.scss +15 -0
- data/app/assets/stylesheets/geoblacklight/modules/results.scss +68 -0
- data/app/assets/stylesheets/geoblacklight/modules/search_widgets.scss +5 -0
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +60 -0
- data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +70 -0
- data/app/assets/stylesheets/geoblacklight/modules/web_services.scss +5 -0
- data/app/controllers/download_controller.rb +114 -0
- data/app/controllers/relation_controller.rb +20 -0
- data/app/controllers/wms_controller.rb +15 -0
- data/app/helpers/arcgis_helper.rb +12 -0
- data/app/helpers/blacklight_helper.rb +9 -0
- data/app/helpers/carto_helper.rb +29 -0
- data/app/helpers/geoblacklight_helper.rb +323 -0
- data/app/models/concerns/geoblacklight/solr_document.rb +113 -0
- data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +10 -0
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +28 -0
- data/app/models/concerns/geoblacklight/solr_document/finder.rb +38 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +15 -0
- data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +69 -0
- data/app/presenters/geoblacklight/document_presenter.rb +23 -0
- data/app/views/catalog/_data_dictionary.html.erb +6 -0
- data/app/views/catalog/_document_action.html.erb +6 -0
- data/app/views/catalog/_document_split.html.erb +6 -0
- data/app/views/catalog/_download_generated_link.html.erb +4 -0
- data/app/views/catalog/_download_link.html.erb +3 -0
- data/app/views/catalog/_downloads_generated.html.erb +6 -0
- data/app/views/catalog/_downloads_primary.html.erb +14 -0
- data/app/views/catalog/_downloads_secondary.html.erb +39 -0
- data/app/views/catalog/_exports.html.erb +3 -0
- data/app/views/catalog/_facet_tag_item.html.erb +3 -0
- data/app/views/catalog/_facet_tag_layout.html.erb +2 -0
- data/app/views/catalog/_header_icons.html.erb +3 -0
- data/app/views/catalog/_home_text.html.erb +43 -0
- data/app/views/catalog/_icon_facet.html.erb +16 -0
- data/app/views/catalog/_index_split_default.html.erb +22 -0
- data/app/views/catalog/_metadata.html.erb +27 -0
- data/app/views/catalog/_relations_container.html.erb +1 -0
- data/app/views/catalog/_results_pagination.html.erb +12 -0
- data/app/views/catalog/_show_default_attribute_table.html.erb +19 -0
- data/app/views/catalog/_show_default_viewer_container.html.erb +12 -0
- data/app/views/catalog/_show_default_viewer_information.html.erb +4 -0
- data/app/views/catalog/_show_downloads.html.erb +34 -0
- data/app/views/catalog/_show_header_default.html.erb +4 -0
- data/app/views/catalog/_show_sidebar.html.erb +12 -0
- data/app/views/catalog/_show_tools.html.erb +25 -0
- data/app/views/catalog/_web_services.html.erb +8 -0
- data/app/views/catalog/_web_services_default.html.erb +8 -0
- data/app/views/catalog/_web_services_wfs.html.erb +8 -0
- data/app/views/catalog/_web_services_wms.html.erb +8 -0
- data/app/views/catalog/index.html.erb +13 -0
- data/app/views/catalog/metadata.html.erb +11 -0
- data/app/views/catalog/metadata/_content.html.erb +3 -0
- data/app/views/catalog/metadata/_markup.html.erb +8 -0
- data/app/views/catalog/metadata/_missing.html.erb +6 -0
- data/app/views/catalog/web_services.html.erb +10 -0
- data/app/views/download/hgl.html.erb +25 -0
- data/app/views/relation/_ancestors.html.erb +11 -0
- data/app/views/relation/_descendants.html.erb +18 -0
- data/app/views/relation/index.html.erb +13 -0
- data/app/views/relation/index.json.jbuilder +3 -0
- data/app/views/shared/_header_navbar.html.erb +38 -0
- data/config/initializers/rails_config.rb +3 -0
- data/config/locales/geoblacklight.en.yml +163 -0
- data/geoblacklight.gemspec +49 -0
- data/lib/generators/geoblacklight/install_generator.rb +105 -0
- data/lib/generators/geoblacklight/templates/Procfile +3 -0
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +272 -0
- data/lib/generators/geoblacklight/templates/geoblacklight.js +10 -0
- data/lib/generators/geoblacklight/templates/geoblacklight.scss +4 -0
- data/lib/generators/geoblacklight/templates/package.json +14 -0
- data/lib/generators/geoblacklight/templates/settings.yml +127 -0
- data/lib/generators/geoblacklight/templates/webpacker.yml +67 -0
- data/lib/generators/geoblacklight/webpacker_generator.rb +35 -0
- data/lib/geoblacklight.rb +50 -0
- data/lib/geoblacklight/bounding_box.rb +45 -0
- data/lib/geoblacklight/catalog_helper_override.rb +13 -0
- data/lib/geoblacklight/constants.rb +28 -0
- data/lib/geoblacklight/download.rb +108 -0
- data/lib/geoblacklight/download/geojson_download.rb +22 -0
- data/lib/geoblacklight/download/geotiff_download.rb +20 -0
- data/lib/geoblacklight/download/hgl_download.rb +18 -0
- data/lib/geoblacklight/download/kmz_download.rb +22 -0
- data/lib/geoblacklight/download/shapefile_download.rb +20 -0
- data/lib/geoblacklight/engine.rb +27 -0
- data/lib/geoblacklight/exceptions.rb +27 -0
- data/lib/geoblacklight/geoblacklight_helper_behavior.rb +14 -0
- data/lib/geoblacklight/item_viewer.rb +54 -0
- data/lib/geoblacklight/metadata.rb +18 -0
- data/lib/geoblacklight/metadata/base.rb +93 -0
- data/lib/geoblacklight/metadata/fgdc.rb +14 -0
- data/lib/geoblacklight/metadata/html.rb +13 -0
- data/lib/geoblacklight/metadata/iso19139.rb +14 -0
- data/lib/geoblacklight/metadata_transformer.rb +33 -0
- data/lib/geoblacklight/metadata_transformer/base.rb +42 -0
- data/lib/geoblacklight/metadata_transformer/fgdc.rb +8 -0
- data/lib/geoblacklight/metadata_transformer/iso19139.rb +8 -0
- data/lib/geoblacklight/reference.rb +45 -0
- data/lib/geoblacklight/references.rb +132 -0
- data/lib/geoblacklight/relation/ancestors.rb +27 -0
- data/lib/geoblacklight/relation/descendants.rb +27 -0
- data/lib/geoblacklight/relation/relation_response.rb +24 -0
- data/lib/geoblacklight/routes.rb +7 -0
- data/lib/geoblacklight/routes/downloadable.rb +14 -0
- data/lib/geoblacklight/routes/exportable.rb +17 -0
- data/lib/geoblacklight/routes/wms.rb +13 -0
- data/lib/geoblacklight/version.rb +3 -0
- data/lib/geoblacklight/view_helper_override.rb +40 -0
- data/lib/geoblacklight/wms_layer.rb +35 -0
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +32 -0
- data/lib/tasks/geoblacklight.rake +108 -0
- data/package.json +4 -0
- data/schema/format-values.md +50 -0
- data/schema/geoblacklight-schema-deprecated.md +39 -0
- data/schema/geoblacklight-schema.json +214 -0
- data/schema/geoblacklight-schema.md +323 -0
- data/schema/geometry-type-values.md +11 -0
- data/schema/references.md +23 -0
- data/schema/schema-commentary.md +198 -0
- data/schema/subjects.md +41 -0
- data/schema/type-values.md +10 -0
- data/solr/conf/_rest_managed.json +3 -0
- data/solr/conf/admin-extra.html +31 -0
- data/solr/conf/core.properties +5 -0
- data/solr/conf/elevate.xml +36 -0
- data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/conf/protwords.txt +21 -0
- data/solr/conf/schema.xml +198 -0
- data/solr/conf/scripts.conf +24 -0
- data/solr/conf/solrconfig.xml +243 -0
- data/solr/conf/spellings.txt +2 -0
- data/solr/conf/stopwords.txt +58 -0
- data/solr/conf/stopwords_en.txt +58 -0
- data/solr/conf/synonyms.txt +31 -0
- data/solr/conf/xslt/example.xsl +132 -0
- data/solr/conf/xslt/example_atom.xsl +67 -0
- data/solr/conf/xslt/example_rss.xsl +66 -0
- data/solr/conf/xslt/luke.xsl +337 -0
- data/spec/controllers/catalog_controller_spec.rb +82 -0
- data/spec/controllers/download_controller_spec.rb +120 -0
- data/spec/controllers/relation_controller_spec.rb +11 -0
- data/spec/controllers/wms_controller_spec.rb +34 -0
- data/spec/factories/user.rb +7 -0
- data/spec/features/bookmarks_spec.rb +10 -0
- data/spec/features/configurable_basemap_spec.rb +35 -0
- data/spec/features/data_dictionary_download_spec.rb +16 -0
- data/spec/features/download_layer_spec.rb +93 -0
- data/spec/features/empty_search_spec.rb +11 -0
- data/spec/features/esri_viewer_spec.rb +42 -0
- data/spec/features/exports_spec.rb +36 -0
- data/spec/features/help_text_spec.rb +8 -0
- data/spec/features/home_page_spec.rb +40 -0
- data/spec/features/iiif_viewer_spec.rb +8 -0
- data/spec/features/index_map_spec.rb +31 -0
- data/spec/features/layer_inspection_spec.rb +10 -0
- data/spec/features/layer_opacity_spec.rb +20 -0
- data/spec/features/layer_preview_spec.rb +17 -0
- data/spec/features/layer_with_no_references_spec.rb +8 -0
- data/spec/features/linkified_attribute_table_spec.rb +11 -0
- data/spec/features/metadata_panel_spec.rb +78 -0
- data/spec/features/missing_metadata_spec.rb +24 -0
- data/spec/features/oembed_spec.rb +9 -0
- data/spec/features/relations_spec.rb +51 -0
- data/spec/features/saved_searches_spec.rb +13 -0
- data/spec/features/search_bar_spec.rb +12 -0
- data/spec/features/search_results_map_spec.rb +55 -0
- data/spec/features/search_results_overlap_ratio_spec.rb +55 -0
- data/spec/features/search_spec.rb +14 -0
- data/spec/features/show_page_metadata_spec.rb +12 -0
- data/spec/features/sms_spec.rb +15 -0
- data/spec/features/split_view.html.erb_spec.rb +75 -0
- data/spec/features/suppressed_records_spec.rb +14 -0
- data/spec/features/web_services_modal_spec.rb +25 -0
- data/spec/fixtures/fgdc/harvard-g7064-s2-1834-k3.xml +1 -0
- data/spec/fixtures/iso19139/stanford-cg357zz0321.xml +581 -0
- data/spec/fixtures/mods/fb897vt9938.mods +111 -0
- data/spec/fixtures/mods/stanford-cg357zz0321.mods +113 -0
- data/spec/fixtures/solr_documents/README.md +40 -0
- data/spec/fixtures/solr_documents/actual-papermap1.json +23 -0
- data/spec/fixtures/solr_documents/actual-point1.json +37 -0
- data/spec/fixtures/solr_documents/actual-polygon1.json +23 -0
- data/spec/fixtures/solr_documents/actual-raster1.json +38 -0
- data/spec/fixtures/solr_documents/baruch_ancestor1.json +46 -0
- data/spec/fixtures/solr_documents/baruch_ancestor2.json +46 -0
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +49 -0
- data/spec/fixtures/solr_documents/bbox-spans-180.json +20 -0
- data/spec/fixtures/solr_documents/cornell_html_metadata.json +42 -0
- data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +38 -0
- data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +40 -0
- data/spec/fixtures/solr_documents/esri-feature-layer.json +46 -0
- data/spec/fixtures/solr_documents/esri-image-map-layer.json +42 -0
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +22 -0
- data/spec/fixtures/solr_documents/esri-wms-layer.json +33 -0
- data/spec/fixtures/solr_documents/harvard_raster.json +44 -0
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +30 -0
- data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +37 -0
- data/spec/fixtures/solr_documents/index-map-polygon.json +37 -0
- data/spec/fixtures/solr_documents/index-map-stanford.json +37 -0
- data/spec/fixtures/solr_documents/index_map_point.json +27 -0
- data/spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json +30 -0
- data/spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json +17 -0
- data/spec/fixtures/solr_documents/metadata_no_solr_geom.json +23 -0
- data/spec/fixtures/solr_documents/no_spatial.json +21 -0
- data/spec/fixtures/solr_documents/oembed.json +24 -0
- data/spec/fixtures/solr_documents/princeton-child1.json +30 -0
- data/spec/fixtures/solr_documents/princeton-child2.json +30 -0
- data/spec/fixtures/solr_documents/princeton-child3.json +30 -0
- data/spec/fixtures/solr_documents/princeton-child4.json +30 -0
- data/spec/fixtures/solr_documents/princeton-parent.json +25 -0
- data/spec/fixtures/solr_documents/public_direct_download.json +34 -0
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +36 -0
- data/spec/fixtures/solr_documents/public_polygon_mit.json +27 -0
- data/spec/fixtures/solr_documents/restricted-line.json +37 -0
- data/spec/fixtures/solr_documents/umn_metro_result1.json +41 -0
- data/spec/fixtures/solr_documents/umn_state_result1.json +38 -0
- data/spec/fixtures/solr_documents/umn_state_result2.json +38 -0
- data/spec/fixtures/solr_documents/uva_slug_colon.json +25 -0
- data/spec/helpers/arcgis_helper_spec.rb +14 -0
- data/spec/helpers/carto_helper_spec.rb +11 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +329 -0
- data/spec/javascripts/geoblacklight_spec.js +21 -0
- data/spec/javascripts/metadata_download_button_spec.js +14 -0
- data/spec/javascripts/spec_helper.js +32 -0
- data/spec/javascripts/util_spec.js +12 -0
- data/spec/lib/geoblacklight/bounding_box_spec.rb +27 -0
- data/spec/lib/geoblacklight/controller_override_spec.rb +1 -0
- data/spec/lib/geoblacklight/document_presenter_spec.rb +61 -0
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +19 -0
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +20 -0
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +60 -0
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +20 -0
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +19 -0
- data/spec/lib/geoblacklight/download_spec.rb +177 -0
- data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +30 -0
- data/spec/lib/geoblacklight/item_viewer_spec.rb +63 -0
- data/spec/lib/geoblacklight/metadata/base_spec.rb +157 -0
- data/spec/lib/geoblacklight/metadata/html_spec.rb +18 -0
- data/spec/lib/geoblacklight/metadata_spec.rb +42 -0
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +35 -0
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +23 -0
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +23 -0
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +69 -0
- data/spec/lib/geoblacklight/reference_spec.rb +64 -0
- data/spec/lib/geoblacklight/references_spec.rb +216 -0
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +32 -0
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +32 -0
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +43 -0
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +37 -0
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +50 -0
- data/spec/lib/geoblacklight/wms_layer_spec.rb +99 -0
- data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +61 -0
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +40 -0
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +16 -0
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +251 -0
- data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +84 -0
- data/spec/routing/catalog_routing_spec.rb +8 -0
- data/spec/spec_helper.rb +79 -0
- data/spec/support/backport_test_helpers.rb +45 -0
- data/spec/support/features.rb +5 -0
- data/spec/support/features/session_helpers.rb +20 -0
- data/spec/teaspoon_env.rb +213 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +49 -0
- data/spec/test_app_templates/metadata/fgdc.html +129 -0
- data/spec/test_app_templates/metadata/fgdc.xml +145 -0
- data/spec/test_app_templates/metadata/iso.html +275 -0
- data/spec/test_app_templates/metadata/iso.xml +511 -0
- data/spec/test_app_templates/solr_documents +1 -0
- data/spec/views/catalog/_document_split.html.erb_spec.rb +5 -0
- data/spec/views/catalog/_index_split.html.erb_spec.rb +5 -0
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +9 -0
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +41 -0
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +39 -0
- data/template.rb +19 -0
- data/vendor/assets/images/layers-2x.png +0 -0
- data/vendor/assets/images/layers.png +0 -0
- data/vendor/assets/images/marker-icon-2x.png +0 -0
- data/vendor/assets/images/marker-icon.png +0 -0
- data/vendor/assets/images/marker-shadow.png +0 -0
- data/vendor/assets/javascripts/esri-leaflet.js +5 -0
- data/vendor/assets/javascripts/esri-leaflet.js.map +1 -0
- data/vendor/assets/javascripts/leaflet-iiif.js +302 -0
- data/vendor/assets/javascripts/leaflet-src.js.map +1 -0
- data/vendor/assets/javascripts/leaflet.js.erb +13922 -0
- data/vendor/assets/javascripts/native.history.js +1 -0
- data/vendor/assets/javascripts/readmore.js +618 -0
- data/vendor/assets/javascripts/readmore.js.map +1 -0
- data/vendor/assets/stylesheets/leaflet-label.css +54 -0
- data/vendor/assets/stylesheets/leaflet.css +635 -0
- metadata +967 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){"use strict";var n=e.History=e.History||{};if(typeof n.Adapter!="undefined")throw new Error("History.js Adapter has already been loaded...");n.Adapter={handlers:{},_uid:1,uid:function(e){return e._uid||(e._uid=n.Adapter._uid++)},bind:function(e,t,r){var i=n.Adapter.uid(e);n.Adapter.handlers[i]=n.Adapter.handlers[i]||{},n.Adapter.handlers[i][t]=n.Adapter.handlers[i][t]||[],n.Adapter.handlers[i][t].push(r),e["on"+t]=function(e,t){return function(r){n.Adapter.trigger(e,t,r)}}(e,t)},trigger:function(e,t,r){r=r||{};var i=n.Adapter.uid(e),s,o;n.Adapter.handlers[i]=n.Adapter.handlers[i]||{},n.Adapter.handlers[i][t]=n.Adapter.handlers[i][t]||[];for(s=0,o=n.Adapter.handlers[i][t].length;s<o;++s)n.Adapter.handlers[i][t][s].apply(this,[r])},extractEventData:function(e,n){var r=n&&n[e]||t;return r},onDomLoad:function(t){var n=e.setTimeout(function(){t()},2e3);e.onload=function(){clearTimeout(n),t()}}},typeof n.init!="undefined"&&n.init()})(window),function(e,t){"use strict";var n=e.console||t,r=e.document,i=e.navigator,s=!1,o=e.setTimeout,u=e.clearTimeout,a=e.setInterval,f=e.clearInterval,l=e.JSON,c=e.alert,h=e.History=e.History||{},p=e.history;try{s=e.sessionStorage,s.setItem("TEST","1"),s.removeItem("TEST")}catch(d){s=!1}l.stringify=l.stringify||l.encode,l.parse=l.parse||l.decode;if(typeof h.init!="undefined")throw new Error("History.js Core has already been loaded...");h.init=function(e){return typeof h.Adapter=="undefined"?!1:(typeof h.initCore!="undefined"&&h.initCore(),typeof h.initHtml4!="undefined"&&h.initHtml4(),!0)},h.initCore=function(d){if(typeof h.initCore.initialized!="undefined")return!1;h.initCore.initialized=!0,h.options=h.options||{},h.options.hashChangeInterval=h.options.hashChangeInterval||100,h.options.safariPollInterval=h.options.safariPollInterval||500,h.options.doubleCheckInterval=h.options.doubleCheckInterval||500,h.options.disableSuid=h.options.disableSuid||!1,h.options.storeInterval=h.options.storeInterval||1e3,h.options.busyDelay=h.options.busyDelay||250,h.options.debug=h.options.debug||!1,h.options.initialTitle=h.options.initialTitle||r.title,h.options.html4Mode=h.options.html4Mode||!1,h.options.delayInit=h.options.delayInit||!1,h.intervalList=[],h.clearAllIntervals=function(){var e,t=h.intervalList;if(typeof t!="undefined"&&t!==null){for(e=0;e<t.length;e++)f(t[e]);h.intervalList=null}},h.debug=function(){(h.options.debug||!1)&&h.log.apply(h,arguments)},h.log=function(){var e=typeof n!="undefined"&&typeof n.log!="undefined"&&typeof n.log.apply!="undefined",t=r.getElementById("log"),i,s,o,u,a;e?(u=Array.prototype.slice.call(arguments),i=u.shift(),typeof n.debug!="undefined"?n.debug.apply(n,[i,u]):n.log.apply(n,[i,u])):i="\n"+arguments[0]+"\n";for(s=1,o=arguments.length;s<o;++s){a=arguments[s];if(typeof a=="object"&&typeof l!="undefined")try{a=l.stringify(a)}catch(f){}i+="\n"+a+"\n"}return t?(t.value+=i+"\n-----\n",t.scrollTop=t.scrollHeight-t.clientHeight):e||c(i),!0},h.getInternetExplorerMajorVersion=function(){var e=h.getInternetExplorerMajorVersion.cached=typeof h.getInternetExplorerMajorVersion.cached!="undefined"?h.getInternetExplorerMajorVersion.cached:function(){var e=3,t=r.createElement("div"),n=t.getElementsByTagName("i");while((t.innerHTML="<!--[if gt IE "+ ++e+"]><i></i><![endif]-->")&&n[0]);return e>4?e:!1}();return e},h.isInternetExplorer=function(){var e=h.isInternetExplorer.cached=typeof h.isInternetExplorer.cached!="undefined"?h.isInternetExplorer.cached:Boolean(h.getInternetExplorerMajorVersion());return e},h.options.html4Mode?h.emulated={pushState:!0,hashChange:!0}:h.emulated={pushState:!Boolean(e.history&&e.history.pushState&&e.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(i.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(i.userAgent)),hashChange:Boolean(!("onhashchange"in e||"onhashchange"in r)||h.isInternetExplorer()&&h.getInternetExplorerMajorVersion()<8)},h.enabled=!h.emulated.pushState,h.bugs={setHash:Boolean(!h.emulated.pushState&&i.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(i.userAgent)),safariPoll:Boolean(!h.emulated.pushState&&i.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(i.userAgent)),ieDoubleCheck:Boolean(h.isInternetExplorer()&&h.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(h.isInternetExplorer()&&h.getInternetExplorerMajorVersion()<7)},h.isEmptyObject=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},h.cloneObject=function(e){var t,n;return e?(t=l.stringify(e),n=l.parse(t)):n={},n},h.getRootUrl=function(){var e=r.location.protocol+"//"+(r.location.hostname||r.location.host);if(r.location.port||!1)e+=":"+r.location.port;return e+="/",e},h.getBaseHref=function(){var e=r.getElementsByTagName("base"),t=null,n="";return e.length===1&&(t=e[0],n=t.href.replace(/[^\/]+$/,"")),n=n.replace(/\/+$/,""),n&&(n+="/"),n},h.getBaseUrl=function(){var e=h.getBaseHref()||h.getBasePageUrl()||h.getRootUrl();return e},h.getPageUrl=function(){var e=h.getState(!1,!1),t=(e||{}).url||h.getLocationHref(),n;return n=t.replace(/\/+$/,"").replace(/[^\/]+$/,function(e,t,n){return/\./.test(e)?e:e+"/"}),n},h.getBasePageUrl=function(){var e=h.getLocationHref().replace(/[#\?].*/,"").replace(/[^\/]+$/,function(e,t,n){return/[^\/]$/.test(e)?"":e}).replace(/\/+$/,"")+"/";return e},h.getFullUrl=function(e,t){var n=e,r=e.substring(0,1);return t=typeof t=="undefined"?!0:t,/[a-z]+\:\/\//.test(e)||(r==="/"?n=h.getRootUrl()+e.replace(/^\/+/,""):r==="#"?n=h.getPageUrl().replace(/#.*/,"")+e:r==="?"?n=h.getPageUrl().replace(/[\?#].*/,"")+e:t?n=h.getBaseUrl()+e.replace(/^(\.\/)+/,""):n=h.getBasePageUrl()+e.replace(/^(\.\/)+/,"")),n.replace(/\#$/,"")},h.getShortUrl=function(e){var t=e,n=h.getBaseUrl(),r=h.getRootUrl();return h.emulated.pushState&&(t=t.replace(n,"")),t=t.replace(r,"/"),h.isTraditionalAnchor(t)&&(t="./"+t),t=t.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),t},h.getLocationHref=function(e){return e=e||r,e.URL===e.location.href?e.location.href:e.location.href===decodeURIComponent(e.URL)?e.URL:e.location.hash&&decodeURIComponent(e.location.href.replace(/^[^#]+/,""))===e.location.hash?e.location.href:e.URL.indexOf("#")==-1&&e.location.href.indexOf("#")!=-1?e.location.href:e.URL||e.location.href},h.store={},h.idToState=h.idToState||{},h.stateToId=h.stateToId||{},h.urlToId=h.urlToId||{},h.storedStates=h.storedStates||[],h.savedStates=h.savedStates||[],h.normalizeStore=function(){h.store.idToState=h.store.idToState||{},h.store.urlToId=h.store.urlToId||{},h.store.stateToId=h.store.stateToId||{}},h.getState=function(e,t){typeof e=="undefined"&&(e=!0),typeof t=="undefined"&&(t=!0);var n=h.getLastSavedState();return!n&&t&&(n=h.createStateObject()),e&&(n=h.cloneObject(n),n.url=n.cleanUrl||n.url),n},h.getIdByState=function(e){var t=h.extractId(e.url),n;if(!t){n=h.getStateString(e);if(typeof h.stateToId[n]!="undefined")t=h.stateToId[n];else if(typeof h.store.stateToId[n]!="undefined")t=h.store.stateToId[n];else{for(;;){t=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof h.idToState[t]=="undefined"&&typeof h.store.idToState[t]=="undefined")break}h.stateToId[n]=t,h.idToState[t]=e}}return t},h.normalizeState=function(e){var t,n;if(!e||typeof e!="object")e={};if(typeof e.normalized!="undefined")return e;if(!e.data||typeof e.data!="object")e.data={};return t={},t.normalized=!0,t.title=e.title||"",t.url=h.getFullUrl(e.url?e.url:h.getLocationHref()),t.hash=h.getShortUrl(t.url),t.data=h.cloneObject(e.data),t.id=h.getIdByState(t),t.cleanUrl=t.url.replace(/\??\&_suid.*/,""),t.url=t.cleanUrl,n=!h.isEmptyObject(t.data),(t.title||n)&&h.options.disableSuid!==!0&&(t.hash=h.getShortUrl(t.url).replace(/\??\&_suid.*/,""),/\?/.test(t.hash)||(t.hash+="?"),t.hash+="&_suid="+t.id),t.hashedUrl=h.getFullUrl(t.hash),(h.emulated.pushState||h.bugs.safariPoll)&&h.hasUrlDuplicate(t)&&(t.url=t.hashedUrl),t},h.createStateObject=function(e,t,n){var r={data:e,title:t,url:n};return r=h.normalizeState(r),r},h.getStateById=function(e){e=String(e);var n=h.idToState[e]||h.store.idToState[e]||t;return n},h.getStateString=function(e){var t,n,r;return t=h.normalizeState(e),n={data:t.data,title:e.title,url:e.url},r=l.stringify(n),r},h.getStateId=function(e){var t,n;return t=h.normalizeState(e),n=t.id,n},h.getHashByState=function(e){var t,n;return t=h.normalizeState(e),n=t.hash,n},h.extractId=function(e){var t,n,r,i;return e.indexOf("#")!=-1?i=e.split("#")[0]:i=e,n=/(.*)\&_suid=([0-9]+)$/.exec(i),r=n?n[1]||e:e,t=n?String(n[2]||""):"",t||!1},h.isTraditionalAnchor=function(e){var t=!/[\/\?\.]/.test(e);return t},h.extractState=function(e,t){var n=null,r,i;return t=t||!1,r=h.extractId(e),r&&(n=h.getStateById(r)),n||(i=h.getFullUrl(e),r=h.getIdByUrl(i)||!1,r&&(n=h.getStateById(r)),!n&&t&&!h.isTraditionalAnchor(e)&&(n=h.createStateObject(null,null,i))),n},h.getIdByUrl=function(e){var n=h.urlToId[e]||h.store.urlToId[e]||t;return n},h.getLastSavedState=function(){return h.savedStates[h.savedStates.length-1]||t},h.getLastStoredState=function(){return h.storedStates[h.storedStates.length-1]||t},h.hasUrlDuplicate=function(e){var t=!1,n;return n=h.extractState(e.url),t=n&&n.id!==e.id,t},h.storeState=function(e){return h.urlToId[e.url]=e.id,h.storedStates.push(h.cloneObject(e)),e},h.isLastSavedState=function(e){var t=!1,n,r,i;return h.savedStates.length&&(n=e.id,r=h.getLastSavedState(),i=r.id,t=n===i),t},h.saveState=function(e){return h.isLastSavedState(e)?!1:(h.savedStates.push(h.cloneObject(e)),!0)},h.getStateByIndex=function(e){var t=null;return typeof e=="undefined"?t=h.savedStates[h.savedStates.length-1]:e<0?t=h.savedStates[h.savedStates.length+e]:t=h.savedStates[e],t},h.getCurrentIndex=function(){var e=null;return h.savedStates.length<1?e=0:e=h.savedStates.length-1,e},h.getHash=function(e){var t=h.getLocationHref(e),n;return n=h.getHashByUrl(t),n},h.unescapeHash=function(e){var t=h.normalizeHash(e);return t=decodeURIComponent(t),t},h.normalizeHash=function(e){var t=e.replace(/[^#]*#/,"").replace(/#.*/,"");return t},h.setHash=function(e,t){var n,i;return t!==!1&&h.busy()?(h.pushQueue({scope:h,callback:h.setHash,args:arguments,queue:t}),!1):(h.busy(!0),n=h.extractState(e,!0),n&&!h.emulated.pushState?h.pushState(n.data,n.title,n.url,!1):h.getHash()!==e&&(h.bugs.setHash?(i=h.getPageUrl(),h.pushState(null,null,i+"#"+e,!1)):r.location.hash=e),h)},h.escapeHash=function(t){var n=h.normalizeHash(t);return n=e.encodeURIComponent(n),h.bugs.hashEscape||(n=n.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),n},h.getHashByUrl=function(e){var t=String(e).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return t=h.unescapeHash(t),t},h.setTitle=function(e){var t=e.title,n;t||(n=h.getStateByIndex(0),n&&n.url===e.url&&(t=n.title||h.options.initialTitle));try{r.getElementsByTagName("title")[0].innerHTML=t.replace("<","<").replace(">",">").replace(" & "," & ")}catch(i){}return r.title=t,h},h.queues=[],h.busy=function(e){typeof e!="undefined"?h.busy.flag=e:typeof h.busy.flag=="undefined"&&(h.busy.flag=!1);if(!h.busy.flag){u(h.busy.timeout);var t=function(){var e,n,r;if(h.busy.flag)return;for(e=h.queues.length-1;e>=0;--e){n=h.queues[e];if(n.length===0)continue;r=n.shift(),h.fireQueueItem(r),h.busy.timeout=o(t,h.options.busyDelay)}};h.busy.timeout=o(t,h.options.busyDelay)}return h.busy.flag},h.busy.flag=!1,h.fireQueueItem=function(e){return e.callback.apply(e.scope||h,e.args||[])},h.pushQueue=function(e){return h.queues[e.queue||0]=h.queues[e.queue||0]||[],h.queues[e.queue||0].push(e),h},h.queue=function(e,t){return typeof e=="function"&&(e={callback:e}),typeof t!="undefined"&&(e.queue=t),h.busy()?h.pushQueue(e):h.fireQueueItem(e),h},h.clearQueue=function(){return h.busy.flag=!1,h.queues=[],h},h.stateChanged=!1,h.doubleChecker=!1,h.doubleCheckComplete=function(){return h.stateChanged=!0,h.doubleCheckClear(),h},h.doubleCheckClear=function(){return h.doubleChecker&&(u(h.doubleChecker),h.doubleChecker=!1),h},h.doubleCheck=function(e){return h.stateChanged=!1,h.doubleCheckClear(),h.bugs.ieDoubleCheck&&(h.doubleChecker=o(function(){return h.doubleCheckClear(),h.stateChanged||e(),!0},h.options.doubleCheckInterval)),h},h.safariStatePoll=function(){var t=h.extractState(h.getLocationHref()),n;if(!h.isLastSavedState(t))return n=t,n||(n=h.createStateObject()),h.Adapter.trigger(e,"popstate"),h;return},h.back=function(e){return e!==!1&&h.busy()?(h.pushQueue({scope:h,callback:h.back,args:arguments,queue:e}),!1):(h.busy(!0),h.doubleCheck(function(){h.back(!1)}),p.go(-1),!0)},h.forward=function(e){return e!==!1&&h.busy()?(h.pushQueue({scope:h,callback:h.forward,args:arguments,queue:e}),!1):(h.busy(!0),h.doubleCheck(function(){h.forward(!1)}),p.go(1),!0)},h.go=function(e,t){var n;if(e>0)for(n=1;n<=e;++n)h.forward(t);else{if(!(e<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(n=-1;n>=e;--n)h.back(t)}return h};if(h.emulated.pushState){var v=function(){};h.pushState=h.pushState||v,h.replaceState=h.replaceState||v}else h.onPopState=function(t,n){var r=!1,i=!1,s,o;return h.doubleCheckComplete(),s=h.getHash(),s?(o=h.extractState(s||h.getLocationHref(),!0),o?h.replaceState(o.data,o.title,o.url,!1):(h.Adapter.trigger(e,"anchorchange"),h.busy(!1)),h.expectedStateId=!1,!1):(r=h.Adapter.extractEventData("state",t,n)||!1,r?i=h.getStateById(r):h.expectedStateId?i=h.getStateById(h.expectedStateId):i=h.extractState(h.getLocationHref()),i||(i=h.createStateObject(null,null,h.getLocationHref())),h.expectedStateId=!1,h.isLastSavedState(i)?(h.busy(!1),!1):(h.storeState(i),h.saveState(i),h.setTitle(i),h.Adapter.trigger(e,"statechange"),h.busy(!1),!0))},h.Adapter.bind(e,"popstate",h.onPopState),h.pushState=function(t,n,r,i){if(h.getHashByUrl(r)&&h.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(i!==!1&&h.busy())return h.pushQueue({scope:h,callback:h.pushState,args:arguments,queue:i}),!1;h.busy(!0);var s=h.createStateObject(t,n,r);return h.isLastSavedState(s)?h.busy(!1):(h.storeState(s),h.expectedStateId=s.id,p.pushState(s.id,s.title,s.url),h.Adapter.trigger(e,"popstate")),!0},h.replaceState=function(t,n,r,i){if(h.getHashByUrl(r)&&h.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(i!==!1&&h.busy())return h.pushQueue({scope:h,callback:h.replaceState,args:arguments,queue:i}),!1;h.busy(!0);var s=h.createStateObject(t,n,r);return h.isLastSavedState(s)?h.busy(!1):(h.storeState(s),h.expectedStateId=s.id,p.replaceState(s.id,s.title,s.url),h.Adapter.trigger(e,"popstate")),!0};if(s){try{h.store=l.parse(s.getItem("History.store"))||{}}catch(m){h.store={}}h.normalizeStore()}else h.store={},h.normalizeStore();h.Adapter.bind(e,"unload",h.clearAllIntervals),h.saveState(h.storeState(h.extractState(h.getLocationHref(),!0))),s&&(h.onUnload=function(){var e,t,n;try{e=l.parse(s.getItem("History.store"))||{}}catch(r){e={}}e.idToState=e.idToState||{},e.urlToId=e.urlToId||{},e.stateToId=e.stateToId||{};for(t in h.idToState){if(!h.idToState.hasOwnProperty(t))continue;e.idToState[t]=h.idToState[t]}for(t in h.urlToId){if(!h.urlToId.hasOwnProperty(t))continue;e.urlToId[t]=h.urlToId[t]}for(t in h.stateToId){if(!h.stateToId.hasOwnProperty(t))continue;e.stateToId[t]=h.stateToId[t]}h.store=e,h.normalizeStore(),n=l.stringify(e);try{s.setItem("History.store",n)}catch(i){if(i.code!==DOMException.QUOTA_EXCEEDED_ERR)throw i;s.length&&(s.removeItem("History.store"),s.setItem("History.store",n))}},h.intervalList.push(a(h.onUnload,h.options.storeInterval)),h.Adapter.bind(e,"beforeunload",h.onUnload),h.Adapter.bind(e,"unload",h.onUnload));if(!h.emulated.pushState){h.bugs.safariPoll&&h.intervalList.push(a(h.safariStatePoll,h.options.safariPollInterval));if(i.vendor==="Apple Computer, Inc."||(i.appCodeName||"")==="Mozilla")h.Adapter.bind(e,"hashchange",function(){h.Adapter.trigger(e,"popstate")}),h.getHash()&&h.Adapter.onDomLoad(function(){h.Adapter.trigger(e,"hashchange")})}},(!h.options||!h.options.delayInit)&&h.init()}(window)
|
|
@@ -0,0 +1,618 @@
|
|
|
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
|