j1-template 2024.1.5 → 2024.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/content_generator_page.html +0 -34
  3. data/_includes/themes/j1/modules/searcher/generator.html +4 -1
  4. data/_includes/themes/j1/modules/searcher/procedures/topsearch.proc +59 -56
  5. data/assets/data/authclient.html +1 -8
  6. data/assets/data/banner.html +1 -7
  7. data/assets/data/fab.html +2 -13
  8. data/assets/data/footer.html +0 -3
  9. data/assets/data/galeries.html +2 -13
  10. data/assets/data/gemini-ui.html +74 -21
  11. data/assets/data/iframes.html +1 -4
  12. data/assets/data/masonry.html +1 -13
  13. data/assets/data/masterslider.html +10 -21
  14. data/assets/data/menu.html +6 -14
  15. data/assets/data/mmenu.html +6 -5
  16. data/assets/data/mmenu_toc.html +2 -1
  17. data/assets/data/panel.html +4 -11
  18. data/assets/data/particles.yml +8 -8
  19. data/assets/data/quicklinks.html +4 -23
  20. data/assets/data/rtext_resizer.html +3 -1
  21. data/assets/data/slick.html +9 -11
  22. data/assets/data/translator.html +0 -1
  23. data/assets/themes/j1/adapter/js/advertising.js +141 -172
  24. data/assets/themes/j1/adapter/js/algolia.js +61 -54
  25. data/assets/themes/j1/adapter/js/analytics.js +67 -47
  26. data/assets/themes/j1/adapter/js/asciidoctor.js +32 -20
  27. data/assets/themes/j1/adapter/js/attic.js +75 -69
  28. data/assets/themes/j1/adapter/js/bmd.js +195 -177
  29. data/assets/themes/j1/adapter/js/carousel.js +786 -761
  30. data/assets/themes/j1/adapter/js/chatbot.js +77 -35
  31. data/assets/themes/j1/adapter/js/clipboard.js +66 -49
  32. data/assets/themes/j1/adapter/js/comments.js +92 -70
  33. data/assets/themes/j1/adapter/js/cookieConsent.js +466 -462
  34. data/assets/themes/j1/adapter/js/customFunctions.js +52 -35
  35. data/assets/themes/j1/adapter/js/customModule.js +56 -46
  36. data/assets/themes/j1/adapter/js/docsearch.js +54 -34
  37. data/assets/themes/j1/adapter/js/dropdowns.js +65 -52
  38. data/assets/themes/j1/adapter/js/fab.js +123 -109
  39. data/assets/themes/j1/adapter/js/gallery.js +494 -476
  40. data/assets/themes/j1/adapter/js/gemini.js +933 -299
  41. data/assets/themes/j1/adapter/js/iconPicker.js +255 -235
  42. data/assets/themes/j1/adapter/js/iconPickerPage.js +279 -0
  43. data/assets/themes/j1/adapter/js/iframer.js +81 -61
  44. data/assets/themes/j1/adapter/js/j1.js +3285 -3222
  45. data/assets/themes/j1/adapter/js/lazyLoader.js +241 -222
  46. data/assets/themes/j1/adapter/js/lightbox.js +241 -241
  47. data/assets/themes/j1/adapter/js/logger.js +77 -66
  48. data/assets/themes/j1/adapter/js/lunr.js +688 -86
  49. data/assets/themes/j1/adapter/js/masonry.js +426 -411
  50. data/assets/themes/j1/adapter/js/masterslider.js +526 -527
  51. data/assets/themes/j1/adapter/js/mmenu.js +101 -66
  52. data/assets/themes/j1/adapter/js/navigator.js +291 -356
  53. data/assets/themes/j1/adapter/js/particles.js +61 -40
  54. data/assets/themes/j1/adapter/js/rangeSlider.js +65 -48
  55. data/assets/themes/j1/adapter/js/rouge.js +287 -269
  56. data/assets/themes/j1/adapter/js/rtable.js +309 -293
  57. data/assets/themes/j1/adapter/js/rtextResizer.js +57 -44
  58. data/assets/themes/j1/adapter/js/scroller.js +170 -133
  59. data/assets/themes/j1/adapter/js/slick.js +487 -485
  60. data/assets/themes/j1/adapter/js/slimSelect.js +290 -0
  61. data/assets/themes/j1/adapter/js/speak2me.js +124 -128
  62. data/assets/themes/j1/adapter/js/themeToggler.js +280 -260
  63. data/assets/themes/j1/adapter/js/{themer.js → themes.js} +145 -113
  64. data/assets/themes/j1/adapter/js/toccer.js +87 -54
  65. data/assets/themes/j1/adapter/js/translator.js +73 -70
  66. data/assets/themes/j1/adapter/js/waves.js +74 -58
  67. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +29 -11
  68. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
  69. data/assets/themes/j1/core/js/template.js +474 -420
  70. data/assets/themes/j1/core/js/template.min.js +7 -7
  71. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  72. data/assets/themes/j1/modules/carousel/css/theme/uno.css +4 -4
  73. data/assets/themes/j1/modules/carousel/css/theme/uno.min.css +1 -1
  74. data/assets/themes/j1/modules/clipboard/js/clipboard.js +0 -1
  75. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +4 -4
  76. data/assets/themes/j1/modules/iconPicker/css/theme/uno.css +58 -0
  77. data/assets/themes/j1/modules/iconPicker/css/theme/uno.min.css +16 -0
  78. data/assets/themes/j1/modules/iconPicker/js/universal-icon-picker.0.js +493 -0
  79. data/assets/themes/j1/modules/iconPicker/js/universal-icon-picker.js +7 -7
  80. data/assets/themes/j1/modules/lightGallery/js/plugins/lg-video.js +4 -4
  81. data/assets/themes/j1/modules/lightGallery/js/plugins/lg-video.min.js +2 -10
  82. data/assets/themes/j1/modules/lunr/css/j1.css +12 -6
  83. data/assets/themes/j1/modules/lunr/css/j1.min.css +1 -1
  84. data/assets/themes/j1/modules/lunr/js/j1.js +46 -43
  85. data/assets/themes/j1/modules/lunr/js/j1.min.js +1 -1
  86. data/assets/themes/j1/modules/masterslider/js/masterslider.js +1 -1
  87. data/assets/themes/j1/modules/scroller/js/scroller.js +64 -74
  88. data/assets/themes/j1/modules/scroller/js/scroller.min.js +1 -1
  89. data/assets/themes/j1/modules/slick/slider/css/theme/uno.css +4 -4
  90. data/assets/themes/j1/modules/slick/slider/css/theme/uno.min.css +1 -1
  91. data/assets/themes/j1/modules/slimSelect/js/select.js +1865 -1821
  92. data/assets/themes/j1/modules/slimSelect/js/select.min.js +2 -1
  93. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +87 -89
  94. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
  95. data/assets/themes/j1/modules/videojs/js/plugins/vm/api/player.min.js +5 -7
  96. data/assets/themes/j1/modules/videojs/js/plugins/vm/api/v2.20.1/player.min.js +23 -0
  97. data/lib/j1/version.rb +1 -1
  98. data/lib/starter_web/Gemfile +2 -2
  99. data/lib/starter_web/README.md +5 -5
  100. data/lib/starter_web/_config.yml +1 -1
  101. data/lib/starter_web/_data/blocks/_panel.yml +775 -0
  102. data/lib/starter_web/_data/blocks/panel.yml +53 -53
  103. data/lib/starter_web/_data/j1_config.yml +3 -2
  104. data/lib/starter_web/_data/layouts/default.yml +0 -2
  105. data/lib/starter_web/_data/modules/_scroller.yml +102 -0
  106. data/lib/starter_web/_data/modules/carousel.yml +3 -3
  107. data/lib/starter_web/_data/modules/defaults/attics.yml +5 -5
  108. data/lib/starter_web/_data/modules/defaults/docsearch.yml +1 -1
  109. data/lib/starter_web/_data/modules/defaults/gemini.yml +204 -46
  110. data/lib/starter_web/_data/modules/defaults/{iconPicker.yml → icon_picker.yml} +6 -12
  111. data/lib/starter_web/_data/modules/defaults/lunr.yml +20 -5
  112. data/lib/starter_web/_data/modules/defaults/masterslider.yml +4 -4
  113. data/lib/starter_web/_data/modules/defaults/navigator.yml +20 -24
  114. data/lib/starter_web/_data/modules/defaults/particles.yml +3 -3
  115. data/lib/starter_web/_data/modules/defaults/slim_select.yml +54 -0
  116. data/lib/starter_web/_data/modules/defaults/{themer.yml → themes.yml} +171 -171
  117. data/lib/starter_web/_data/modules/defaults/toccer.yml +1 -1
  118. data/lib/starter_web/_data/modules/gallery.yml +33 -38
  119. data/lib/starter_web/_data/modules/gemini.yml +42 -3
  120. data/lib/starter_web/_data/modules/{iconPicker.yml → icon_picker.yml} +31 -3
  121. data/lib/starter_web/_data/modules/lunr.yml +12 -1
  122. data/lib/starter_web/_data/modules/masonry.yml +37 -38
  123. data/lib/starter_web/_data/modules/masterslider.yml +78 -95
  124. data/lib/starter_web/_data/modules/navigator_menu.yml +12 -20
  125. data/lib/starter_web/_data/modules/particles.yml +3 -3
  126. data/lib/starter_web/_data/modules/scroller.yml +3 -3
  127. data/lib/starter_web/_data/modules/slim_select.yml +110 -0
  128. data/lib/starter_web/_data/modules/{themer.yml → themes.yml} +4 -4
  129. data/lib/starter_web/_data/resources.yml +57 -47
  130. data/lib/starter_web/_data/templates/feed.xml +1 -1
  131. data/lib/starter_web/_includes/attributes.asciidoc +354 -355
  132. data/lib/starter_web/_plugins/asciidoctor/gemini-ui-block.rb +1 -1
  133. data/lib/starter_web/_plugins/asciidoctor/slim-select-block.rb +45 -0
  134. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  135. data/lib/starter_web/collections/asciidoc_skeletons/simple-post/_posts/yyyy-mm-dd-your-post-name.asciidoc +5 -2
  136. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +3 -3
  137. data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.adoc +9 -9
  138. data/lib/starter_web/collections/posts/public/featured/_posts/2021-02-01-static-site-generators.adoc +4 -4
  139. data/lib/starter_web/collections/posts/public/featured/_posts/2022-02-01-about-j1.adoc +3 -2
  140. data/lib/starter_web/collections/posts/public/featured/_posts/2023-10-18-url-types.adoc +12 -12
  141. data/lib/starter_web/package.json +1 -1
  142. data/lib/starter_web/pages/public/about/features.adoc +1 -1
  143. data/lib/starter_web/pages/public/about/reporting_issues.adoc +1 -0
  144. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/attributes.asciidoc +44 -44
  145. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +1 -0
  146. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/attributes.asciidoc +12 -12
  147. data/lib/starter_web/pages/public/blog/navigator/archive/allview.html +1 -1
  148. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/attributes.asciidoc +42 -28
  149. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/highlghter_rouge.adoc +1 -0
  150. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/lunr_search.adoc +1 -0
  151. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/present_audio_video.adoc +18 -2
  152. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/present_images.adoc +500 -507
  153. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +6 -11
  154. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +4 -11
  155. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +5 -12
  156. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +5 -10
  157. data/lib/starter_web/pages/public/tools/previewer/_includes/attributes.asciidoc +10 -9
  158. data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +77 -75
  159. metadata +50 -46
  160. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/attributes.asciidoc +0 -47
  161. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/documents/preview_google_adsense.asciidoc +0 -448
  162. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/documents/readme +0 -0
  163. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/tables/readme +0 -0
  164. data/lib/starter_web/pages/public/manuals/integrations/gemini/gemini.adoc +0 -525
  165. data/lib/starter_web/pages/public/manuals/integrations/gemini/security.asccidoc +0 -274
  166. data/lib/starter_web/pages/public/manuals/integrations/gemini/security.hrml +0 -560
  167. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_biography.adoc +0 -0
  168. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_fantasy.adoc +0 -0
  169. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_romance.adoc +0 -0
  170. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/jekyll_collections.adoc +0 -0
  171. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/viewer_all_books.adoc +0 -0
  172. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/100_gistblock.asciidoc +0 -0
  173. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_info.asciidoc +0 -0
  174. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_left_warning.asciidoc +0 -0
  175. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_right_danger.asciidoc +0 -0
  176. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_central_success.asciidoc +0 -0
  177. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_full_height_left_info.asciidoc +0 -0
  178. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_full_height_right_success.asciidoc +0 -0
  179. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_table_bs_modal_examples.asciidoc +0 -0
  180. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_info.asciidoc +0 -0
  181. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_left_info.asciidoc +0 -0
  182. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_right_success.asciidoc +0 -0
  183. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/419_advanced_modals_demo.asciidoc +0 -0
  184. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/tables/bs_modal_examples.asciidoc +0 -0
  185. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/themes_bootstrap.asciidoc +0 -0
  186. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/themes_rouge.asciidoc +0 -0
  187. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/asciidoc_extensions.adoc +0 -0
  188. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/bootstrap_themes.adoc +0 -0
  189. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/icon_fonts.adoc +0 -0
  190. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/modal_extentions.adoc +0 -0
  191. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/responsive_tables.adoc +0 -0
  192. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/typography.adoc +0 -0
  193. /data/lib/starter_web/pages/public/{legal/learn → learn}/where_to_go.adoc +0 -0
@@ -1,462 +1,466 @@
1
- ---
2
- regenerate: true
3
- ---
4
-
5
- {% capture cache %}
6
-
7
- {% comment %}
8
- # -----------------------------------------------------------------------------
9
- # ~/assets/themes/j1/adapter/js/cookieConsent.js
10
- # Liquid template to create the Template Adapter for J1 CookieConsent
11
- #
12
- # Product/Info:
13
- # http://jekyll.one
14
- #
15
- # Copyright (C) 2023, 2024 Juergen Adams
16
- #
17
- # J1 Template is licensed under the MIT License.
18
- # For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
19
- # -----------------------------------------------------------------------------
20
- # Test data:
21
- # {{ liquid_var | debug }}
22
- # cookie_options: {{ cookie_options | debug }}
23
- # -----------------------------------------------------------------------------
24
- {% endcomment %}
25
-
26
- {% comment %} Liquid var initialization
27
- -------------------------------------------------------------------------------- {% endcomment %}
28
-
29
- {% comment %} Set config files
30
- -------------------------------------------------------------------------------- {% endcomment %}
31
- {% assign environment = site.environment %}
32
- {% assign blocks = site.data.blocks %}
33
- {% assign modules = site.data.modules %}
34
- {% assign template_config = site.data.j1_config %}
35
-
36
- {% comment %} Set config data
37
- -------------------------------------------------------------------------------- {% endcomment %}
38
- {% assign cookie_defaults = modules.defaults.cookies.defaults %}
39
- {% assign cookie_settings = modules.cookies.settings %}
40
- {% assign consent_defaults = modules.defaults.cookieconsent.defaults %}
41
- {% assign consent_settings = modules.cookieconsent.settings %}
42
- {% assign analytics_defaults = modules.defaults.analytics.defaults %}
43
- {% assign analytics_settings = modules.analytics.settings %}
44
-
45
- {% comment %} Set config options
46
- -------------------------------------------------------------------------------- {% endcomment %}
47
- {% assign consent_options = consent_defaults | merge: consent_settings %}
48
- {% assign cookie_options = cookie_defaults | merge: cookie_settings %}
49
- {% assign analytics_options = analytics_defaults | merge: analytics_settings %}
50
-
51
- {% comment %} Set variables
52
- -------------------------------------------------------------------------------- {% endcomment %}
53
- {% assign tracking_enabled = analytics_options.enabled %}
54
- {% assign tracking_id = analytics_options.google.trackingID %}
55
-
56
- {% comment %} Detect prod mode
57
- -------------------------------------------------------------------------------- {% endcomment %}
58
- {% assign production = false %}
59
- {% if environment == 'prod' or environment == 'production' %}
60
- {% assign production = true %}
61
- {% endif %}
62
-
63
- /*
64
- # -----------------------------------------------------------------------------
65
- # ~/assets/themes/j1/adapter/js/cookieConsent.js
66
- # JS Adapter for J1 CookieConsent
67
- #
68
- # Product/Info:
69
- # http://jekyll.one
70
- #
71
- # Copyright (C) 2023, 2024 Juergen Adams
72
- #
73
- # J1 Theme is licensed under MIT License.
74
- # See: https://github.com/jekyll-one/J1 Theme/blob/master/LICENSE
75
- # -----------------------------------------------------------------------------
76
- # Adapter generated: {{site.time}}
77
- # -----------------------------------------------------------------------------
78
- */
79
-
80
- // -----------------------------------------------------------------------------
81
- // ESLint shimming
82
- // -----------------------------------------------------------------------------
83
- /* eslint indent: "off" */
84
- /* eslint quotes: "off" */
85
- // -----------------------------------------------------------------------------
86
- 'use strict';
87
- j1.adapter.cookieConsent = (function (j1, window) {
88
- var environment = '{{environment}}';
89
- var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
90
- var tracking_id = '{{tracking_id}}';
91
- var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
92
- var stringifiedAttributes = '';
93
- var state = 'not_started';
94
-
95
- var expireCookiesOnRequiredOnly;
96
-
97
- var cookieDefaults;
98
- var cookieSettings;
99
- var cookieOptions;
100
-
101
- var cookieConsentDefaults;
102
- var cookieConsentSettings;
103
- var cookieConsentOptions;
104
-
105
- var _this;
106
- var $modal;
107
- var cookie_names;
108
- var user_cookie;
109
- var logger;
110
- var url;
111
- var baseUrl;
112
- var hostname;
113
- var auto_domain;
114
- var check_cookie_option_domain;
115
- var cookie_domain;
116
- var secure;
117
- var logText;
118
- var cookie_written;
119
- var contentLanguage;
120
- var navigatorLanguage;
121
- var domainAttribute;
122
-
123
- // var user_translate = {
124
- // 'analysis': 'true',
125
- // 'personalization': 'true',
126
- // 'translationEnabled': 'true'
127
- // };
128
-
129
- // NOTE: RegEx for tracking_id: ^(G|UA|YT|MO)-[a-zA-Z0-9-]+$
130
- // See: https://stackoverflow.com/questions/20411767/how-to-validate-google-analytics-tracking-id-using-a-javascript-function/20412153
131
-
132
- // ---------------------------------------------------------------------------
133
- // Helper functions
134
- // ---------------------------------------------------------------------------
135
-
136
- // ---------------------------------------------------------------------------
137
- // Main object
138
- // ---------------------------------------------------------------------------
139
- return {
140
-
141
- // -------------------------------------------------------------------------
142
- // Initializer
143
- // -------------------------------------------------------------------------
144
- init: function (options) {
145
-
146
- // -----------------------------------------------------------------------
147
- // Default module settings
148
- // -----------------------------------------------------------------------
149
- var settings = $.extend({
150
- module_name: 'j1.adapter.cookieConsent',
151
- generated: '{{site.time}}'
152
- }, options);
153
-
154
- // -----------------------------------------------------------------------
155
- // Global variable settings
156
- // -----------------------------------------------------------------------
157
- _this = j1.adapter.cookieConsent;
158
- logger = log4javascript.getLogger('j1.adapter.cookieConsent');
159
- cookie_names = j1.getCookieNames();
160
- url = new liteURL(window.location.href);
161
- baseUrl = url.origin;
162
- hostname = url.hostname;
163
- auto_domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
164
- secure = (url.protocol.includes('https')) ? true : false;
165
- contentLanguage = '{{site.language}}';
166
- navigatorLanguage = navigator.language || navigator.userLanguage;
167
-
168
- // Load cookie DEFAULTS|CONFIG
169
- cookieDefaults = $.extend({}, {{cookie_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
170
- cookieSettings = $.extend({}, {{cookie_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
171
- cookieOptions = $.extend(true, {}, cookieDefaults, cookieSettings);
172
-
173
- // Load module DEFAULTS|CONFIG
174
- cookieConsentDefaults = $.extend({}, {{consent_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
175
- cookieConsentSettings = $.extend({}, {{consent_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
176
- cookieConsentOptions = $.extend(true, {}, cookieConsentDefaults, cookieConsentSettings);
177
-
178
- // initialize state flag
179
- _this.state = 'pending';
180
-
181
- {% comment %} Load module config from yml data
182
- -------------------------------------------------------------------------- {% endcomment %}
183
- // Load module DEFAULTS|CONFIG
184
- /* eslint-disable */
185
- // moduleOptions = $.extend({}, {{consent_options | replace: '=>', ':' | replace: 'nil', '""'}});
186
- /* eslint-enable */
187
-
188
- // if (typeof settings !== 'undefined') {
189
- // moduleOptions = $.extend({}, moduleOptions, settings);
190
- // }
191
- if (navigatorLanguage.indexOf("-") !== -1) {
192
- navigatorLanguage = navigatorLanguage.split("-")[0];
193
- }
194
-
195
- if (cookieConsentOptions.dialogLanguage === 'auto') {
196
- cookieConsentOptions.dialogLanguage = navigatorLanguage;
197
- } else if (cookieConsentOptions.dialogLanguage === 'content') {
198
- cookieConsentOptions.dialogLanguage = contentLanguage;
199
- } else {
200
- cookieConsentOptions.dialogLanguage = navigatorLanguage;
201
- }
202
-
203
- check_cookie_option_domain = (cookieOptions.domain === 'false') ? false : true;
204
- expireCookiesOnRequiredOnly = (cookieOptions.expireCookiesOnRequiredOnly === 'true') ? true: false;
205
-
206
- // -----------------------------------------------------------------------
207
- // initializer
208
- // -----------------------------------------------------------------------
209
- var dependencies_met_page_ready = setInterval (function (options) {
210
- var same_site = cookieOptions.same_site;
211
- var expires;
212
-
213
- if (cookieConsentOptions.enabled) {
214
- expires = cookieOptions.expires;
215
- } else {
216
- // expire permanent cookies to session
217
- j1.expireCookie({ name: cookie_names.user_state });
218
- j1.expireCookie({ name: cookie_names.user_consent });
219
- j1.expireCookie({ name: cookie_names.user_translate });
220
-
221
- // disable the themes menus
222
- $('#themes_menu').css('display', 'none');
223
- $('#themes_mmenu').css('display', 'none');
224
- logger.warn('\n' + 'disable module: Themer');
225
-
226
- // disable the quick link for (Google) Translation
227
- $('#quickLinksTranslateButton').css('display', 'none');
228
- logger.warn('\n' + 'disable module: Trranslator');
229
- }
230
-
231
- // set domain used by cookies
232
- if (check_cookie_option_domain) {
233
- if (cookieOptions.domain == 'auto') {
234
- domainAttribute = auto_domain;
235
- stringifiedAttributes += '; ' + 'Domain=' + domainAttribute;
236
- } else {
237
- domainAttribute = cookieOptions.domain;
238
- stringifiedAttributes += '; ' + 'Domain=' + domainAttribute;
239
- }
240
- } else {
241
- domainAttribute = cookieOptions.domain;
242
- }
243
-
244
- // Failsafe: if 'None' is given for samesite in non-secure
245
- // environments open access to cookies to subdomains
246
- // ---------------------------------------------------------------------
247
- if (same_site == 'None' && !secure) {
248
- same_site = 'Lax';
249
- }
250
-
251
- if ( j1.getState() === 'finished' ) {
252
- _this.setState('started');
253
-
254
- if (cookieConsentOptions.enabled) {
255
- logger.debug('\n' + 'state: ' + _this.getState());
256
- logger.info('\n' + 'module is being initialized');
257
-
258
- j1.cookieConsent = new CookieConsent ({
259
- contentURL: cookieConsentOptions.contentURL, // dialog content (modals) for all supported languages
260
- cookieName: cookie_names.user_consent, // name of the consent cookie
261
- cookieStorageDays: expires, // lifetime of a cookie [0..365], 0: session cookie
262
- cookieSameSite: same_site, // restrict consent cookie
263
- cookieSecure: secure, // only sent to the server with an encrypted request over HTTPS
264
- cookieDomain: domainAttribute, // set domain (hostname|domain)
265
- dialogLanguage: cookieConsentOptions.dialogLanguage, // language for the dialog (modal)
266
- whitelisted: cookieConsentOptions.whitelisted, // pages NO cookie dialog is shown
267
- reloadPageOnChange: cookieConsentOptions.reloadPageOnChange, // reload if setzings has changed
268
- dialogContainerID: cookieConsentOptions.dialogContainerID, // container, the dialog modal is (dynamically) loaded
269
- xhrDataElement: cookieConsentOptions.xhrDataElement, // container for all language-specific dialogs (modals)
270
- postSelectionCallback: cookieConsentOptions.postSelectionCallback, // callback function, called after the user has made his selection
271
- });
272
- } else {
273
- logger.warn('\n' + 'module is disabled');
274
- }
275
-
276
- _this.setState('finished');
277
- logger.debug('\n' + 'state: ' + _this.getState());
278
- logger.debug('\n' + 'module initialized successfully');
279
-
280
- // -------------------------------------------------------------------
281
- // NOTE: Click events moved to Navigator (core)
282
- // -------------------------------------------------------------------
283
-
284
- clearInterval(dependencies_met_page_ready);
285
- }
286
- }, 10);
287
- }, // END init
288
-
289
- // -------------------------------------------------------------------------
290
- // messageHandler: MessageHandler for J1 CookieConsent module
291
- // Manage messages send from other J1 modules
292
- // -------------------------------------------------------------------------
293
- messageHandler: function (sender, message) {
294
- var json_message = JSON.stringify(message, undefined, 2);
295
-
296
- logText = '\n' + 'received message from ' + sender + ': ' + json_message;
297
- logger.debug(logText);
298
-
299
- // -----------------------------------------------------------------------
300
- // Process commands|actions
301
- // -----------------------------------------------------------------------
302
- if (message.type === 'command' && message.action === 'module_initialized') {
303
- //
304
- // Place handling of command|action here
305
- //
306
- logger.info('\n' + message.text);
307
- }
308
-
309
- //
310
- // Place handling of other command|action here
311
- //
312
-
313
- return true;
314
- }, // END messageHandler
315
-
316
- // -------------------------------------------------------------------------
317
- // setState()
318
- // Sets the current (processing) state of the module
319
- // -------------------------------------------------------------------------
320
- setState: function (stat) {
321
- _this.state = stat;
322
- }, // END setState
323
-
324
- // -------------------------------------------------------------------------
325
- // getState()
326
- // Returns the current (processing) state of the module
327
- // -------------------------------------------------------------------------
328
- getState: function () {
329
- return _this.state;
330
- }, // END getState
331
-
332
- // -------------------------------------------------------------------------
333
- // cbCookie()
334
- // Called (callback) by CookieConsent module after the user has
335
- // made his selection
336
- // -------------------------------------------------------------------------
337
- cbCookie: function () {
338
- var url = new liteURL(window.location.href);
339
- var hostname = url.hostname;
340
- var gaCookies = j1.findCookie('_ga');
341
- var gasCookies = j1.findCookie('__ga');
342
- var j1Cookies = j1.findCookie('j1');
343
- var cookie_names = j1.getCookieNames();
344
- var user_state = j1.readCookie(cookie_names.user_state);
345
- var user_consent = j1.readCookie(cookie_names.user_consent);
346
- var user_translate = j1.readCookie(cookie_names.user_translate);
347
- var json = JSON.stringify(user_consent);
348
- var user_agent = platform.ua;
349
- var cookie_written;
350
-
351
- logger.info('\n' + 'entered post selection callback from CookieConsent');
352
- logger.info('\n' + 'current values from CookieConsent: ' + json);
353
-
354
- // enable cookie button if not visible
355
- if ($('#quickLinksCookieButton').css('display') === 'none') {
356
- $('#quickLinksCookieButton').css('display', 'block');
357
- }
358
-
359
- // Manage Google Analytics OptIn/Out
360
- // See: https://github.com/luciomartinez/gtag-opt-in/wiki
361
- if (tracking_enabled && tracking_id_valid) {
362
- // Managing cookie life-time
363
- // ---------------------------------------------------------------------
364
- // If cookie settings allows only "required" cookies, all "persistent"
365
- // cookies (Comments|Ads|Translation) get expired to "session" for
366
- // better GDPR compliance. The GDPR regulations does NOT require
367
- // any consent on session-only cookies.
368
- //
369
- if (!user_consent.analysis || !user_consent.personalization) {
370
-
371
- // overload cookie consent settings
372
- user_translate.analysis = user_consent.analysis;
373
- user_translate.personalization = user_consent.personalization;
374
- // disable translation service
375
- user_translate.translationEnabled = false;
376
-
377
- cookie_written = j1.writeCookie({
378
- name: cookie_names.user_translate,
379
- data: user_translate,
380
- secure: secure
381
- });
382
-
383
- // expire permanent cookies to session
384
- // -------------------------------------------------------------------
385
- j1.expireCookie({ name: cookie_names.user_state });
386
- j1.expireCookie({ name: cookie_names.user_consent });
387
- j1.expireCookie({ name: cookie_names.user_translate });
388
- }
389
- if (cookieConsentOptions.reloadPageOnChange) {
390
- // reload current page (skip cache)
391
- location.reload(true);
392
- }
393
- } else {
394
- // Failsafe: Make (really) sure the all GA|GAS cookies removed
395
- // left from a previous session/page view for better privacy compliance
396
- // ---------------------------------------------------------------------
397
-
398
- // remove cookies on invalid GA config or left from a previous
399
- // session/page view if they exists
400
- // ---------------------------------------------------------------------
401
- gaCookies.forEach(function (item) {
402
- logger.warn('\n' + 'delete GA cookie: ' + item);
403
- if (hostname == 'localhost') {
404
- j1.removeCookie({ name: item, domain: false, secure: false });
405
- } else {
406
- j1.removeCookie({ name: item, domain: '.' + hostname, secure: false });
407
- }
408
- });
409
-
410
- // remove cookies on invalid GAS config or left from a previous
411
- // session/page view if they exists
412
- // ---------------------------------------------------------------------
413
- gasCookies.forEach(function (item) {
414
- // Remove cookies from Google Ads
415
- logger.warn('\n' + 'delete GAS cookie: ' + item);
416
- if (hostname == 'localhost') {
417
- j1.removeCookie({ name: item, domain: false, secure: false });
418
- } else {
419
- j1.removeCookie({ name: item, domain: '.' + hostname, secure: false });
420
- }
421
- });
422
-
423
- // Managing cookie life-time. If cookie settings allows only
424
- // "required" cookies, all "persistent" cookies (Comments|Ads|Translation)
425
- // get expired to "session" for better GDPR compliance. The GDPR
426
- // regulations|privacy does NOT require any consent on using cookies
427
- // for session-only cookies.
428
- // ---------------------------------------------------------------------
429
- if (!user_consent.analysis || !user_consent.personalization) {
430
- // overload cookie consent settings
431
- user_translate.analysis = user_consent.analysis;
432
- user_translate.personalization = user_consent.personalization;
433
- // disable translation service
434
- user_translate.translationEnabled = false;
435
-
436
- cookie_written = j1.writeCookie({
437
- name: cookie_names.user_translate,
438
- data: user_translate,
439
- secure: secure
440
- });
441
-
442
- if (expireCookiesOnRequiredOnly) {
443
- // expire permanent cookies to session
444
- j1.expireCookie({ name: cookie_names.user_state });
445
- j1.expireCookie({ name: cookie_names.user_consent });
446
- j1.expireCookie({ name: cookie_names.user_translate });
447
- }
448
- }
449
-
450
- if (cookieConsentOptions.reloadPageOnChange) {
451
- // reload current page (skip cache)
452
- location.reload(true);
453
- }
454
- } // END if tracking_enabled
455
- } // END cbCookie
456
-
457
- }; // END return
458
- })(j1, window);
459
-
460
- {% endcapture %}
461
- {{ cache | strip_empty_lines }}
462
- {% assign cache = nil %}
1
+ ---
2
+ regenerate: true
3
+ ---
4
+
5
+ {% capture cache %}
6
+
7
+ {% comment %}
8
+ # -----------------------------------------------------------------------------
9
+ # ~/assets/themes/j1/adapter/js/cookieConsent.js
10
+ # Liquid template to create the Template Adapter for J1 CookieConsent
11
+ #
12
+ # Product/Info:
13
+ # http://jekyll.one
14
+ #
15
+ # Copyright (C) 2023, 2024 Juergen Adams
16
+ #
17
+ # J1 Template is licensed under the MIT License.
18
+ # For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
19
+ # -----------------------------------------------------------------------------
20
+ # Test data:
21
+ # {{ liquid_var | debug }}
22
+ # cookie_options: {{ cookie_options | debug }}
23
+ # -----------------------------------------------------------------------------
24
+ {% endcomment %}
25
+
26
+ {% comment %} Liquid var initialization
27
+ -------------------------------------------------------------------------------- {% endcomment %}
28
+
29
+ {% comment %} Set config files
30
+ -------------------------------------------------------------------------------- {% endcomment %}
31
+ {% assign environment = site.environment %}
32
+ {% assign blocks = site.data.blocks %}
33
+ {% assign modules = site.data.modules %}
34
+ {% assign template_config = site.data.j1_config %}
35
+
36
+ {% comment %} Set config data
37
+ -------------------------------------------------------------------------------- {% endcomment %}
38
+ {% assign cookie_defaults = modules.defaults.cookies.defaults %}
39
+ {% assign cookie_settings = modules.cookies.settings %}
40
+ {% assign consent_defaults = modules.defaults.cookieconsent.defaults %}
41
+ {% assign consent_settings = modules.cookieconsent.settings %}
42
+ {% assign analytics_defaults = modules.defaults.analytics.defaults %}
43
+ {% assign analytics_settings = modules.analytics.settings %}
44
+
45
+ {% comment %} Set config options
46
+ -------------------------------------------------------------------------------- {% endcomment %}
47
+ {% assign consent_options = consent_defaults | merge: consent_settings %}
48
+ {% assign cookie_options = cookie_defaults | merge: cookie_settings %}
49
+ {% assign analytics_options = analytics_defaults | merge: analytics_settings %}
50
+
51
+ {% comment %} Set variables
52
+ -------------------------------------------------------------------------------- {% endcomment %}
53
+ {% assign tracking_enabled = analytics_options.enabled %}
54
+ {% assign tracking_id = analytics_options.google.trackingID %}
55
+
56
+ {% comment %} Detect prod mode
57
+ -------------------------------------------------------------------------------- {% endcomment %}
58
+ {% assign production = false %}
59
+ {% if environment == 'prod' or environment == 'production' %}
60
+ {% assign production = true %}
61
+ {% endif %}
62
+
63
+ /*
64
+ # -----------------------------------------------------------------------------
65
+ # ~/assets/themes/j1/adapter/js/cookieConsent.js
66
+ # JS Adapter for J1 CookieConsent
67
+ #
68
+ # Product/Info:
69
+ # http://jekyll.one
70
+ #
71
+ # Copyright (C) 2023, 2024 Juergen Adams
72
+ #
73
+ # J1 Theme is licensed under MIT License.
74
+ # See: https://github.com/jekyll-one/J1 Theme/blob/master/LICENSE
75
+ # -----------------------------------------------------------------------------
76
+ # Adapter generated: {{site.time}}
77
+ # -----------------------------------------------------------------------------
78
+ */
79
+
80
+ // -----------------------------------------------------------------------------
81
+ // ESLint shimming
82
+ // -----------------------------------------------------------------------------
83
+ /* eslint indent: "off" */
84
+ /* eslint quotes: "off" */
85
+ // -----------------------------------------------------------------------------
86
+ 'use strict';
87
+ j1.adapter.cookieConsent = ((j1, window) => {
88
+ var environment = '{{environment}}';
89
+ var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
90
+ var tracking_id = '{{tracking_id}}';
91
+ var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
92
+ var stringifiedAttributes = '';
93
+ var state = 'not_started';
94
+
95
+ var expireCookiesOnRequiredOnly;
96
+
97
+ var cookieDefaults;
98
+ var cookieSettings;
99
+ var cookieOptions;
100
+
101
+ var cookieConsentDefaults;
102
+ var cookieConsentSettings;
103
+ var cookieConsentOptions;
104
+
105
+ var $modal;
106
+ var cookie_names;
107
+ var user_cookie;
108
+ var url;
109
+ var baseUrl;
110
+ var hostname;
111
+ var auto_domain;
112
+ var check_cookie_option_domain;
113
+ var cookie_domain;
114
+ var secure;
115
+ var cookie_written;
116
+ var contentLanguage;
117
+ var navigatorLanguage;
118
+ var domainAttribute;
119
+
120
+ var logger;
121
+ var logText;
122
+ var _this;
123
+
124
+ // date|time
125
+ var startTime;
126
+ var endTime;
127
+ var startTimeModule;
128
+ var endTimeModule;
129
+ var timeSeconds;
130
+
131
+ // ---------------------------------------------------------------------------
132
+ // helper functions
133
+ // ---------------------------------------------------------------------------
134
+ // NOTE: RegEx for tracking_id: ^(G|UA|YT|MO)-[a-zA-Z0-9-]+$
135
+ // See: https://stackoverflow.com/questions/20411767/how-to-validate-google-analytics-tracking-id-using-a-javascript-function/20412153
136
+
137
+ // ---------------------------------------------------------------------------
138
+ // main
139
+ // ---------------------------------------------------------------------------
140
+ return {
141
+
142
+ // -------------------------------------------------------------------------
143
+ // adapter initializer
144
+ // -------------------------------------------------------------------------
145
+ init: (options) => {
146
+
147
+ // -----------------------------------------------------------------------
148
+ // default module settings
149
+ // -----------------------------------------------------------------------
150
+ var settings = $.extend({
151
+ module_name: 'j1.adapter.cookieConsent',
152
+ generated: '{{site.time}}'
153
+ }, options);
154
+
155
+ // -----------------------------------------------------------------------
156
+ // global variable settings
157
+ // -----------------------------------------------------------------------
158
+ _this = j1.adapter.cookieConsent;
159
+ logger = log4javascript.getLogger('j1.adapter.cookieConsent');
160
+ cookie_names = j1.getCookieNames();
161
+ url = new liteURL(window.location.href);
162
+ baseUrl = url.origin;
163
+ hostname = url.hostname;
164
+ auto_domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
165
+ secure = (url.protocol.includes('https')) ? true : false;
166
+ contentLanguage = '{{site.language}}';
167
+ navigatorLanguage = navigator.language || navigator.userLanguage;
168
+
169
+ // Load cookie DEFAULTS|CONFIG
170
+ cookieDefaults = $.extend({}, {{cookie_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
171
+ cookieSettings = $.extend({}, {{cookie_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
172
+ cookieOptions = $.extend(true, {}, cookieDefaults, cookieSettings);
173
+
174
+ // Load module DEFAULTS|CONFIG
175
+ cookieConsentDefaults = $.extend({}, {{consent_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
176
+ cookieConsentSettings = $.extend({}, {{consent_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
177
+ cookieConsentOptions = $.extend(true, {}, cookieConsentDefaults, cookieConsentSettings);
178
+
179
+ if (navigatorLanguage.indexOf("-") !== -1) {
180
+ navigatorLanguage = navigatorLanguage.split("-")[0];
181
+ }
182
+
183
+ if (cookieConsentOptions.dialogLanguage === 'auto') {
184
+ cookieConsentOptions.dialogLanguage = navigatorLanguage;
185
+ } else if (cookieConsentOptions.dialogLanguage === 'content') {
186
+ cookieConsentOptions.dialogLanguage = contentLanguage;
187
+ } else {
188
+ cookieConsentOptions.dialogLanguage = navigatorLanguage;
189
+ }
190
+
191
+ check_cookie_option_domain = (cookieOptions.domain === 'false') ? false : true;
192
+ expireCookiesOnRequiredOnly = (cookieOptions.expireCookiesOnRequiredOnly === 'true') ? true: false;
193
+
194
+ // -----------------------------------------------------------------------
195
+ // module initializer
196
+ // -----------------------------------------------------------------------
197
+ var dependencies_met_page_ready = setInterval((options) => {
198
+ var pageState = $('#content').css("display");
199
+ var pageVisible = (pageState === 'block') ? true : false;
200
+ var j1CoreFinished = (j1.getState() === 'finished') ? true : false;
201
+
202
+ if (j1CoreFinished) {
203
+ var same_site = cookieOptions.same_site;
204
+ var expires;
205
+
206
+ startTimeModule = Date.now();
207
+
208
+ _this.setState('started');
209
+ logger.debug('\n' + 'set module state to: ' + _this.getState());
210
+ logger.info('\n' + 'initializing module: started');
211
+
212
+ if (cookieConsentOptions.enabled) {
213
+ expires = cookieOptions.expires;
214
+ } else {
215
+ // expire permanent cookies to session
216
+ j1.expireCookie({ name: cookie_names.user_state });
217
+ j1.expireCookie({ name: cookie_names.user_consent });
218
+ j1.expireCookie({ name: cookie_names.user_translate });
219
+
220
+ // disable the themes menus
221
+ $('#themes_menu').css('display', 'none');
222
+ $('#themes_mmenu').css('display', 'none');
223
+ logger.warn('\n' + 'disable module: Themes');
224
+
225
+ // disable the quick link for (Google) Translation
226
+ $('#quickLinksTranslateButton').css('display', 'none');
227
+ logger.warn('\n' + 'disable module: Trranslator');
228
+ }
229
+
230
+ // set domain used by cookies
231
+ if (check_cookie_option_domain) {
232
+ if (cookieOptions.domain === 'auto') {
233
+ domainAttribute = auto_domain;
234
+ stringifiedAttributes += '; ' + 'Domain=' + domainAttribute;
235
+ } else {
236
+ domainAttribute = cookieOptions.domain;
237
+ stringifiedAttributes += '; ' + 'Domain=' + domainAttribute;
238
+ }
239
+ } else {
240
+ domainAttribute = cookieOptions.domain;
241
+ }
242
+
243
+ // failsafe: if 'None' is given for samesite in non-secure
244
+ // environments open access to cookies to subdomains
245
+ // ---------------------------------------------------------------------
246
+ if (same_site === 'None' && !secure) {
247
+ same_site = 'Lax';
248
+ }
249
+
250
+ // -------------------------------------------------------------------
251
+ // NOTE: Click events moved to Navigator (core)
252
+ // -------------------------------------------------------------------
253
+
254
+ if (cookieConsentOptions.enabled) {
255
+ logger.info('\n' + 'initialize core module');
256
+
257
+ j1.cookieConsent = new CookieConsent ({
258
+ contentURL: cookieConsentOptions.contentURL, // dialog content (modals) for all supported languages
259
+ cookieName: cookie_names.user_consent, // name of the consent cookie
260
+ cookieStorageDays: expires, // lifetime of a cookie [0..365], 0: session cookie
261
+ cookieSameSite: same_site, // restrict consent cookie
262
+ cookieSecure: secure, // only sent to the server with an encrypted request over HTTPS
263
+ cookieDomain: domainAttribute, // set domain (hostname|domain)
264
+ dialogLanguage: cookieConsentOptions.dialogLanguage, // language for the dialog (modal)
265
+ whitelisted: cookieConsentOptions.whitelisted, // pages NO cookie dialog is shown
266
+ reloadPageOnChange: cookieConsentOptions.reloadPageOnChange, // reload if setzings has changed
267
+ dialogContainerID: cookieConsentOptions.dialogContainerID, // container, the dialog modal is (dynamically) loaded
268
+ xhrDataElement: cookieConsentOptions.xhrDataElement, // container for all language-specific dialogs (modals)
269
+ postSelectionCallback: cookieConsentOptions.postSelectionCallback, // callback function, called after the user has made his selection
270
+ });
271
+ } else {
272
+ logger.warn('\n' + 'module is disabled');
273
+ } // END if cookieConsentOptions enabled
274
+
275
+ _this.setState('finished');
276
+ logger.debug('\n' + 'state: ' + _this.getState());
277
+ logger.info('\n' + 'module initialized successfully');
278
+
279
+ endTimeModule = Date.now();
280
+ logger.info('\n' + 'module initializing time: ' + (endTimeModule-startTimeModule) + 'ms');
281
+
282
+ clearInterval(dependencies_met_page_ready);
283
+ } // END j1CoreFinished
284
+ }, 10); // END dependencies_met_page_ready
285
+ }, // END init
286
+
287
+ // -------------------------------------------------------------------------
288
+ // cbCookie()
289
+ // callback for CookieConsent module after the user has
290
+ // made his selection
291
+ // -------------------------------------------------------------------------
292
+ cbCookie: () => {
293
+ var url = new liteURL(window.location.href);
294
+ var hostname = url.hostname;
295
+ var gaCookies = j1.findCookie('_ga');
296
+ var gasCookies = j1.findCookie('__ga');
297
+ var j1Cookies = j1.findCookie('j1');
298
+ var cookie_names = j1.getCookieNames();
299
+ var user_state = j1.readCookie(cookie_names.user_state);
300
+ var user_consent = j1.readCookie(cookie_names.user_consent);
301
+ var user_translate = j1.readCookie(cookie_names.user_translate);
302
+ var json = JSON.stringify(user_consent);
303
+ var user_agent = platform.ua;
304
+ var cookie_written;
305
+
306
+ logger.info('\n' + 'entered post selection callback from CookieConsent');
307
+ logger.info('\n' + 'current values from CookieConsent: ' + json);
308
+
309
+ // enable cookie button if not visible
310
+ if ($('#quickLinksCookieButton').css('display') === 'none') {
311
+ $('#quickLinksCookieButton').css('display', 'block');
312
+ }
313
+
314
+ // manage Google Analytics OptIn/Out
315
+ // See: https://github.com/luciomartinez/gtag-opt-in/wiki
316
+ if (tracking_enabled && tracking_id_valid) {
317
+ // Managing cookie life-time
318
+ // ---------------------------------------------------------------------
319
+ // If cookie settings allows only "required" cookies, all "persistent"
320
+ // cookies (Comments|Ads|Translation) get expired to "session" for
321
+ // better GDPR compliance. The GDPR regulations does NOT require
322
+ // any consent on session-only cookies.
323
+ //
324
+ if (!user_consent.analysis || !user_consent.personalization) {
325
+
326
+ // overload cookie consent settings
327
+ user_translate.analysis = user_consent.analysis;
328
+ user_translate.personalization = user_consent.personalization;
329
+ // disable translation service
330
+ user_translate.translationEnabled = false;
331
+
332
+ cookie_written = j1.writeCookie({
333
+ name: cookie_names.user_translate,
334
+ data: user_translate,
335
+ secure: secure
336
+ });
337
+
338
+ // expire permanent cookies to session
339
+ // -------------------------------------------------------------------
340
+ j1.expireCookie({ name: cookie_names.user_state });
341
+ j1.expireCookie({ name: cookie_names.user_consent });
342
+ j1.expireCookie({ name: cookie_names.user_translate });
343
+ }
344
+ if (cookieConsentOptions.reloadPageOnChange) {
345
+ // reload current page (skip cache)
346
+ location.reload(true);
347
+ }
348
+ } else {
349
+ // failsafe: Make (really) sure the all GA|GAS cookies removed
350
+ // left from a previous session/page view for better privacy compliance
351
+ // ---------------------------------------------------------------------
352
+
353
+ // remove cookies on invalid GA config or left from a previous
354
+ // session/page view if they exists
355
+ // ---------------------------------------------------------------------
356
+ gaCookies.forEach((item) => {
357
+ logger.warn('\n' + 'delete GA cookie: ' + item);
358
+ if (hostname === 'localhost') {
359
+ j1.removeCookie({ name: item, domain: false, secure: false });
360
+ } else {
361
+ j1.removeCookie({ name: item, domain: '.' + hostname, secure: false });
362
+ }
363
+ });
364
+
365
+ // remove cookies on invalid GAS config or left from a previous
366
+ // session/page view if they exists
367
+ // ---------------------------------------------------------------------
368
+ gasCookies.forEach((item) => {
369
+ // Remove cookies from Google Ads
370
+ logger.warn('\n' + 'delete GAS cookie: ' + item);
371
+ if (hostname === 'localhost') {
372
+ j1.removeCookie({ name: item, domain: false, secure: false });
373
+ } else {
374
+ j1.removeCookie({ name: item, domain: '.' + hostname, secure: false });
375
+ }
376
+ });
377
+
378
+ // managing cookie life-time. If cookie settings allows only
379
+ // "required" cookies, all "persistent" cookies (Comments|Ads|Translation)
380
+ // get expired to "session" for better GDPR compliance. The GDPR
381
+ // regulations|privacy does NOT require any consent on using cookies
382
+ // for session-only cookies.
383
+ // ---------------------------------------------------------------------
384
+ if (!user_consent.analysis || !user_consent.personalization) {
385
+ // overload cookie consent settings
386
+ user_translate.analysis = user_consent.analysis;
387
+ user_translate.personalization = user_consent.personalization;
388
+ // disable translation service
389
+ user_translate.translationEnabled = false;
390
+
391
+ cookie_written = j1.writeCookie({
392
+ name: cookie_names.user_translate,
393
+ data: user_translate,
394
+ secure: secure
395
+ });
396
+
397
+ if (expireCookiesOnRequiredOnly) {
398
+ // expire permanent cookies to session
399
+ j1.expireCookie({ name: cookie_names.user_state });
400
+ j1.expireCookie({ name: cookie_names.user_consent });
401
+ j1.expireCookie({ name: cookie_names.user_translate });
402
+ }
403
+ }
404
+
405
+ if (cookieConsentOptions.reloadPageOnChange) {
406
+ // reload current page (skip cache)
407
+ location.reload(true);
408
+ }
409
+ } // END if tracking_enabled
410
+ }, // END cbCookie
411
+
412
+ // -------------------------------------------------------------------------
413
+ // messageHandler()
414
+ // manage messages send from other J1 modules
415
+ // -------------------------------------------------------------------------
416
+ messageHandler: (sender, message) => {
417
+ var json_message = JSON.stringify(message, undefined, 2);
418
+
419
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
420
+ logger.debug(logText);
421
+
422
+ // -----------------------------------------------------------------------
423
+ // process commands|actions
424
+ // -----------------------------------------------------------------------
425
+ if (message.type === 'command' && message.action === 'module_initialized') {
426
+
427
+ //
428
+ // place handling of command|action here
429
+ //
430
+
431
+ logger.info('\n' + message.text);
432
+ }
433
+
434
+ //
435
+ // place handling of other command|action here
436
+ //
437
+
438
+ return true;
439
+ }, // END messageHandler
440
+
441
+ // -------------------------------------------------------------------------
442
+ // setState()
443
+ // sets the current (processing) state of the module
444
+ // -------------------------------------------------------------------------
445
+ setState: (stat) => {
446
+ _this.state = stat;
447
+ }, // END setState
448
+
449
+ // -------------------------------------------------------------------------
450
+ // getState()
451
+ // Returns the current (processing) state of the module
452
+ // -------------------------------------------------------------------------
453
+ getState: () => {
454
+ return _this.state;
455
+ } // END getState
456
+
457
+ }; // END main (return)
458
+ })(j1, window);
459
+
460
+ {% endcapture %}
461
+ {% if production %}
462
+ {{ cache | minifyJS }}
463
+ {% else %}
464
+ {{ cache | strip_empty_lines }}
465
+ {% endif %}
466
+ {% assign cache = nil %}