j1-template 2021.1.2 → 2021.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/layout_metadata_generator.html +23 -9
  3. data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +7 -15
  4. data/_includes/themes/j1/modules/connectors/analytic/google-analytics.html +9 -5
  5. data/_includes/themes/j1/modules/navigator/generator.html +2 -2
  6. data/_includes/themes/j1/modules/navigator/procedures/topsearch.proc +2 -2
  7. data/_includes/themes/j1/procedures/posts/collate_timeline.proc +8 -7
  8. data/_layouts/default.html +4 -7
  9. data/assets/data/authclient.html +231 -229
  10. data/assets/data/banner.html +30 -32
  11. data/assets/data/cookieconsent.html +249 -0
  12. data/assets/data/fam.html +1 -1
  13. data/assets/data/footer.html +1 -1
  14. data/assets/data/gallery_customizer.html +10 -5
  15. data/assets/data/menu.html +3 -3
  16. data/assets/data/mmenu.html +4 -3
  17. data/assets/data/mmenu_sidebar.html +1 -1
  18. data/assets/data/mmenu_toc.html +1 -1
  19. data/assets/data/panel.html +11 -10
  20. data/assets/data/quicklinks.html +20 -18
  21. data/assets/data/themes.json +6 -6
  22. data/assets/themes/j1/adapter/js/{cookiebar.js → cookieConsent.js} +129 -55
  23. data/assets/themes/j1/adapter/js/j1.js +160 -151
  24. data/assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js +3 -2
  25. data/assets/themes/j1/adapter/js/mmenu.js +8 -4
  26. data/assets/themes/j1/adapter/js/navigator.1.js +896 -0
  27. data/assets/themes/j1/adapter/js/navigator.2.js +928 -0
  28. data/assets/themes/j1/adapter/js/navigator.js +176 -209
  29. data/assets/themes/j1/adapter/js/themer.1.js +326 -0
  30. data/assets/themes/j1/adapter/js/themer.js +41 -57
  31. data/assets/themes/j1/adapter/js/toccer.js +4 -45
  32. data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.css +17 -14
  33. data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.min.css +1 -1
  34. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +3859 -187
  35. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +1 -1
  36. data/assets/themes/j1/core/js/template.js +3 -9
  37. data/assets/themes/j1/core/js/template.js.map +1 -1
  38. data/assets/themes/j1/core/js/template.min.js +3 -9
  39. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  40. data/assets/themes/j1/modules/cookieConsent/LICENSE +21 -0
  41. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +286 -0
  42. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +28 -0
  43. data/assets/themes/j1/modules/fam/css/{uno → theme/uno}/fam.css +0 -0
  44. data/assets/themes/j1/modules/fam/css/theme/uno/fam.min.css +15 -0
  45. data/assets/themes/j1/modules/fam/js/fam.js +1 -6
  46. data/assets/themes/j1/modules/iframeResizer/examples/frame.absolute.html +4 -2
  47. data/assets/themes/j1/modules/iframeResizer/examples/frame.content.html +4 -3
  48. data/assets/themes/j1/modules/iframeResizer/examples/frame.hover.html +4 -2
  49. data/assets/themes/j1/modules/iframeResizer/examples/frame.nested.html +4 -2
  50. data/assets/themes/j1/modules/iframeResizer/examples/frame.textarea.html +4 -2
  51. data/assets/themes/j1/modules/iframeResizer/examples/frame.tolerance.html +4 -2
  52. data/assets/themes/j1/modules/iframeResizer/examples/index.html +2 -0
  53. data/assets/themes/j1/modules/iframeResizer/examples/two.html +4 -2
  54. data/assets/themes/j1/modules/mmenuLight/css/{mmenu.css → mmenu-light.css} +0 -0
  55. data/assets/themes/j1/modules/mmenuLight/css/{mmenu.min.css → mmenu-light.min.css} +0 -0
  56. data/assets/themes/j1/modules/mmenuLight/css/theme/{uno.css → uno/mmenu.css} +0 -0
  57. data/assets/themes/j1/modules/mmenuLight/css/theme/{uno.min.css → uno/mmenu.min.css} +0 -0
  58. data/assets/themes/j1/modules/rtable/css/theme/{uno.css → uno/rtable.css} +0 -0
  59. data/assets/themes/j1/modules/rtable/css/theme/{uno.min.css → uno/rtable.min.css} +0 -0
  60. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +33 -47
  61. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +410 -2
  62. data/assets/themes/j1/modules/util/js/domready.js +146 -0
  63. data/assets/themes/j1/modules/util/js/gtag-opt-in.js +1 -0
  64. data/lib/j1/version.rb +1 -1
  65. data/lib/j1_app/j1_auth_manager/auth_manager.rb +2 -3
  66. data/lib/starter_web/Gemfile +1 -1
  67. data/lib/starter_web/_config.yml +6 -5
  68. data/lib/starter_web/_data/_defaults/resources.yml +11 -8
  69. data/lib/starter_web/_data/apps/defaults/justifiedGalleryCustomizer.yml +1 -0
  70. data/lib/starter_web/_data/blocks/banner.yml +5 -3
  71. data/lib/starter_web/_data/blocks/panel.yml +9 -7
  72. data/lib/starter_web/_data/builder/blog_navigator.yml +1 -0
  73. data/lib/starter_web/_data/j1_config.yml +20 -17
  74. data/lib/starter_web/_data/layouts/default.yml +1 -1
  75. data/lib/starter_web/_data/layouts/home.yml +6 -5
  76. data/lib/starter_web/_data/layouts/page.yml +1 -1
  77. data/lib/starter_web/_data/modules/{cookiebar.yml → cookieconsent.yml} +4 -4
  78. data/lib/starter_web/_data/modules/defaults/authentication.yml +1 -0
  79. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +135 -0
  80. data/lib/starter_web/_data/modules/defaults/navigator.yml +5 -2
  81. data/lib/starter_web/_data/modules/defaults/themer.yml +2 -1
  82. data/lib/starter_web/_data/modules/navigator.yml +24 -21
  83. data/lib/starter_web/_data/pages/builder.yml +7 -7
  84. data/lib/starter_web/_data/private.default.yml +119 -0
  85. data/lib/starter_web/_data/private.yml +6 -6
  86. data/lib/starter_web/_data/resources.yml +15 -14
  87. data/lib/starter_web/_includes/attributes.asciidoc +10 -1
  88. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  89. data/lib/starter_web/assets/images/modules/attics/{cookies-1920x1200-bw.jpg → cookies-1920x1200.jpg} +0 -0
  90. data/lib/starter_web/assets/images/modules/attics/lianhao-1920x1280.jpg +0 -0
  91. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +3 -3
  92. data/lib/starter_web/collections/posts/public/featured/_posts/2020-01-01-about-cookies.adoc +4 -4
  93. data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-01-site-generators.adoc +1 -7
  94. data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-03-about-j1.adoc +2 -7
  95. data/lib/starter_web/dot.gitignore +1 -1
  96. data/lib/starter_web/index.html +1 -1
  97. data/lib/starter_web/package.json +1 -1
  98. data/lib/starter_web/pages/public/blog/navigator/archive.html +4 -3
  99. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +14 -8
  100. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +11 -8
  101. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +6 -5
  102. data/lib/starter_web/pages/public/cookieConsent.adoc +93 -0
  103. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +2 -1
  104. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +104 -209
  105. data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +6 -1
  106. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  107. data/lib/starter_web/utilsrv/package.json +1 -1
  108. metadata +26 -15
  109. data/_includes/themes/j1/modules/navigator/generator.org.html +0 -232
  110. data/assets/data/cookiebar.html +0 -285
  111. data/lib/starter_web/_data/modules/defaults/cookiebar.yml +0 -132
@@ -80,7 +80,7 @@ regenerate: true
80
80
 
81
81
  <!-- [INFO ] [j1.assets.data.mmenu.html ] [ set meta data (robots) to exclude HTML datafiles from index ] -->
82
82
  <head>
83
- <meta name="robots" content="noindex, nofollow" \>
83
+ <meta name="robots" content="noindex, nofollow" />
84
84
  </head>
85
85
 
86
86
  {% comment %} Main
@@ -37,7 +37,7 @@ regenerate: true
37
37
 
38
38
  <!-- [INFO ] [j1.assets.data.mmenu_toc.html ] [ set meta data (robots) to exclude HTML datafiles from index ] -->
39
39
  <head>
40
- <meta name="robots" content="noindex, nofollow" \>
40
+ <meta name="robots" content="noindex, nofollow" />
41
41
  </head>
42
42
 
43
43
  {% comment %} Main
@@ -65,7 +65,7 @@ regenerate: true
65
65
 
66
66
  <!-- [INFO ] [j1.assets.data.panel.html ] [ set meta data (robots) to exclude HTML datafiles from index ] -->
67
67
  <head>
68
- <meta name="robots" content="noindex, nofollow" \>
68
+ <meta name="robots" content="noindex, nofollow" />
69
69
  </head>
70
70
 
71
71
  {% comment %} Main
@@ -98,7 +98,7 @@ regenerate: true
98
98
  {% assign tagline = panel_settings.tagline|strip_newlines %}
99
99
  {% assign buttons = panel_settings.buttons %}
100
100
  {% assign header = panel_settings.header %}
101
- {% assign properties = panel_settings.properties %}
101
+ {% assign properties = panel_settings.properties %}
102
102
  {% assign cards = panel_settings.cards %}
103
103
  {% endif %}
104
104
  {% endfor %}
@@ -148,9 +148,9 @@ regenerate: true
148
148
  {% assign panel_options = panel_config_defaults.intro | merge: panel_settings %}
149
149
  {% if debug %}<!-- panel_options: {{panel_options}} -->{% endif %}
150
150
  <!-- Panel {{panel_settings.id}} -->
151
- <section id="{{panel_settings.id}}">
151
+ <section id="{{panel_settings.id}}" class="container">
152
152
  <!-- Main Container -->
153
- <div class="container">
153
+ <div class="row {{panel_settings.properties}}">
154
154
 
155
155
  <!-- Heading -->
156
156
  <div class="row">
@@ -229,7 +229,7 @@ regenerate: true
229
229
  </span>
230
230
  {% endif %}
231
231
  </div>
232
- <h3 class="m-0 md-white">{{card_title}}</h3>
232
+ <h3 class="m-0">{{card_title}}</h3>
233
233
  </div>
234
234
  </div>
235
235
 
@@ -251,9 +251,9 @@ regenerate: true
251
251
  <hr class="my-3">
252
252
 
253
253
  {% if button_target == null %}
254
- <a class="card-link md-grey-500" href="{{button_href}}">{{button_text}}</a>
254
+ <a class="card-link text-muted" href="{{button_href}}">{{button_text}}</a>
255
255
  {% else %}
256
- <a class="card-link md-grey-500" href="{{button_href}}" target="{{button_target}}">{{button_text}}</a>
256
+ <a class="card-link md-grey-600" href="{{button_href}}" target="{{button_target}}">{{button_text}}</a>
257
257
  {% endif %}
258
258
  </div>
259
259
 
@@ -402,8 +402,9 @@ regenerate: true
402
402
 
403
403
  {% assign panel_options = panel_config_defaults.news|merge: panel_settings %}
404
404
  {% if debug %}<!-- panel_options: {{panel_options}} -->{% endif %}
405
- <section id="{{panel_settings.id}}">
406
- <div class="container">
405
+ <!-- Panel {{panel_settings.id}} -->
406
+ <section id="{{panel_settings.id}}" class="container">
407
+ <div class="row {{panel_settings.properties}}">
407
408
 
408
409
  {% if panel_options.title %}
409
410
  <!-- Heading -->
@@ -494,7 +495,7 @@ regenerate: true
494
495
  <i class="mdi mdi-calendar-blank mdi-md-grey mr-1"></i>
495
496
  {{post.date|date:"%Y %B, %e"}}
496
497
  </div>
497
- <a class="card-link md-grey-500"
498
+ <a class="card-link text-muted"
498
499
  href="{{post.url}}">
499
500
  {{readmore_text}} · {{post.tagline}}
500
501
  </a>
@@ -33,13 +33,13 @@ regenerate: true
33
33
 
34
34
  {% comment %} Set config files
35
35
  -------------------------------------------------------------------------------- {% endcomment %}
36
- {% assign j1_config = site.data.j1_config %}
36
+ {% assign j1_config = site.data.j1_config %}
37
37
  {% assign authentication_defaults = modules.defaults.authentication.defaults %}
38
38
  {% assign authentication_settings = modules.authentication.settings %}
39
39
  {% assign navigator_defaults = modules.defaults.navigator.defaults %}
40
40
  {% assign navigator_settings = modules.navigator.settings %}
41
- {% assign cookie_defaults = modules.defaults.cookiebar.defaults %}
42
- {% assign cookie_settings = modules.cookiebar.settings %}
41
+ {% assign consent_defaults = modules.defaults.cookieconsent.defaults %}
42
+ {% assign consent_settings = modules.cookieconsent.settings %}
43
43
  {% assign quick_search_defaults = modules.defaults.quicksearch.defaults %}
44
44
  {% assign quick_search_settings = modules.quicksearch.settings %}
45
45
 
@@ -61,7 +61,9 @@ regenerate: true
61
61
  {% assign authentication_options = authentication_defaults | merge: authentication_settings %}
62
62
  {% assign quick_search_options = quick_search_defaults | merge: quick_search_settings %}
63
63
  {% assign quicklinks_options = nav_quicklinks_defaults | merge: nav_quicklinks_settings %}
64
- {% assign cookie_options = cookie_defaults | merge: cookie_settings %}
64
+ {% assign consent_options = consent_defaults | merge: consent_settings %}
65
+
66
+ consent_options: {{ consent_options | debug }}
65
67
 
66
68
  {% comment %} Control Center disabled
67
69
  --------------------------------------------------------------------------------
@@ -172,22 +174,22 @@ regenerate: true
172
174
 
173
175
  {% comment %} Show|Hide CookieConsent icon
174
176
  -------------------------------------------------------------------------------- {% endcomment %}
175
- {% if cookie_options.enabled %}
176
- {% assign cookie_enabled = true %}
177
+ {% if consent_options.enabled %}
178
+ {% assign consent_enabled = true %}
177
179
  {% else %}
178
- {% assign cookie_enabled = false %}
180
+ {% assign consent_enabled = false %}
179
181
  {% endif %}
180
182
 
181
- {% if cookie_options.show_cookie_icon %}
182
- {% assign cookie_icon_enabled = true %}
183
+ {% if consent_options.show_cookie_icon %}
184
+ {% assign consent_icon_enabled = true %}
183
185
  {% else %}
184
- {% assign cookie_icon_enabled = false %}
186
+ {% assign consent_icon_enabled = false %}
185
187
  {% endif %}
186
188
 
187
- {% if cookie_enabled and cookie_icon_enabled %}
188
- {% assign show_cookiebar_icon = true %}
189
+ {% if consent_enabled and consent_icon_enabled %}
190
+ {% assign show_cookieconsent_icon = true %}
189
191
  {% else %}
190
- {% assign show_cookiebar_icon = false %}
192
+ {% assign show_cookieconsent_icon = false %}
191
193
  {% endif %}
192
194
 
193
195
 
@@ -212,19 +214,19 @@ regenerate: true
212
214
 
213
215
  <!-- [INFO ] [j1.assets.data.quicklinks.html ] [ set meta data (robots) to exclude HTML datafiles from index ] -->
214
216
  <head>
215
- <meta name="robots" content="noindex, nofollow" \>
217
+ <meta name="robots" content="noindex, nofollow" />
216
218
  </head>
217
219
 
218
220
  {% comment %} Main
219
221
  -------------------------------------------------------------------------------- {% endcomment %}
220
222
  <!-- [INFO ] [j1.modules.navigator.quicklinks.html ] [AuthManager detected as: {{ show_auth_manager_icon }}] -->
221
- <!-- [INFO ] [j1.modules.navigator.quicklinks.html ] [CookieConsent detected as: {{ cookie_enabled }}] -->
222
- <!-- [INFO ] [j1.modules.navigator.quicklinks.html ] [Show CookieConsent icon detected as: {{ show_cookiebar_icon }}] -->
223
+ <!-- [INFO ] [j1.modules.navigator.quicklinks.html ] [CookieConsent detected as: {{ consent_enabled }}] -->
224
+ <!-- [INFO ] [j1.modules.navigator.quicklinks.html ] [Show CookieConsent icon detected as: {{ show_cookieconsent_icon }}] -->
223
225
  <!-- [INFO ] [j1.modules.navigator.quicklinks.html ] [Show ControlCenter icon detected as: {{ show_control_center_icon }}] -->
224
226
  <!-- [INFO ] [j1.modules.navigator.quicklinks.html ] [Set icon familiy as: {{ icon_family }}] -->
225
227
  <!-- [INFO ] [j1.modules.navigator.quicklinks.html ] [Set icon size as: {{ icon_size }}] -->
226
228
 
227
- <ul class="navbar-nav">
229
+ <ul id="{{quicklinks_options.xhr_data_element}}" class="navbar-nav">
228
230
  {% if back_url != "none" %}<li id="quickLinksHomeButton" class="nav-item"><a id="page_back_id" class="nav-icon" href="{{back_url}}" aria-label="Page back"><i class="{{icon_family}} {{icon_family}}-{{back_icon}} {{icon_size}}"></i></a></li>{% endif %}
229
231
  {% if home_url != "none" %}<li id="quickLinksHomeButton" class="nav-item"><a id="home_id" class="nav-icon" href="{{home_url}}" aria-label="Home"><i class="{{icon_family}} {{icon_family}}-{{home_icon}} {{icon_size}}"></i></a></li>{% endif %}
230
232
  {% if disqus_url != "none" %}<li id="quickLinksDisqusButton" class="nav-item"><a id="disqus_id" class="nav-icon" href="{{disqus_url}}" aria-label="Disqus" target="blank"><i class="{{icon_family}} {{icon_family}}-{{disqus_icon}} {{icon_size}}"></i></a></li>{% endif %}
@@ -233,7 +235,7 @@ regenerate: true
233
235
  {% if facebook_url != "none" %}<li id="quickLinksFacebookButton" class="nav-item"><a id="facebook_id" class="nav-icon" href="{{facebook_url}}" aria-label="Facebook" target="blank"><i class="{{icon_family}} {{icon_family}}-{{facebook_icon}} {{icon_size}}"></i></a></li>{% endif %}
234
236
  {% if twitter_url != "none" %}<li id="quickLinksTwitterButton" class="nav-item"><a id="twitter_id" class="nav-icon" href="{{twitter_url}}" aria-label="Twitter" target="blank"><i class="{{icon_family}} {{icon_family}}-{{twitter_icon}} {{icon_size}}"></i></a></li>{% endif %}
235
237
  {% if show_auth_manager_icon %}<li id="quickLinksSignInOutButton" class="nav-item" style="display: none;"><a class="nav-icon" id="navLinkSignInOut" aria-label="SignOut" href="#" data-toggle="modal" data-target="#{{signin_modal_id}}"><i id="iconSignInOut" class="{{icon_family}} {{icon_family}}-{{signin_icon}} {{icon_size}}"></i></a></li>{% endif %}
236
- {% if show_cookiebar_icon %}<li id="quickLinksCookieButton" class="nav-item" style="display: none;"><a id="cookie-state" class="nav-icon" href="#" aria-label="Cookies" data-toggle="modal" data-target="#cookieRevokeCentralDanger"><i class="{{icon_family}} {{icon_family}}-{{cookies_icon}} {{icon_size}}"></i></a></li>{% endif %}
238
+ {% if show_cookieconsent_icon %}<li id="quickLinksCookieButton" class="nav-item" style="display: block;"><a href="javascript:j1.cookieConsent.showDialog()" aria-label="Cookie Consent"><i class="{{icon_family}} {{icon_family}}-{{cookies_icon}} {{icon_size}}"></i></a></li>{% endif %}
237
239
  {% if show_translator_icon %}<li id="quickLinksLanguageButton" class="nav-item translator"><a class="nav-icon" href="#" aria-label="Translator"><i class="{{icon_family}} {{icon_family}}-{{translator_icon}} {{icon_size}}"></i></a></li>{% endif %}
238
240
  {% if show_quick_search_icon %}<li id="quickLinksSearchButton" class="nav-item search"><a class="nav-icon" href="#" aria-label="Search"><i class="{{icon_family}} {{icon_family}}-{{search_icon}} {{icon_size}}"></i></a></li>{% endif %}
239
241
  {% if show_control_center_icon %}<li id="quickLinksControlCenterButton" class="nav-item control-center" style="display: block;"><a class="nav-icon" href="{{control_center_url}}" aria-label="ControlCenter"><i class="{{icon_family}} {{icon_family}}-{{control_center_icon}} {{icon_size}}"></i></a></li>{% endif %}
@@ -47,18 +47,18 @@ regenerate: true
47
47
  {
48
48
  "themes":
49
49
  [
50
- {"name": "Uno (light)", "css": "{{asset_path}}/core/css/themes/uno-light/bootstrap.css"},
51
- {"name": "Uno (dark)", "css": "{{asset_path}}/core/css/themes/uno-dark/bootstrap.css"},
52
- {"name": "Bootstrap", "css": "{{asset_path}}/core/css/themes/bootstrap/bootstrap.css"}
50
+ {"name": "Uno light", "css": "{{asset_path}}/core/css/themes/uno-light/bootstrap.css"},
51
+ {"name": "Uno dark", "css": "{{asset_path}}/core/css/themes/uno-dark/bootstrap.css"},
52
+ {"name": "Bootstrap", "css": "{{asset_path}}/core/css/themes/bootstrap/bootstrap.css"}
53
53
  ]
54
54
  }
55
55
  {% else %}
56
56
  {
57
57
  "themes":
58
58
  [
59
- {"name": "Uno (light)", "css": "{{asset_path}}/core/css/themes/uno-light/bootstrap.min.css"},
60
- {"name": "Uno (dark)", "css": "{{asset_path}}/core/css/themes/uno-dark/bootstrap.min.css"},
61
- {"name": "Bootstrap", "css": "{{asset_path}}/core/css/themes/bootstrap/bootstrap.min.css"}
59
+ {"name": "Uno light", "css": "{{asset_path}}/core/css/themes/uno-light/bootstrap.min.css"},
60
+ {"name": "Uno dark", "css": "{{asset_path}}/core/css/themes/uno-dark/bootstrap.min.css"},
61
+ {"name": "Bootstrap", "css": "{{asset_path}}/core/css/themes/bootstrap/bootstrap.min.css"}
62
62
  ]
63
63
  }
64
64
  {% endif %}
@@ -6,8 +6,8 @@ regenerate: true
6
6
 
7
7
  {% comment %}
8
8
  # -----------------------------------------------------------------------------
9
- # ~/assets/themes/j1/adapter/js/cookiebar.js
10
- # Liquid template to create the Template Adapter for J1 Cookiebar
9
+ # ~/assets/themes/j1/adapter/js/cookieConsent.js
10
+ # Liquid template to create the Template Adapter for J1 CookieConsent
11
11
  #
12
12
  # Product/Info:
13
13
  # http://jekyll.one
@@ -27,17 +27,19 @@ regenerate: true
27
27
 
28
28
  {% comment %} Set config files
29
29
  -------------------------------------------------------------------------------- {% endcomment %}
30
- {% assign environment = site.environment %}
31
- {% assign modules = site.data.modules %}
30
+ {% assign environment = site.environment %}
31
+ {% assign modules = site.data.modules %}
32
32
 
33
33
  {% comment %} Set config data
34
34
  -------------------------------------------------------------------------------- {% endcomment %}
35
- {% assign cookiebar_settings = modules.cookiebar.settings %}
36
- {% assign cookiebar_defaults = modules.defaults.cookiebar.defaults %}
35
+ {% assign consent_defaults = modules.defaults.cookieconsent.defaults %}
36
+ {% assign consent_settings = modules.cookieconsent.settings %}
37
+ {% assign tracking_enabled = site.data.j1_config.analytics.enabled %}
38
+ {% assign tracking_id = site.data.j1_config.analytics.google.tracking_id %}
37
39
 
38
40
  {% comment %} Set config options
39
41
  -------------------------------------------------------------------------------- {% endcomment %}
40
- {% assign cookiebar_options = cookiebar_defaults | merge: cookiebar_settings %}
42
+ {% assign consent_options = consent_defaults | merge: consent_settings %}
41
43
 
42
44
  {% assign production = false %}
43
45
  {% if environment == 'prod' or environment == 'production' %}
@@ -46,21 +48,20 @@ regenerate: true
46
48
 
47
49
  /*
48
50
  # -----------------------------------------------------------------------------
49
- # ~/assets/themes/j1/adapter/js/cookiebar.js
50
- # JS Adapter for Cookiebar
51
+ # ~/assets/themes/j1/adapter/js/cookieConsent.js
52
+ # JS Adapter for J1 CookieConsent
51
53
  #
52
- # Product/Info:
53
- # http://jekyll.one
54
- # http://www.primebox.co.uk/projects/jquery-cookiebar/
54
+ # Product/Info:
55
+ # https://shaack.com
56
+ # http://jekyll.one
55
57
  #
56
- # Copyright (C) 2021 Juergen Adams
57
- # Copyright (C) 2016 Ant Parsons (primebox.co.uk)
58
- #
59
- # J1 Template is licensed under the MIT License.
60
- # For details, see https://jekyll.one
61
- # jQuery Cookibar is licensed under Creative Commons Attribution 3.0 Unported License.
62
- # For details, see http://www.primebox.co.uk/projects/jquery-cookiebar/
58
+ # Copyright (C) 2020 Stefan Haack
59
+ # Copyright (C) 2021 Juergen Adams
63
60
  #
61
+ # bootstrap-cookie-banner is licensed under MIT License.
62
+ # See: https://github.com/shaack/bootstrap-cookie-banner/blob/master/LICENSE
63
+ # J1 Template is licensed under MIT License.
64
+ # See: https://github.com/jekyll-one/J1 Template/blob/master/LICENSE
64
65
  # -----------------------------------------------------------------------------
65
66
  # Adapter generated: {{site.time}}
66
67
  # -----------------------------------------------------------------------------
@@ -76,14 +77,22 @@ regenerate: true
76
77
 
77
78
  {% comment %} Main
78
79
  --------------------------------------------------------------- {% endcomment %}
79
- j1.adapter['cookiebar'] = (function (j1, window) {
80
+ j1.adapter['cookieConsent'] = (function (j1, window) {
80
81
 
81
- var environment = '{{environment}}';
82
- var moduleOptions = {};
82
+ var environment = '{{environment}}';
83
+ var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
84
+ var tracking_id = '{{tracking_id}}';
85
+ var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
86
+ var moduleOptions = {};
83
87
  var _this;
88
+ var $modal;
89
+ var user_cookie;
84
90
  var logger;
85
91
  var logText;
86
92
 
93
+ // NOTE: RegEx for tracking_id: ^(G|UA|YT|MO)-[a-zA-Z0-9-]+$
94
+ // See: https://stackoverflow.com/questions/20411767/how-to-validate-google-analytics-tracking-id-using-a-javascript-function/20412153
95
+
87
96
  // ---------------------------------------------------------------------------
88
97
  // Helper functions
89
98
  // ---------------------------------------------------------------------------
@@ -98,11 +107,20 @@ j1.adapter['cookiebar'] = (function (j1, window) {
98
107
  // -------------------------------------------------------------------------
99
108
  init: function (options) {
100
109
 
110
+ // -----------------------------------------------------------------------
111
+ // globals
112
+ // -----------------------------------------------------------------------
113
+ _this = j1.adapter.cookieConsent;
114
+ logger = log4javascript.getLogger('j1.adapter.cookieConsent');
115
+
116
+ // initialize state flag
117
+ _this.state = 'pending';
118
+
101
119
  // -----------------------------------------------------------------------
102
120
  // Default module settings
103
121
  // -----------------------------------------------------------------------
104
122
  var settings = $.extend({
105
- module_name: 'j1.adapter.algolia',
123
+ module_name: 'j1.adapter.cookieConsent',
106
124
  generated: '{{site.time}}'
107
125
  }, options);
108
126
 
@@ -110,7 +128,7 @@ j1.adapter['cookiebar'] = (function (j1, window) {
110
128
  -------------------------------------------------------------------------- {% endcomment %}
111
129
  // Load module DEFAULTS|CONFIG
112
130
  /* eslint-disable */
113
- moduleOptions = $.extend({}, {{cookiebar_options | replace: '=>', ':' | replace: 'nil', '""'}});
131
+ moduleOptions = $.extend({}, {{consent_options | replace: '=>', ':' | replace: 'nil', '""'}});
114
132
  /* eslint-enable */
115
133
 
116
134
  if (typeof settings !== 'undefined') {
@@ -120,46 +138,32 @@ j1.adapter['cookiebar'] = (function (j1, window) {
120
138
  // -----------------------------------------------------------------------
121
139
  // initializer
122
140
  // -----------------------------------------------------------------------
123
- _this = j1.adapter.cookiebar;
124
- logger = log4javascript.getLogger('j1.adapter.cookiebar');
125
-
126
141
  _this.setState('started');
127
142
  logger.info('state: ' + _this.getState());
128
143
  logger.info('module is being initialized');
129
144
 
130
- j1.core.cookiebar.init({
131
- expireDays: {{ cookiebar_options.expireDays | json }},
132
- renewOnVisit: {{ cookiebar_options.renewOnVisit | json }},
133
- forceShow: {{ cookiebar_options.forceShow | json }},
134
- domain: {{ cookiebar_options.domain | json }},
135
- referrer: {{ cookiebar_options.referrer | json }}
145
+ j1.cookieConsent = new BootstrapCookieConsent({
146
+ contentURL: moduleOptions.contentURL,
147
+ cookieName: moduleOptions.cookieName,
148
+ language: moduleOptions.language,
149
+ whitelisted: moduleOptions.whitelisted,
150
+ reloadPageOnChange: moduleOptions.reloadCurrentPage,
151
+ xhr_data_element: moduleOptions.xhr_data_element + '-' + moduleOptions.language,
152
+ postSelectionCallback: function () {
153
+ j1.adapter.cookieConsent.cbCookie()
154
+ }
136
155
  });
137
156
 
138
- j1.xhrData(moduleOptions, 'j1.adapter.cookiebar', 'data_loaded');
139
-
140
- // ---------------------------------------------------------------------
141
- // Initialize events if all modals loaded
142
- // ---------------------------------------------------------------------
143
- var dependencies_met_modals_loaded = setInterval (function () {
144
- if (j1.xhrDataState['#{{cookiebar_options.xhr_container_id}}'] == 'success') {
145
- logger.info('load HTML data (AJAX): finished');
146
- j1.core.cookiebar.eventHandler(moduleOptions);
157
+ var dependencies_met_page_ready = setInterval (function (options) {
158
+ if ( j1.cookieConsent && j1.getState() === 'finished' ) {
147
159
  _this.setState('finished');
148
160
  logger.info('state: ' + _this.getState());
149
- logger.info('initializing module finished');
150
- clearInterval(dependencies_met_modals_loaded);
151
- logger.info('met dependencies for: xhrData');
161
+ logger.debug('module initialized successfully');
162
+ clearInterval(dependencies_met_page_ready);
152
163
  }
153
- if (j1.xhrDataState['#{{cookiebar_options.xhr_container_id}}'] == 'not loaded') {
154
- logger.error('load HTML data (AJAX): failed');
155
- _this.setState('finished');
156
- logger.info('state: ' + _this.getState());
157
- logger.info('initializing module finished');
158
- clearInterval(dependencies_met_modals_loaded);
159
- }
160
- }, 25); // END dependencies_met_modals_loaded
161
- }, // END init
164
+ });
162
165
 
166
+ }, // END init
163
167
 
164
168
  // -------------------------------------------------------------------------
165
169
  // messageHandler: MessageHandler for J1 CookieConsent module
@@ -202,7 +206,77 @@ j1.adapter['cookiebar'] = (function (j1, window) {
202
206
  // -------------------------------------------------------------------------
203
207
  getState: function () {
204
208
  return _this.state;
205
- } // END getState
209
+ }, // END getState
210
+
211
+ // -------------------------------------------------------------------------
212
+ // cbCookie()
213
+ // Called by CookieConsent module after the user has
214
+ // made his selection (callback)
215
+ // -------------------------------------------------------------------------
216
+ cbCookie: function () {
217
+ var gaCookies = j1.findCookie('_ga');
218
+ var user_state = j1.readCookie('j1.user.state');
219
+ var user_consent = j1.readCookie('j1.user.consent');
220
+ var json = JSON.stringify(user_consent);
221
+
222
+ logger.info('Entered post selection callback from CookieConsent');
223
+ logger.info('Current values from CookieConsent: ' + json);
224
+
225
+ // NOTE: Warning needs to be moved to another module
226
+ // because page is reloaded after selection
227
+ //
228
+ if (tracking_enabled && !tracking_id_valid) {
229
+ logger.warn('tracking enabled, but invalid tracking id found: ' + tracking_id);
230
+ }
231
+
232
+ // for debugging
233
+ // gaCookies.forEach(item => console.log('cookieConsent: ' + item));
234
+
235
+ // Manage Google Analytics OptIn/Out
236
+ // See: https://github.com/luciomartinez/gtag-opt-in/wiki
237
+ if (tracking_enabled && tracking_id_valid) {
238
+ GTagOptIn.register(tracking_id);
239
+ if (user_consent.analyses) {
240
+ logger.info('Enable: GA');
241
+ GTagOptIn.optIn();
242
+ } else {
243
+ logger.warn('Disable: GA');
244
+ GTagOptIn.optOut();
245
+ var gaCookies = j1.findCookie('_ga');
246
+ gaCookies.forEach(function (item) {
247
+ logger.warn('Delete GA cookie: ' + item);
248
+ j1.removeCookie({
249
+ name: item,
250
+ path: '/'
251
+ });
252
+ });
253
+ }
254
+ }
255
+
256
+
257
+ // enable cookie button if not visible
258
+ if ($('#quickLinksCookieButton').css('display') === 'none') {
259
+ $('#quickLinksCookieButton').css('display', 'block');
260
+ }
261
+
262
+ if (!user_consent.analyses || !user_consent.personalization) {
263
+ // expire consent|state cookies to session
264
+ j1.writeCookie({
265
+ name: 'j1.user.state',
266
+ data: user_state,
267
+ samesite: 'Strict'
268
+ });
269
+ j1.writeCookie({
270
+ name: 'j1.user.consent',
271
+ data: user_consent,
272
+ samesite: 'Strict'
273
+ });
274
+ }
275
+
276
+ // reload page after selection
277
+ location.reload();
278
+
279
+ } // END cbCookie
206
280
 
207
281
  }; // END return
208
282
  })(j1, window);