j1-template 2020.0.22 → 2020.0.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/content_generator_page.html +1 -1
  3. data/_includes/themes/j1/layouts/content_generator_post.html +63 -161
  4. data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +14 -0
  5. data/_includes/themes/j1/modules/connectors/analytic/google-analytics.html +1 -3
  6. data/_includes/themes/j1/modules/connectors/comment/disqus.html +37 -24
  7. data/_includes/themes/j1/modules/navigator/generator.html +8 -3
  8. data/_includes/themes/j1/modules/navigator/procedures/topsearch.proc +36 -26
  9. data/_includes/themes/j1/procedures/layouts/module_writer.proc +1 -1
  10. data/_includes/themes/j1/procedures/posts/create_series_header.proc +9 -5
  11. data/assets/data/banner.html +1 -1
  12. data/assets/data/fam.html +124 -0
  13. data/assets/data/mmenu_sidebar.html +3 -3
  14. data/assets/data/panel.html +9 -9
  15. data/assets/data/quicklinks.html +13 -13
  16. data/assets/error_pages/HTTP204.html +1 -0
  17. data/assets/error_pages/HTTP400.html +3 -2
  18. data/assets/error_pages/HTTP401.html +3 -2
  19. data/assets/error_pages/HTTP403.html +3 -2
  20. data/assets/error_pages/HTTP404.html +3 -2
  21. data/assets/error_pages/HTTP500.html +3 -2
  22. data/assets/error_pages/HTTP501.html +3 -2
  23. data/assets/error_pages/HTTP502.html +3 -2
  24. data/assets/error_pages/HTTP503.html +3 -2
  25. data/assets/error_pages/HTTP520.html +3 -2
  26. data/assets/error_pages/HTTP521.html +3 -2
  27. data/assets/error_pages/HTTP533.html +3 -2
  28. data/assets/themes/j1/adapter/js/{ssm.js → fam.js} +248 -138
  29. data/assets/themes/j1/adapter/js/framer.js +72 -56
  30. data/assets/themes/j1/adapter/js/gallery_customizer.js +2 -1
  31. data/assets/themes/j1/adapter/js/j1.js +8 -2
  32. data/assets/themes/j1/adapter/js/{searcher.js → lunr_search.js} +68 -65
  33. data/assets/themes/j1/adapter/js/toccer.js +62 -30
  34. data/assets/themes/j1/core/css/bootstrap.css +7154 -0
  35. data/assets/themes/j1/core/css/bootstrap.min.css +6 -0
  36. data/assets/themes/j1/core/css/custom.scss +28 -0
  37. data/assets/themes/j1/core/css/globals.css +14523 -0
  38. data/assets/themes/j1/core/css/globals.min.css +1 -0
  39. data/assets/themes/j1/core/css/globals.scss +28 -0
  40. data/assets/themes/j1/core/css/theme_extensions.css +11558 -0
  41. data/assets/themes/j1/core/css/theme_extensions.min.css +1 -0
  42. data/assets/themes/j1/core/css/themes/bootstrap/bootstrap.css +7 -4
  43. data/assets/themes/j1/core/css/themes/bootstrap/bootstrap.min.css +2 -2
  44. data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.css +7 -4
  45. data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.min.css +2 -2
  46. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +514 -417
  47. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +2 -2
  48. data/assets/themes/j1/core/css/uno.css +11823 -0
  49. data/assets/themes/j1/core/css/uno.min.css +1 -0
  50. data/assets/themes/j1/core/css/uno.scss +28 -0
  51. data/assets/themes/j1/core/css/vendor.css +5 -4
  52. data/assets/themes/j1/core/css/vendor.min.css +1 -1
  53. data/assets/themes/j1/core/css/vendor.scss +28 -0
  54. data/assets/themes/j1/core/js/template.js +6 -11
  55. data/assets/themes/j1/core/js/template.js.map +1 -1
  56. data/assets/themes/j1/core/js/template.min.js +1 -1
  57. data/assets/themes/j1/modules/bmd/js/bootstrap-material-design.js +6 -0
  58. data/assets/themes/j1/modules/cash/js/cash.js +1374 -0
  59. data/assets/themes/j1/modules/cash/js/cash.min.js +42 -0
  60. data/assets/themes/j1/modules/fam/css/uno/fam.css +369 -0
  61. data/assets/themes/j1/modules/fam/js/fam.js +477 -0
  62. data/assets/themes/j1/modules/iframeResizer/examples/frame.nested.html +1 -1
  63. data/assets/themes/j1/modules/iframeResizer/js/{iframeResizer.js → resizer.js} +0 -0
  64. data/assets/themes/j1/modules/iframeResizer/js/{iframeResizer.map → resizer.map} +0 -0
  65. data/assets/themes/j1/modules/iframeResizer/js/{iframeResizer.min.js → resizer.min.js} +0 -0
  66. data/assets/themes/j1/modules/jquery/js/require.js +2145 -0
  67. data/assets/themes/j1/modules/jquery/js/require.min.js +5 -0
  68. data/assets/themes/j1/modules/lunrSearch/css/lunr_search.css +32 -0
  69. data/assets/themes/j1/modules/lunrSearch/css/lunr_search.min.css +25 -0
  70. data/assets/themes/j1/modules/lunrSearch/js/dateformat.js +125 -0
  71. data/assets/themes/j1/modules/lunrSearch/js/dateformat.min.js +14 -0
  72. data/assets/themes/j1/modules/lunrSearch/js/lunr.js +3475 -0
  73. data/assets/themes/j1/modules/lunrSearch/js/lunr.min.js +51 -0
  74. data/assets/themes/j1/modules/lunrSearch/js/lunr_search.js +184 -0
  75. data/assets/themes/j1/modules/lunrSearch/js/lunr_search.min.js +17 -0
  76. data/assets/themes/j1/modules/lunrSearch/js/mustache.js +772 -0
  77. data/assets/themes/j1/modules/lunrSearch/js/mustache.min.js +772 -0
  78. data/assets/themes/j1/modules/lunrSearch/js/uri.js +2340 -0
  79. data/assets/themes/j1/modules/lunrSearch/js/uri.min.js +93 -0
  80. data/assets/themes/j1/modules/materialize/js/anime.js +1283 -0
  81. data/assets/themes/j1/modules/materialize/js/anime.min.js +34 -0
  82. data/assets/themes/j1/modules/materialize/js/autocomplete.js +450 -0
  83. data/assets/themes/j1/modules/materialize/js/buttons.js +409 -0
  84. data/assets/themes/j1/modules/materialize/js/cards.js +40 -0
  85. data/assets/themes/j1/modules/materialize/js/carousel.js +717 -0
  86. data/assets/themes/j1/modules/materialize/js/cash-dom.js +1044 -0
  87. data/assets/themes/j1/modules/materialize/js/cash.js +960 -0
  88. data/assets/themes/j1/modules/materialize/js/characterCounter.js +136 -0
  89. data/assets/themes/j1/modules/materialize/js/chips.js +481 -0
  90. data/assets/themes/j1/modules/materialize/js/collapsible.js +275 -0
  91. data/assets/themes/j1/modules/materialize/js/component.js +44 -0
  92. data/assets/themes/j1/modules/materialize/js/datepicker.js +975 -0
  93. data/assets/themes/j1/modules/materialize/js/dropdown.js +617 -0
  94. data/assets/themes/j1/modules/materialize/js/forms.js +275 -0
  95. data/assets/themes/j1/modules/materialize/js/global.js +427 -0
  96. data/assets/themes/j1/modules/materialize/js/materialbox.js +453 -0
  97. data/assets/themes/j1/modules/materialize/js/modal.js +382 -0
  98. data/assets/themes/j1/modules/materialize/js/parallax.js +138 -0
  99. data/assets/themes/j1/modules/materialize/js/pushpin.js +145 -0
  100. data/assets/themes/j1/modules/materialize/js/range.js +263 -0
  101. data/assets/themes/j1/modules/materialize/js/ripple.js +335 -0
  102. data/assets/themes/j1/modules/materialize/js/scrollspy.js +295 -0
  103. data/assets/themes/j1/modules/materialize/js/select.js +432 -0
  104. data/assets/themes/j1/modules/materialize/js/sidenav.js +580 -0
  105. data/assets/themes/j1/modules/materialize/js/slider.js +359 -0
  106. data/assets/themes/j1/modules/materialize/js/tabs.js +402 -0
  107. data/assets/themes/j1/modules/materialize/js/tapTarget.js +314 -0
  108. data/assets/themes/j1/modules/materialize/js/timepicker.js +647 -0
  109. data/assets/themes/j1/modules/materialize/js/toasts.js +310 -0
  110. data/assets/themes/j1/modules/materialize/js/tooltip.js +303 -0
  111. data/assets/themes/j1/modules/materialize/js/waves.js +335 -0
  112. data/assets/themes/j1/modules/materialize/scss/components/_badges.scss +55 -0
  113. data/assets/themes/j1/modules/materialize/scss/components/_buttons.scss +322 -0
  114. data/assets/themes/j1/modules/materialize/scss/components/_cards.scss +195 -0
  115. data/assets/themes/j1/modules/materialize/scss/components/_carousel.scss +90 -0
  116. data/assets/themes/j1/modules/materialize/scss/components/_chips.scss +90 -0
  117. data/assets/themes/j1/modules/materialize/scss/components/_collapsible.scss +91 -0
  118. data/assets/themes/j1/modules/materialize/scss/components/_color-classes.scss +32 -0
  119. data/assets/themes/j1/modules/materialize/scss/components/_color-variables.scss +370 -0
  120. data/assets/themes/j1/modules/materialize/scss/components/_datepicker.scss +191 -0
  121. data/assets/themes/j1/modules/materialize/scss/components/_dropdown.scss +85 -0
  122. data/assets/themes/j1/modules/materialize/scss/components/_global.scss +769 -0
  123. data/assets/themes/j1/modules/materialize/scss/components/_grid.scss +156 -0
  124. data/assets/themes/j1/modules/materialize/scss/components/_icons-material-design.scss +5 -0
  125. data/assets/themes/j1/modules/materialize/scss/components/_materialbox.scss +43 -0
  126. data/assets/themes/j1/modules/materialize/scss/components/_modal.scss +94 -0
  127. data/assets/themes/j1/modules/materialize/scss/components/_navbar.scss +208 -0
  128. data/assets/themes/j1/modules/materialize/scss/components/_normalize.scss +447 -0
  129. data/assets/themes/j1/modules/materialize/scss/components/_preloader.scss +334 -0
  130. data/assets/themes/j1/modules/materialize/scss/components/_pulse.scss +34 -0
  131. data/assets/themes/j1/modules/materialize/scss/components/_sidenav.scss +216 -0
  132. data/assets/themes/j1/modules/materialize/scss/components/_slider.scss +92 -0
  133. data/assets/themes/j1/modules/materialize/scss/components/_table_of_contents.scss +33 -0
  134. data/assets/themes/j1/modules/materialize/scss/components/_tabs.scss +99 -0
  135. data/assets/themes/j1/modules/materialize/scss/components/_tapTarget.scss +103 -0
  136. data/assets/themes/j1/modules/materialize/scss/components/_timepicker.scss +183 -0
  137. data/assets/themes/j1/modules/materialize/scss/components/_toast.scss +58 -0
  138. data/assets/themes/j1/modules/materialize/scss/components/_tooltip.scss +32 -0
  139. data/assets/themes/j1/modules/materialize/scss/components/_transitions.scss +13 -0
  140. data/assets/themes/j1/modules/materialize/scss/components/_typography.scss +60 -0
  141. data/assets/themes/j1/modules/materialize/scss/components/_variables.scss +349 -0
  142. data/assets/themes/j1/modules/materialize/scss/components/_waves.scss +114 -0
  143. data/assets/themes/j1/modules/materialize/scss/components/forms/_checkboxes.scss +200 -0
  144. data/assets/themes/j1/modules/materialize/scss/components/forms/_file-input.scss +44 -0
  145. data/assets/themes/j1/modules/materialize/scss/components/forms/_forms.scss +22 -0
  146. data/assets/themes/j1/modules/materialize/scss/components/forms/_input-fields.scss +354 -0
  147. data/assets/themes/j1/modules/materialize/scss/components/forms/_radio-buttons.scss +115 -0
  148. data/assets/themes/j1/modules/materialize/scss/components/forms/_range.scss +161 -0
  149. data/assets/themes/j1/modules/materialize/scss/components/forms/_select.scss +180 -0
  150. data/assets/themes/j1/modules/materialize/scss/components/forms/_switches.scss +89 -0
  151. data/assets/themes/j1/modules/materialize/scss/materialize.scss +41 -0
  152. data/assets/themes/j1/modules/{bsThemeSwitcher → themeSwitcher}/js/switcher.js +0 -0
  153. data/assets/themes/j1/modules/{bsThemeSwitcher → themeSwitcher}/js/switcher.min.js +0 -0
  154. data/lib/j1/version.rb +1 -1
  155. data/lib/starter_web/Gemfile +12 -16
  156. data/lib/starter_web/_config.yml +95 -21
  157. data/lib/starter_web/_data/blocks/banner.yml +1 -1
  158. data/lib/starter_web/_data/blocks/panel.yml +6 -6
  159. data/lib/starter_web/_data/j1_config.yml +7 -6
  160. data/lib/starter_web/_data/layouts/home.yml +13 -3
  161. data/lib/starter_web/_data/layouts/page.yml +10 -0
  162. data/lib/starter_web/_data/layouts/post.yml +10 -0
  163. data/lib/starter_web/_data/modules/defaults/{ssm.yml → fam.yml} +12 -15
  164. data/lib/starter_web/_data/modules/defaults/lunr_search.yml +171 -0
  165. data/lib/starter_web/_data/modules/defaults/navigator.yml +4 -4
  166. data/lib/starter_web/_data/modules/defaults/toccer.yml +4 -2
  167. data/lib/starter_web/_data/modules/fam.yml +158 -0
  168. data/lib/starter_web/_data/modules/{back2top.yml → lunr_search.yml} +15 -9
  169. data/lib/starter_web/_data/modules/navigator.yml +2 -2
  170. data/lib/starter_web/_data/modules/navigator_menu.yml +57 -6
  171. data/lib/starter_web/_data/modules/toccer.yml +0 -73
  172. data/lib/starter_web/_data/resources.yml +151 -104
  173. data/lib/starter_web/_includes/attributes.asciidoc +2 -2
  174. data/lib/starter_web/_includes/breadcrumbs.html +11 -0
  175. data/lib/starter_web/_plugins/debug.rb +0 -1
  176. data/lib/starter_web/_plugins/filters.rb +0 -1
  177. data/lib/starter_web/_plugins/{lorem-inline.rb → lorem_inline.rb} +1 -2
  178. data/lib/starter_web/_plugins/lunr_index.rb +313 -0
  179. data/lib/starter_web/_plugins/prettify.rb +0 -3
  180. data/lib/starter_web/_plugins/simple_search_filter.rb +0 -1
  181. data/lib/starter_web/_plugins/symlink_watcher.rb +2 -3
  182. data/lib/starter_web/assets/images/modules/attics/banner/lunr-banner-1280x800.jpg +0 -0
  183. data/lib/starter_web/assets/images/pages/winlogbeat/coordinate-map.png +0 -0
  184. data/lib/starter_web/assets/images/pages/winlogbeat/kibana-powershell.jpg +0 -0
  185. data/lib/starter_web/assets/images/pages/winlogbeat/option_ignore_outgoing.png +0 -0
  186. data/lib/starter_web/assets/images/pages/winlogbeat/winlogbeat-dashboard.png +0 -0
  187. data/lib/starter_web/collections/posts/public/featured/_posts/2018-05-01-confusion-about-base-url.adoc +2 -4
  188. data/lib/starter_web/collections/posts/public/featured/_posts/2019-05-01-top-open-source-static-site-generators.adoc +4 -2
  189. data/lib/starter_web/collections/posts/public/featured/_posts/2019-06-01-about-cookies.adoc +3 -2
  190. data/lib/starter_web/collections/posts/public/series/_posts/2018-11-01-docker-using-shared-folders.adoc +5 -4
  191. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-test-series.adoc +144 -0
  192. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-test-series.adoc +146 -0
  193. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-test-series.adoc +146 -0
  194. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-04-post-test-series.adoc +146 -0
  195. data/lib/starter_web/collections/posts/public/test_posts/_posts/2020-09-11-test_post.adoc +2 -4
  196. data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-20-minneapolis.adoc +2 -3
  197. data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-24-narcisse-snake-dens.adoc +2 -7
  198. data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-26-columbia-river.adoc +2 -6
  199. data/lib/starter_web/index.html +16 -10
  200. data/lib/starter_web/package.json +5 -2
  201. data/lib/starter_web/pages/public/about/about_site.adoc +0 -2
  202. data/lib/starter_web/pages/public/about/become_a_patron.adoc +1 -3
  203. data/lib/starter_web/pages/public/blog/navigator/archive.html +8 -1
  204. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +7 -3
  205. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +8 -1
  206. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +7 -2
  207. data/lib/starter_web/pages/public/blog/navigator/index.html +6 -2
  208. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/100_meet_and_greet_jekyll.adoc +3 -4
  209. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/200_preparations.adoc +3 -4
  210. data/lib/starter_web/pages/public/learn/kickstarter/web_in_a_day/300_first_awesome_web.adoc +3 -4
  211. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +25 -20
  212. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +14 -12
  213. data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +20 -20
  214. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +13 -8
  215. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +14 -9
  216. data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +9 -6
  217. data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +62 -8
  218. data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +9 -7
  219. data/lib/starter_web/pages/public/learn/roundtrip/600_lunr.adoc +237 -0
  220. data/lib/starter_web/pages/public/learn/roundtrip/610_fam.adoc +302 -0
  221. data/lib/starter_web/pages/public/learn/where_to_go.adoc +3 -7
  222. data/lib/starter_web/pages/public/legal/de/100_impress.adoc +3 -2
  223. data/lib/starter_web/pages/public/legal/de/200_terms_of_use.adoc +2 -1
  224. data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +2 -1
  225. data/lib/starter_web/pages/public/legal/de/400_license_agreement.adoc +2 -1
  226. data/lib/starter_web/pages/public/legal/de/500_support.adoc +2 -1
  227. data/lib/starter_web/pages/public/legal/en/000_copyright.adoc +30 -27
  228. data/lib/starter_web/pages/public/legal/en/100_impress.adoc +8 -5
  229. data/lib/starter_web/pages/public/legal/en/200_terms_of_use.adoc +12 -8
  230. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +7 -0
  231. data/lib/starter_web/pages/public/legal/en/400_license_agreement.adoc +8 -1
  232. data/lib/starter_web/pages/public/legal/en/500_support.adoc +8 -1
  233. data/lib/starter_web/pages/public/previewer/bootstrap_theme.adoc +3 -1
  234. data/lib/starter_web/pages/public/previewer/iframer.adoc +36 -28
  235. data/lib/starter_web/pages/public/previewer/justified_gallery.html +2 -1
  236. data/lib/starter_web/pages/public/previewer/mdi_icons_preview.adoc +2 -1
  237. data/lib/starter_web/pages/public/previewer/rouge.adoc +4 -2
  238. data/lib/starter_web/pages/public/previewer/twitter_emoji_preview.adoc +2 -1
  239. data/lib/starter_web/pages/public/test_pages/breadcrumbs_tester.adoc +62 -0
  240. data/lib/starter_web/pages/public/test_pages/deck_of_posts.adoc +3 -0
  241. data/lib/starter_web/pages/public/test_pages/floating_actions_button.adoc +523 -0
  242. data/lib/starter_web/pages/public/test_pages/floating_ad.adoc +1 -0
  243. data/lib/starter_web/pages/public/test_pages/floating_div.adoc +1 -0
  244. data/lib/starter_web/pages/public/test_pages/lunr_tester.adoc +89 -0
  245. data/lib/starter_web/pages/public/test_pages/nav_pagination_tester.adoc +1 -0
  246. data/lib/starter_web/pages/public/test_pages/page_attribute_tester.adoc +1 -0
  247. data/lib/starter_web/pages/public/test_pages/responsive_images.adoc +3 -2
  248. data/lib/starter_web/pages/public/test_pages/responsive_tables.adoc +1 -0
  249. data/lib/starter_web/pages/public/test_pages/toccer_tester.adoc +2245 -0
  250. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  251. data/lib/starter_web/utilsrv/package.json +1 -1
  252. metadata +137 -29
  253. data/assets/data/search.json +0 -165
  254. data/assets/data/ssm.html +0 -242
  255. data/assets/themes/j1/adapter/js/back2top.js +0 -231
  256. data/assets/themes/j1/modules/jekyllSearch/js/simple-jekyll-search.js +0 -468
  257. data/assets/themes/j1/modules/jekyllSearch/js/simple-jekyll-search.min.js +0 -6
  258. data/assets/themes/j1/modules/tocbot/css/theme/uno.css +0 -95
  259. data/assets/themes/j1/modules/tocbot/css/theme/uno.min.css +0 -15
  260. data/assets/themes/j1/modules/tocbot/css/tocbot.css +0 -75
  261. data/assets/themes/j1/modules/tocbot/css/tocbot.min.css +0 -19
  262. data/assets/themes/j1/modules/tocbot/js/tocbot.js +0 -19
  263. data/assets/themes/j1/modules/tocbot/js/tocbot.min.js +0 -19
  264. data/lib/starter_web/_data/modules/defaults/back2top.yml +0 -146
  265. data/lib/starter_web/_data/modules/defaults/stickybits.yml +0 -36
  266. data/lib/starter_web/_data/modules/ssm.yml +0 -142
@@ -0,0 +1,382 @@
1
+ (function($, anim) {
2
+ 'use strict';
3
+
4
+ let _defaults = {
5
+ opacity: 0.5,
6
+ inDuration: 250,
7
+ outDuration: 250,
8
+ onOpenStart: null,
9
+ onOpenEnd: null,
10
+ onCloseStart: null,
11
+ onCloseEnd: null,
12
+ preventScrolling: true,
13
+ dismissible: true,
14
+ startingTop: '4%',
15
+ endingTop: '10%'
16
+ };
17
+
18
+ /**
19
+ * @class
20
+ *
21
+ */
22
+ class Modal extends Component {
23
+ /**
24
+ * Construct Modal instance and set up overlay
25
+ * @constructor
26
+ * @param {Element} el
27
+ * @param {Object} options
28
+ */
29
+ constructor(el, options) {
30
+ super(Modal, el, options);
31
+
32
+ this.el.M_Modal = this;
33
+
34
+ /**
35
+ * Options for the modal
36
+ * @member Modal#options
37
+ * @prop {Number} [opacity=0.5] - Opacity of the modal overlay
38
+ * @prop {Number} [inDuration=250] - Length in ms of enter transition
39
+ * @prop {Number} [outDuration=250] - Length in ms of exit transition
40
+ * @prop {Function} onOpenStart - Callback function called before modal is opened
41
+ * @prop {Function} onOpenEnd - Callback function called after modal is opened
42
+ * @prop {Function} onCloseStart - Callback function called before modal is closed
43
+ * @prop {Function} onCloseEnd - Callback function called after modal is closed
44
+ * @prop {Boolean} [dismissible=true] - Allow modal to be dismissed by keyboard or overlay click
45
+ * @prop {String} [startingTop='4%'] - startingTop
46
+ * @prop {String} [endingTop='10%'] - endingTop
47
+ */
48
+ this.options = $.extend({}, Modal.defaults, options);
49
+
50
+ /**
51
+ * Describes open/close state of modal
52
+ * @type {Boolean}
53
+ */
54
+ this.isOpen = false;
55
+
56
+ this.id = this.$el.attr('id');
57
+ this._openingTrigger = undefined;
58
+ this.$overlay = $('<div class="modal-overlay"></div>');
59
+ this.el.tabIndex = 0;
60
+ this._nthModalOpened = 0;
61
+
62
+ Modal._count++;
63
+ this._setupEventHandlers();
64
+ }
65
+
66
+ static get defaults() {
67
+ return _defaults;
68
+ }
69
+
70
+ static init(els, options) {
71
+ return super.init(this, els, options);
72
+ }
73
+
74
+ /**
75
+ * Get Instance
76
+ */
77
+ static getInstance(el) {
78
+ let domElem = !!el.jquery ? el[0] : el;
79
+ return domElem.M_Modal;
80
+ }
81
+
82
+ /**
83
+ * Teardown component
84
+ */
85
+ destroy() {
86
+ Modal._count--;
87
+ this._removeEventHandlers();
88
+ this.el.removeAttribute('style');
89
+ this.$overlay.remove();
90
+ this.el.M_Modal = undefined;
91
+ }
92
+
93
+ /**
94
+ * Setup Event Handlers
95
+ */
96
+ _setupEventHandlers() {
97
+ this._handleOverlayClickBound = this._handleOverlayClick.bind(this);
98
+ this._handleModalCloseClickBound = this._handleModalCloseClick.bind(this);
99
+
100
+ if (Modal._count === 1) {
101
+ document.body.addEventListener('click', this._handleTriggerClick);
102
+ }
103
+ this.$overlay[0].addEventListener('click', this._handleOverlayClickBound);
104
+ this.el.addEventListener('click', this._handleModalCloseClickBound);
105
+ }
106
+
107
+ /**
108
+ * Remove Event Handlers
109
+ */
110
+ _removeEventHandlers() {
111
+ if (Modal._count === 0) {
112
+ document.body.removeEventListener('click', this._handleTriggerClick);
113
+ }
114
+ this.$overlay[0].removeEventListener('click', this._handleOverlayClickBound);
115
+ this.el.removeEventListener('click', this._handleModalCloseClickBound);
116
+ }
117
+
118
+ /**
119
+ * Handle Trigger Click
120
+ * @param {Event} e
121
+ */
122
+ _handleTriggerClick(e) {
123
+ let $trigger = $(e.target).closest('.modal-trigger');
124
+ if ($trigger.length) {
125
+ let modalId = M.getIdFromTrigger($trigger[0]);
126
+ let modalInstance = document.getElementById(modalId).M_Modal;
127
+ if (modalInstance) {
128
+ modalInstance.open($trigger);
129
+ }
130
+ e.preventDefault();
131
+ }
132
+ }
133
+
134
+ /**
135
+ * Handle Overlay Click
136
+ */
137
+ _handleOverlayClick() {
138
+ if (this.options.dismissible) {
139
+ this.close();
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Handle Modal Close Click
145
+ * @param {Event} e
146
+ */
147
+ _handleModalCloseClick(e) {
148
+ let $closeTrigger = $(e.target).closest('.modal-close');
149
+ if ($closeTrigger.length) {
150
+ this.close();
151
+ }
152
+ }
153
+
154
+ /**
155
+ * Handle Keydown
156
+ * @param {Event} e
157
+ */
158
+ _handleKeydown(e) {
159
+ // ESC key
160
+ if (e.keyCode === 27 && this.options.dismissible) {
161
+ this.close();
162
+ }
163
+ }
164
+
165
+ /**
166
+ * Handle Focus
167
+ * @param {Event} e
168
+ */
169
+ _handleFocus(e) {
170
+ // Only trap focus if this modal is the last model opened (prevents loops in nested modals).
171
+ if (!this.el.contains(e.target) && this._nthModalOpened === Modal._modalsOpen) {
172
+ this.el.focus();
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Animate in modal
178
+ */
179
+ _animateIn() {
180
+ // Set initial styles
181
+ $.extend(this.el.style, {
182
+ display: 'block',
183
+ opacity: 0
184
+ });
185
+ $.extend(this.$overlay[0].style, {
186
+ display: 'block',
187
+ opacity: 0
188
+ });
189
+
190
+ // Animate overlay
191
+ anim({
192
+ targets: this.$overlay[0],
193
+ opacity: this.options.opacity,
194
+ duration: this.options.inDuration,
195
+ easing: 'easeOutQuad'
196
+ });
197
+
198
+ // Define modal animation options
199
+ let enterAnimOptions = {
200
+ targets: this.el,
201
+ duration: this.options.inDuration,
202
+ easing: 'easeOutCubic',
203
+ // Handle modal onOpenEnd callback
204
+ complete: () => {
205
+ if (typeof this.options.onOpenEnd === 'function') {
206
+ this.options.onOpenEnd.call(this, this.el, this._openingTrigger);
207
+ }
208
+ }
209
+ };
210
+
211
+ // Bottom sheet animation
212
+ if (this.el.classList.contains('bottom-sheet')) {
213
+ $.extend(enterAnimOptions, {
214
+ bottom: 0,
215
+ opacity: 1
216
+ });
217
+ anim(enterAnimOptions);
218
+
219
+ // Normal modal animation
220
+ } else {
221
+ $.extend(enterAnimOptions, {
222
+ top: [this.options.startingTop, this.options.endingTop],
223
+ opacity: 1,
224
+ scaleX: [0.8, 1],
225
+ scaleY: [0.8, 1]
226
+ });
227
+ anim(enterAnimOptions);
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Animate out modal
233
+ */
234
+ _animateOut() {
235
+ // Animate overlay
236
+ anim({
237
+ targets: this.$overlay[0],
238
+ opacity: 0,
239
+ duration: this.options.outDuration,
240
+ easing: 'easeOutQuart'
241
+ });
242
+
243
+ // Define modal animation options
244
+ let exitAnimOptions = {
245
+ targets: this.el,
246
+ duration: this.options.outDuration,
247
+ easing: 'easeOutCubic',
248
+ // Handle modal ready callback
249
+ complete: () => {
250
+ this.el.style.display = 'none';
251
+ this.$overlay.remove();
252
+
253
+ // Call onCloseEnd callback
254
+ if (typeof this.options.onCloseEnd === 'function') {
255
+ this.options.onCloseEnd.call(this, this.el);
256
+ }
257
+ }
258
+ };
259
+
260
+ // Bottom sheet animation
261
+ if (this.el.classList.contains('bottom-sheet')) {
262
+ $.extend(exitAnimOptions, {
263
+ bottom: '-100%',
264
+ opacity: 0
265
+ });
266
+ anim(exitAnimOptions);
267
+
268
+ // Normal modal animation
269
+ } else {
270
+ $.extend(exitAnimOptions, {
271
+ top: [this.options.endingTop, this.options.startingTop],
272
+ opacity: 0,
273
+ scaleX: 0.8,
274
+ scaleY: 0.8
275
+ });
276
+ anim(exitAnimOptions);
277
+ }
278
+ }
279
+
280
+ /**
281
+ * Open Modal
282
+ * @param {cash} [$trigger]
283
+ */
284
+ open($trigger) {
285
+ if (this.isOpen) {
286
+ return;
287
+ }
288
+
289
+ this.isOpen = true;
290
+ Modal._modalsOpen++;
291
+ this._nthModalOpened = Modal._modalsOpen;
292
+
293
+ // Set Z-Index based on number of currently open modals
294
+ this.$overlay[0].style.zIndex = 1000 + Modal._modalsOpen * 2;
295
+ this.el.style.zIndex = 1000 + Modal._modalsOpen * 2 + 1;
296
+
297
+ // Set opening trigger, undefined indicates modal was opened by javascript
298
+ this._openingTrigger = !!$trigger ? $trigger[0] : undefined;
299
+
300
+ // onOpenStart callback
301
+ if (typeof this.options.onOpenStart === 'function') {
302
+ this.options.onOpenStart.call(this, this.el, this._openingTrigger);
303
+ }
304
+
305
+ if (this.options.preventScrolling) {
306
+ document.body.style.overflow = 'hidden';
307
+ }
308
+
309
+ this.el.classList.add('open');
310
+ this.el.insertAdjacentElement('afterend', this.$overlay[0]);
311
+
312
+ if (this.options.dismissible) {
313
+ this._handleKeydownBound = this._handleKeydown.bind(this);
314
+ this._handleFocusBound = this._handleFocus.bind(this);
315
+ document.addEventListener('keydown', this._handleKeydownBound);
316
+ document.addEventListener('focus', this._handleFocusBound, true);
317
+ }
318
+
319
+ anim.remove(this.el);
320
+ anim.remove(this.$overlay[0]);
321
+ this._animateIn();
322
+
323
+ // Focus modal
324
+ this.el.focus();
325
+
326
+ return this;
327
+ }
328
+
329
+ /**
330
+ * Close Modal
331
+ */
332
+ close() {
333
+ if (!this.isOpen) {
334
+ return;
335
+ }
336
+
337
+ this.isOpen = false;
338
+ Modal._modalsOpen--;
339
+ this._nthModalOpened = 0;
340
+
341
+ // Call onCloseStart callback
342
+ if (typeof this.options.onCloseStart === 'function') {
343
+ this.options.onCloseStart.call(this, this.el);
344
+ }
345
+
346
+ this.el.classList.remove('open');
347
+
348
+ // Enable body scrolling only if there are no more modals open.
349
+ if (Modal._modalsOpen === 0) {
350
+ document.body.style.overflow = '';
351
+ }
352
+
353
+ if (this.options.dismissible) {
354
+ document.removeEventListener('keydown', this._handleKeydownBound);
355
+ document.removeEventListener('focus', this._handleFocusBound, true);
356
+ }
357
+
358
+ anim.remove(this.el);
359
+ anim.remove(this.$overlay[0]);
360
+ this._animateOut();
361
+ return this;
362
+ }
363
+ }
364
+
365
+ /**
366
+ * @static
367
+ * @memberof Modal
368
+ */
369
+ Modal._modalsOpen = 0;
370
+
371
+ /**
372
+ * @static
373
+ * @memberof Modal
374
+ */
375
+ Modal._count = 0;
376
+
377
+ M.Modal = Modal;
378
+
379
+ if (M.jQueryLoaded) {
380
+ M.initializeJqueryWrapper(Modal, 'modal', 'M_Modal');
381
+ }
382
+ })(cash, M.anime);
@@ -0,0 +1,138 @@
1
+ (function($) {
2
+ 'use strict';
3
+
4
+ let _defaults = {
5
+ responsiveThreshold: 0 // breakpoint for swipeable
6
+ };
7
+
8
+ class Parallax extends Component {
9
+ constructor(el, options) {
10
+ super(Parallax, el, options);
11
+
12
+ this.el.M_Parallax = this;
13
+
14
+ /**
15
+ * Options for the Parallax
16
+ * @member Parallax#options
17
+ * @prop {Number} responsiveThreshold
18
+ */
19
+ this.options = $.extend({}, Parallax.defaults, options);
20
+ this._enabled = window.innerWidth > this.options.responsiveThreshold;
21
+
22
+ this.$img = this.$el.find('img').first();
23
+ this.$img.each(function() {
24
+ let el = this;
25
+ if (el.complete) $(el).trigger('load');
26
+ });
27
+
28
+ this._updateParallax();
29
+ this._setupEventHandlers();
30
+ this._setupStyles();
31
+
32
+ Parallax._parallaxes.push(this);
33
+ }
34
+
35
+ static get defaults() {
36
+ return _defaults;
37
+ }
38
+
39
+ static init(els, options) {
40
+ return super.init(this, els, options);
41
+ }
42
+
43
+ /**
44
+ * Get Instance
45
+ */
46
+ static getInstance(el) {
47
+ let domElem = !!el.jquery ? el[0] : el;
48
+ return domElem.M_Parallax;
49
+ }
50
+
51
+ /**
52
+ * Teardown component
53
+ */
54
+ destroy() {
55
+ Parallax._parallaxes.splice(Parallax._parallaxes.indexOf(this), 1);
56
+ this.$img[0].style.transform = '';
57
+ this._removeEventHandlers();
58
+
59
+ this.$el[0].M_Parallax = undefined;
60
+ }
61
+
62
+ static _handleScroll() {
63
+ for (let i = 0; i < Parallax._parallaxes.length; i++) {
64
+ let parallaxInstance = Parallax._parallaxes[i];
65
+ parallaxInstance._updateParallax.call(parallaxInstance);
66
+ }
67
+ }
68
+
69
+ static _handleWindowResize() {
70
+ for (let i = 0; i < Parallax._parallaxes.length; i++) {
71
+ let parallaxInstance = Parallax._parallaxes[i];
72
+ parallaxInstance._enabled =
73
+ window.innerWidth > parallaxInstance.options.responsiveThreshold;
74
+ }
75
+ }
76
+
77
+ _setupEventHandlers() {
78
+ this._handleImageLoadBound = this._handleImageLoad.bind(this);
79
+ this.$img[0].addEventListener('load', this._handleImageLoadBound);
80
+
81
+ if (Parallax._parallaxes.length === 0) {
82
+ Parallax._handleScrollThrottled = M.throttle(Parallax._handleScroll, 5);
83
+ window.addEventListener('scroll', Parallax._handleScrollThrottled);
84
+
85
+ Parallax._handleWindowResizeThrottled = M.throttle(Parallax._handleWindowResize, 5);
86
+ window.addEventListener('resize', Parallax._handleWindowResizeThrottled);
87
+ }
88
+ }
89
+
90
+ _removeEventHandlers() {
91
+ this.$img[0].removeEventListener('load', this._handleImageLoadBound);
92
+
93
+ if (Parallax._parallaxes.length === 0) {
94
+ window.removeEventListener('scroll', Parallax._handleScrollThrottled);
95
+ window.removeEventListener('resize', Parallax._handleWindowResizeThrottled);
96
+ }
97
+ }
98
+
99
+ _setupStyles() {
100
+ this.$img[0].style.opacity = 1;
101
+ }
102
+
103
+ _handleImageLoad() {
104
+ this._updateParallax();
105
+ }
106
+
107
+ _updateParallax() {
108
+ let containerHeight = this.$el.height() > 0 ? this.el.parentNode.offsetHeight : 500;
109
+ let imgHeight = this.$img[0].offsetHeight;
110
+ let parallaxDist = imgHeight - containerHeight;
111
+ let bottom = this.$el.offset().top + containerHeight;
112
+ let top = this.$el.offset().top;
113
+ let scrollTop = M.getDocumentScrollTop();
114
+ let windowHeight = window.innerHeight;
115
+ let windowBottom = scrollTop + windowHeight;
116
+ let percentScrolled = (windowBottom - top) / (containerHeight + windowHeight);
117
+ let parallax = parallaxDist * percentScrolled;
118
+
119
+ if (!this._enabled) {
120
+ this.$img[0].style.transform = '';
121
+ } else if (bottom > scrollTop && top < scrollTop + windowHeight) {
122
+ this.$img[0].style.transform = `translate3D(-50%, ${parallax}px, 0)`;
123
+ }
124
+ }
125
+ }
126
+
127
+ /**
128
+ * @static
129
+ * @memberof Parallax
130
+ */
131
+ Parallax._parallaxes = [];
132
+
133
+ M.Parallax = Parallax;
134
+
135
+ if (M.jQueryLoaded) {
136
+ M.initializeJqueryWrapper(Parallax, 'parallax', 'M_Parallax');
137
+ }
138
+ })(cash);