j1-template 2022.0.6 → 2022.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/modules/ads/google_ad_content_home.html +11 -0
  3. data/_includes/themes/j1/modules/ads/google_ad_top_home.html +11 -0
  4. data/_layouts/default.html +0 -57
  5. data/apps/public/cc/index.adoc +0 -1
  6. data/assets/data/article_navigator/index.html +0 -1
  7. data/assets/data/news_panel_posts/index.html +0 -1
  8. data/assets/error_pages/HTTP444.html +4 -4
  9. data/assets/error_pages/HTTP445.html +7 -6
  10. data/assets/error_pages/HTTP446.html +110 -0
  11. data/assets/error_pages/HTTP447.html +110 -0
  12. data/assets/error_pages/HTTP448.html +111 -0
  13. data/assets/themes/j1/adapter/js/advertising.js +416 -0
  14. data/assets/themes/j1/adapter/js/cookieConsent.js +72 -37
  15. data/assets/themes/j1/adapter/js/framer.js +0 -3
  16. data/assets/themes/j1/adapter/js/j1.js +120 -212
  17. data/assets/themes/j1/adapter/js/rouge.js +1 -1
  18. data/assets/themes/j1/adapter/js/scroller.js +1 -1
  19. data/assets/themes/j1/adapter/js/themer.js +0 -1
  20. data/assets/themes/j1/adapter/js/translator.js +147 -98
  21. data/assets/themes/j1/core/css/themes/unodark/bootstrap.css +6 -0
  22. data/assets/themes/j1/core/css/themes/unodark/bootstrap.min.css +1 -1
  23. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +6 -0
  24. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
  25. data/assets/themes/j1/modules/advertising/js/google/adInitializer.js +117 -0
  26. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +29 -13
  27. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +1 -1
  28. data/assets/themes/j1/modules/deeplAPI/js/deeplAPI.2.js +1 -1
  29. data/assets/themes/j1/modules/deeplAPI/js/deeplAPI.js +1 -1
  30. data/assets/themes/j1/modules/scroller/js/scroller.js +1 -1
  31. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +0 -1
  32. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
  33. data/assets/themes/j1/modules/translator/js/translator.js +98 -63
  34. data/assets/themes/j1/modules/translator/js/translator.min.js +1 -1
  35. data/lib/j1/version.rb +3 -3
  36. data/lib/starter_web/Gemfile +1 -1
  37. data/lib/starter_web/_config.yml +2 -7
  38. data/lib/starter_web/_data/layouts/default.yml +7 -7
  39. data/lib/starter_web/_data/layouts/home.yml +24 -0
  40. data/lib/starter_web/_data/modules/advertising.yml +137 -10
  41. data/lib/starter_web/_data/modules/cookies.yml +30 -0
  42. data/lib/starter_web/_data/modules/defaults/advertising.yml +105 -0
  43. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +3 -3
  44. data/lib/starter_web/_data/modules/defaults/cookies.yml +112 -0
  45. data/lib/starter_web/_data/modules/navigator_menu.yml +10 -1
  46. data/lib/starter_web/_data/resources.yml +24 -0
  47. data/lib/starter_web/_includes/attributes.asciidoc +6 -1
  48. data/lib/starter_web/_includes/themes/j1/modules/ads/google_ad_content_home.html +11 -0
  49. data/lib/starter_web/_includes/themes/j1/modules/ads/google_ad_top_home.html +11 -0
  50. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  51. data/lib/starter_web/index.html +0 -1
  52. data/lib/starter_web/package.json +1 -1
  53. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/100_converter.adoc +1 -1
  54. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/200_themes.adoc +1 -1
  55. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +0 -1
  56. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +0 -1
  57. data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +0 -1
  58. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +1 -2
  59. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +1 -2
  60. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +1 -2
  61. data/lib/starter_web/pages/public/blog/navigator/archive.html +1 -2
  62. data/lib/starter_web/pages/public/blog/navigator/index.html +1 -2
  63. data/lib/starter_web/pages/public/learn/quickstart.adoc +1 -1
  64. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +4 -3
  65. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.ads.asciidoc +265 -0
  66. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.no_ads.asciidoc +237 -0
  67. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +64 -2
  68. data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +1 -1
  69. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +1 -1
  70. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +1 -1
  71. data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +1 -1
  72. data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +1 -1
  73. data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +1 -1
  74. data/lib/starter_web/pages/public/learn/roundtrip/600_quicksearch.adoc +1 -1
  75. data/lib/starter_web/pages/public/learn/roundtrip/_includes/google-ad.js +130 -0
  76. data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +2 -12
  77. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +0 -1
  78. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +0 -1
  79. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +2 -12
  80. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +0 -1
  81. data/lib/starter_web/pages/public/manuals/dropdown-help.adoc +1 -1
  82. data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +1 -1
  83. data/lib/starter_web/pages/public/previewer/preview_bootstrap_theme.adoc +1 -1
  84. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  85. data/lib/starter_web/utilsrv/package.json +1 -1
  86. metadata +17 -47
  87. data/_includes/themes/j1/modules/connectors/ad/custom-provider.html +0 -30
  88. data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +0 -62
  89. data/_includes/themes/j1/modules/connectors/ads +0 -56
  90. data/lib/starter_web/pages/_test_pages/100_side-bar-tester.adoc +0 -244
  91. data/lib/starter_web/pages/_test_pages/_includes/attributes.asciidoc +0 -110
  92. data/lib/starter_web/pages/_test_pages/_includes/documents/100_gistblock.asciidoc +0 -28
  93. data/lib/starter_web/pages/_test_pages/_includes/documents/410_bottom_info.asciidoc +0 -14
  94. data/lib/starter_web/pages/_test_pages/_includes/documents/410_bottom_left_warning.asciidoc +0 -11
  95. data/lib/starter_web/pages/_test_pages/_includes/documents/410_bottom_right_danger.asciidoc +0 -11
  96. data/lib/starter_web/pages/_test_pages/_includes/documents/410_central_success.asciidoc +0 -11
  97. data/lib/starter_web/pages/_test_pages/_includes/documents/410_full_height_left_info.asciidoc +0 -11
  98. data/lib/starter_web/pages/_test_pages/_includes/documents/410_full_height_right_success.asciidoc +0 -11
  99. data/lib/starter_web/pages/_test_pages/_includes/documents/410_table_bs_modal_examples.asciidoc +0 -47
  100. data/lib/starter_web/pages/_test_pages/_includes/documents/410_top_info.asciidoc +0 -11
  101. data/lib/starter_web/pages/_test_pages/_includes/documents/410_top_left_info.asciidoc +0 -11
  102. data/lib/starter_web/pages/_test_pages/_includes/documents/410_top_right_success.asciidoc +0 -11
  103. data/lib/starter_web/pages/_test_pages/_includes/documents/419_advanced_modals_demo.asciidoc +0 -337
  104. data/lib/starter_web/pages/_test_pages/_includes/documents/tables/bs_modal_examples.asciidoc +0 -47
  105. data/lib/starter_web/pages/_test_pages/accordion-01-tester.adoc +0 -220
  106. data/lib/starter_web/pages/_test_pages/accordion-02-tester.adoc +0 -177
  107. data/lib/starter_web/pages/_test_pages/accordion-03-tester.adoc +0 -148
  108. data/lib/starter_web/pages/_test_pages/attribute-changes-01-tester.adoc +0 -226
  109. data/lib/starter_web/pages/_test_pages/backdrop-tester.adoc +0 -109
  110. data/lib/starter_web/pages/_test_pages/button-tester-1.adoc +0 -127
  111. data/lib/starter_web/pages/_test_pages/card-tester.adoc +0 -128
  112. data/lib/starter_web/pages/_test_pages/cookieConsent.adoc +0 -96
  113. data/lib/starter_web/pages/_test_pages/deepl.0.adoc +0 -258
  114. data/lib/starter_web/pages/_test_pages/deepl.adoc +0 -204
  115. data/lib/starter_web/pages/_test_pages/desandro-button.adoc +0 -171
  116. data/lib/starter_web/pages/_test_pages/desandro.adoc +0 -147
  117. data/lib/starter_web/pages/_test_pages/flipcard-1-tester.adoc +0 -308
  118. data/lib/starter_web/pages/_test_pages/formular-01-tester.adoc +0 -167
  119. data/lib/starter_web/pages/_test_pages/formular-02-tester.adoc +0 -727
  120. data/lib/starter_web/pages/_test_pages/google-translate-tester.0.adoc +0 -113
  121. data/lib/starter_web/pages/_test_pages/google-translate-tester.1.adoc +0 -233
  122. data/lib/starter_web/pages/_test_pages/google-translate-tester.3.adoc +0 -149
  123. data/lib/starter_web/pages/_test_pages/google-translate-tester.4.adoc +0 -239
  124. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-2.adoc +0 -183
  125. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-3.adoc +0 -235
  126. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-4.adoc +0 -222
  127. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester-5.adoc +0 -119
  128. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester.1.adoc +0 -236
  129. data/lib/starter_web/pages/_test_pages/infinite-scroll-tester.adoc +0 -225
  130. data/lib/starter_web/pages/_test_pages/list-group-tester.adoc +0 -265
  131. data/lib/starter_web/pages/_test_pages/tictok.adoc +0 -127
@@ -0,0 +1,416 @@
1
+ ---
2
+ regenerate: true
3
+ ---
4
+
5
+ {% capture cache %}
6
+
7
+ {% comment %}
8
+ # -----------------------------------------------------------------------------
9
+ # ~/assets/themes/j1/adapter/js/advertising.js
10
+ # Liquid template to adapt advertising plugin
11
+ #
12
+ # Product/Info:
13
+ # https://jekyll.one
14
+ # Copyright (C) 2021 Juergen Adams
15
+ #
16
+ # J1 Template is licensed under the MIT License.
17
+ # For details, see https://jekyll.one
18
+ # -----------------------------------------------------------------------------
19
+ # Test data:
20
+ # {{ liquid_var | debug }}
21
+ # advertising_options: {{ advertising_options | debug }}
22
+ # -----------------------------------------------------------------------------
23
+ {% endcomment %}
24
+
25
+ {% comment %} Liquid procedures
26
+ -------------------------------------------------------------------------------- {% endcomment %}
27
+
28
+ {% comment %} Set global settings
29
+ -------------------------------------------------------------------------------- {% endcomment %}
30
+ {% assign environment = site.environment %}
31
+ {% assign asset_path = "/assets/themes/j1" %}
32
+
33
+ {% comment %} Process YML config data
34
+ ================================================================================ {% endcomment %}
35
+
36
+ {% comment %} Set config files
37
+ -------------------------------------------------------------------------------- {% endcomment %}
38
+ {% assign template_config = site.data.j1_config %}
39
+ {% assign blocks = site.data.blocks %}
40
+ {% assign modules = site.data.modules %}
41
+
42
+ {% comment %} Set config data (settings only)
43
+ -------------------------------------------------------------------------------- {% endcomment %}
44
+ {% assign cookie_defaults = modules.defaults.cookies.defaults %}
45
+ {% assign cookie_settings = modules.cookies.settings %}
46
+ {% assign advertising_defaults = modules.defaults.advertising.defaults %}
47
+ {% assign advertising_settings = modules.advertising.settings %}
48
+
49
+ {% comment %} Set config options (settings only)
50
+ -------------------------------------------------------------------------------- {% endcomment %}
51
+ {% assign cookie_options = cookie_defaults | merge: cookie_settings %}
52
+ {% assign advertising_options = advertising_defaults | merge: advertising_settings %}
53
+
54
+ {% comment %} Variables
55
+ -------------------------------------------------------------------------------- {% endcomment %}
56
+ {% assign advertising = advertising_options.enabled %}
57
+ {% assign advertising_provider = advertising_options.provider %}
58
+
59
+ {% assign production = false %}
60
+ {% if environment == 'prod' or environment == 'production' %}
61
+ {% assign production = true %}
62
+ {% endif %}
63
+
64
+ /*
65
+ # -----------------------------------------------------------------------------
66
+ # ~/assets/themes/j1/adapter/js/advertising.js
67
+ # J1 Adapter for advertising
68
+ #
69
+ # Product/Info:
70
+ # https://jekyll.one
71
+ #
72
+ # Copyright (C) 2021 Juergen Adams
73
+ #
74
+ # J1 Template is licensed under the MIT License.
75
+ # For details, see https://jekyll.one
76
+ # -----------------------------------------------------------------------------
77
+ # Adapter generated: {{site.time}}
78
+ # -----------------------------------------------------------------------------
79
+ */
80
+
81
+ // -----------------------------------------------------------------------------
82
+ // ESLint shimming
83
+ // -----------------------------------------------------------------------------
84
+ /* eslint indent: "off" */
85
+ // -----------------------------------------------------------------------------
86
+ 'use strict';
87
+
88
+ {% comment %} Main
89
+ -------------------------------------------------------------------------------- {% endcomment %}
90
+ j1.adapter['advertising'] = (function (j1, window) {
91
+
92
+ {% comment %} Set global variables
93
+ -------------------------------------------------------------------------------- {% endcomment %}
94
+ var environment = '{{environment}}';
95
+ var gadScript = document.createElement('script');
96
+ var adInitializerScript = document.createElement('script');
97
+ var autoHideOnUnfilled = {{advertising_options.google.autoHideOnUnfilled}};
98
+ var addBorderOnUnfilled = {{advertising_options.google.addBorderOnUnfilled}};
99
+ var checkTrackingProtection = {{advertising_options.google.checkTrackingProtection}};
100
+ var showErrorPageOnBlocked = {{advertising_options.google.showErrorPageOnBlocked}};
101
+ var adInitializerScriptText;
102
+ var tracking_protection;
103
+ var url;
104
+ var baseUrl;
105
+ var hostname;
106
+ var cookie_names;
107
+ var user_consent;
108
+ var domain;
109
+ var domainAttribute;
110
+ var cookie_option_domain;
111
+ var cookie_domain;
112
+ var _this;
113
+ var logger;
114
+ var logText;
115
+
116
+ // ---------------------------------------------------------------------------
117
+ // Main object
118
+ // ---------------------------------------------------------------------------
119
+ return {
120
+
121
+ // -------------------------------------------------------------------------
122
+ // init()
123
+ // adapter initializer
124
+ // -------------------------------------------------------------------------
125
+ init: function (options) {
126
+
127
+ {% if advertising %}
128
+ // [INFO ] [j1.adapter.advertising ] [ detected advertising provider (j1_config): {{advertising_provider}}} ]
129
+ // [INFO ] [j1.adapter.advertising ] [ start processing load region head, layout: {{page.layout}} ]
130
+
131
+ cookie_names = j1.getCookieNames();
132
+ user_consent = j1.readCookie(cookie_names.user_consent);
133
+ url = new liteURL(window.location.href);
134
+ baseUrl = url.origin;
135
+ hostname = url.hostname;
136
+ domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
137
+ cookie_option_domain = '{{cookie_options.domain}}';
138
+
139
+ // set domain used by cookies
140
+ if (cookie_option_domain == 'auto') {
141
+ domainAttribute = domain ;
142
+ } else {
143
+ domainAttribute = hostname;
144
+ }
145
+
146
+ {% case advertising_provider %}
147
+ {% when "google" %}
148
+ // [INFO ] [j1.adapter.advertising ] [ place provider: Google Adsense ]
149
+ _this = j1.adapter.advertising;
150
+ logger = log4javascript.getLogger('j1.adapter.advertising.google');
151
+ // initialize state flag
152
+ _this.setState('started');
153
+ logger.info('\n' + 'state: ' + _this.getState());
154
+ logger.info('\n' + 'module is being initialized');
155
+ // default module settings
156
+ var settings = $.extend({
157
+ module_name: 'j1.adapter.advertising',
158
+ generated: '2021-12-18 18:55:38 +0000'
159
+ }, options);
160
+
161
+ var dependencies_met_page_ready = setInterval(function() {
162
+ if (j1.getState() == 'finished') {
163
+ if (user_consent.personalization) {
164
+ // place all ads configured for the page
165
+ // NOTE: currently NOT implemented/used
166
+ // -----------------------------------------------------------------
167
+ // _this.place_ads();
168
+
169
+ // add gad api dynamically in the head section
170
+ // -----------------------------------------------------------------
171
+ logger.info('\n' + 'add gad api dynamically in section: head');
172
+ gadScript.async = true;
173
+ gadScript.id = 'gad-api';
174
+ gadScript.src = '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
175
+ gadScript.setAttribute('data-ad-client', 'ca-pub-3885670015316130');
176
+ document.head.appendChild(gadScript);
177
+
178
+ // setup monitor for state changes on all ads configured
179
+ // ---------------------------------------------------------------
180
+ logger.info('\n' + 'setup monitoring');
181
+ _this.monitor_ads();
182
+
183
+ // run protection check
184
+ // -------------------------------------------------------------------
185
+ if (checkTrackingProtection) {
186
+ logger.info('\n' + 'run checks for tracking protection');
187
+ _this.check_tracking_protection();
188
+
189
+ var dependencies_met_tracking_check_ready = setInterval (function (options) {
190
+ if (typeof tracking_protection !== 'undefined' ) {
191
+
192
+ var browser_tracking_feature = navigator.DoNotTrack;
193
+
194
+ if (!tracking_protection && !browser_tracking_feature) {
195
+ logText = '\n' + 'tracking protection: disabled';
196
+ logger.info(logText);
197
+ } else {
198
+ logText = '\n' + 'tracking protection: enabled';
199
+ logger.warn(logText);
200
+
201
+ if (showErrorPageOnBlocked) {
202
+ logger.error('\n' + 'redirect to error page (blocked content): HTML-447');
203
+ // redirect to error page: blocked content
204
+ window.location.href = '/447.html';
205
+ }
206
+ }
207
+ }
208
+ clearInterval(dependencies_met_tracking_check_ready);
209
+ }, 25);
210
+ } else {
211
+ // setup monitor for state changes on all ads configured
212
+ // ---------------------------------------------------------------
213
+ logger.info('\n' + 'setup monitoring');
214
+ _this.monitor_ads();
215
+
216
+ _this.setState('finished');
217
+ logger.info('\n' + 'state: ' + _this.getState());
218
+ logger.info('\n' + 'module initialized successfully');
219
+ clearInterval(dependencies_met_tracking_check_ready);
220
+ }
221
+ clearInterval(dependencies_met_page_ready);
222
+ } else {
223
+ var gaCookies = j1.findCookie('_ga');
224
+ logger.warn('\n' + 'consent on cookies disabled for personalization');
225
+ logger.warn('\n' + 'initialization of module advertising skipped');
226
+
227
+ // jadams, 2021-12-19: remove cookies on invalid GAD config
228
+ // or left cookies from previous session
229
+ // -----------------------------------------------------------------
230
+ j1.removeCookie({ name: '__gads' });
231
+
232
+ // jadams, 2021-12-19: delete cookies in loop doesn't work
233
+ // gaCookies.forEach(function (item) {
234
+ // logger.warn('\n' + 'delete GAD cookie: ' + item);
235
+ // // j1.removeCookie({ name: item, domain: domainAttribute });
236
+ // // j1.removeCookie({ name: item });
237
+ // });
238
+
239
+ if (checkTrackingProtection) {
240
+ if (!user_consent.personalization) {
241
+ logText = '\n' + 'consent on cookies disabled for personalization';
242
+ logger.warn(logText);
243
+
244
+ if (showErrorPageOnBlocked) {
245
+ logger.error('\n' + 'redirect to error page (blocked content): HTML-447');
246
+ // redirect to error page: blocked content
247
+ window.location.href = '/448.html';
248
+ }
249
+ }
250
+ }
251
+ clearInterval(dependencies_met_page_ready);
252
+ } // END if user_consent.personalization
253
+ } // END if getState 'finished'
254
+ }, 25);
255
+
256
+ {% when "custom" %}
257
+ // [INFO ] [j1.adapter.advertising ] [ place provider: Custom Provider ]
258
+ {% endcase %}
259
+ // [INFO ] [j1.adapter.advertising ] [ end processing ]
260
+ {% else %}
261
+ var dependencies_met_page_ready = setInterval(function() {
262
+ if (j1.getState() == 'finished') {
263
+ var ads_found = document.getElementsByClassName('adsbygoogle').length;
264
+ logger = log4javascript.getLogger('j1.adapter.advertising.google');
265
+ logger.warn('\n' + 'found ads in page: #' + ads_found);
266
+ logger.warn('\n' + 'no ads initialized, advertising disabled');
267
+ clearInterval(dependencies_met_page_ready);
268
+ }
269
+ }, 25);
270
+ {% endif %}
271
+ return;
272
+ }, // END init
273
+
274
+ // -------------------------------------------------------------------------
275
+ // monitor_ads()
276
+ // monitor for state changes on the ad
277
+ // -------------------------------------------------------------------------
278
+ monitor_ads: function () {
279
+
280
+ $('.adsbygoogle').attrchange({
281
+ trackValues: true,
282
+ callback: function (event) {
283
+ if (event.newValue === 'unfilled') {
284
+ var elm = event.target.dataset;
285
+ if (addBorderOnUnfilled) { $('.adsbygoogle').addClass('border--dotted'); }
286
+ if (elm.adClient) {
287
+ logger.warn('\n' + 'found ad state ' + event.newValue + ' for slot: ' + elm.adSlot);
288
+ if (autoHideOnUnfilled) {
289
+ logger.warn('\n' + ' hide ad for slot: ' + elm.adSlot);
290
+ $('#' + elm.adSlot ).hide();
291
+ }
292
+ }
293
+ }
294
+ }
295
+ });
296
+ },
297
+
298
+ // -------------------------------------------------------------------------
299
+ // check_tracking_protection()
300
+ // detect if a user is using tracking protection
301
+ // NOTE:
302
+ // Firefox uses a list obtained from 'https://disconnect.me/trackerprotection'
303
+ // for its tracking protection. The checker use an image loaded from a
304
+ // domain that is on that list (facebook.com), and an image that will
305
+ // exist (tracking pixel).
306
+ //
307
+ // See for more details:
308
+ // https://stackoverflow.com/questions/33959324/how-to-detect-if-a-user-is-using-tracking-protection-in-firefox-42
309
+ // -------------------------------------------------------------------------
310
+ check_tracking_protection: function () {
311
+ var logger = log4javascript.getLogger('j1.adapter.advertising.tracking.monitor');
312
+
313
+ logText = '\n' + 'check for trackingprotection';
314
+ logger.info(logText);
315
+
316
+ function checkTrackingProtection() {
317
+ if (!checkTrackingProtection.promise) {
318
+ checkTrackingProtection.promise = new Promise(function(resolve, reject) {
319
+
320
+ var time = Date.now();
321
+ var img = new Image();
322
+ img.onload = resolve;
323
+ img.onerror = function() {
324
+ if ((Date.now() - time) < 50) {
325
+ reject(new Error("Rejected."));
326
+ } else {
327
+ resolve(new Error("Takes too long."));
328
+ }
329
+ };
330
+ img.src = '//www.facebook.com/tr/';
331
+ }).then((result) => {
332
+ tracking_protection = false;
333
+ }).catch(e => {
334
+ tracking_protection = true;
335
+ logger.debug('\n' + 'detection details: ' + e);
336
+ });
337
+ }
338
+ }
339
+ checkTrackingProtection();
340
+ }, // END check_tracking_protection
341
+
342
+ // -------------------------------------------------------------------------
343
+ // place_ads()
344
+ // place ads configured|enabled
345
+ // -------------------------------------------------------------------------
346
+ place_ads: function () {
347
+
348
+ logText = '\n' + 'ads are being placed';
349
+ logger.info(logText);
350
+
351
+ // START loadig ads
352
+ var dependencies_met_page_ready = setInterval (function (options) {
353
+ if (j1.getState() === 'finished') {
354
+
355
+ {% comment %} See loop for loading elements with adapter/scroller.js
356
+ ---------------------------------------------------------------------- {% endcomment %}
357
+ clearInterval(dependencies_met_page_ready);
358
+
359
+ }
360
+ });
361
+ // END place ads
362
+ },
363
+
364
+ // -------------------------------------------------------------------------
365
+ // messageHandler()
366
+ // manage messages send from other J1 modules
367
+ // -------------------------------------------------------------------------
368
+ messageHandler: function (sender, message) {
369
+ var json_message = JSON.stringify(message, undefined, 2);
370
+
371
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
372
+ logger.debug(logText);
373
+
374
+ // -----------------------------------------------------------------------
375
+ // Process commands|actions
376
+ // -----------------------------------------------------------------------
377
+ if (message.type === 'command' && message.action === 'module_initialized') {
378
+ //
379
+ // Place handling of command|action here
380
+ //
381
+ logger.info('\n' + message.text);
382
+ }
383
+
384
+ //
385
+ // Place handling of other command|action here
386
+ //
387
+
388
+ return true;
389
+ }, // END messageHandler
390
+
391
+ // -------------------------------------------------------------------------
392
+ // setState()
393
+ // Sets the current (processing) state of the module
394
+ // -------------------------------------------------------------------------
395
+ setState: function (stat) {
396
+ _this.state = stat;
397
+ }, // END setState
398
+
399
+ // -------------------------------------------------------------------------
400
+ // getState()
401
+ // Returns the current (processing) state of the module
402
+ // -------------------------------------------------------------------------
403
+ getState: function () {
404
+ return _this.state;
405
+ } // END getState
406
+
407
+ }; // END return
408
+ })(j1, window);
409
+
410
+ {% endcapture %}
411
+ {% if production %}
412
+ {{ cache | minifyJS }}
413
+ {% else %}
414
+ {{ cache | strip_empty_lines }}
415
+ {% endif %}
416
+ {% assign cache = nil %}
@@ -34,6 +34,9 @@ regenerate: true
34
34
 
35
35
  {% comment %} Set config data
36
36
  -------------------------------------------------------------------------------- {% endcomment %}
37
+ {% assign cookie_defaults = modules.defaults.cookies.defaults %}
38
+ {% assign cookie_settings = modules.cookies.settings %}
39
+
37
40
  {% assign consent_defaults = modules.defaults.cookieconsent.defaults %}
38
41
  {% assign consent_settings = modules.cookieconsent.settings %}
39
42
  {% assign tracking_enabled = template_config.analytics.enabled %}
@@ -44,6 +47,7 @@ regenerate: true
44
47
  {% comment %} Set config options
45
48
  -------------------------------------------------------------------------------- {% endcomment %}
46
49
  {% assign consent_options = consent_defaults | merge: consent_settings %}
50
+ {% assign cookie_options = cookie_defaults | merge: cookie_settings %}
47
51
 
48
52
  {% assign production = false %}
49
53
  {% if environment == 'prod' or environment == 'production' %}
@@ -87,18 +91,21 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
87
91
  var moduleOptions = {};
88
92
  var _this;
89
93
  var $modal;
94
+ var cookie_names;
90
95
  var user_cookie;
91
96
  var logger;
92
97
  var url;
93
98
  var baseUrl;
94
99
  var hostname;
95
100
  var domain;
101
+ var cookie_option_domain;
96
102
  var cookie_domain;
97
103
  var secure;
98
104
  var logText;
99
105
  var cookie_written;
100
106
  var contentLanguage;
101
107
  var navigatorLanguage;
108
+ var domainAttribute;
102
109
 
103
110
  // NOTE: RegEx for tracking_id: ^(G|UA|YT|MO)-[a-zA-Z0-9-]+$
104
111
  // See: https://stackoverflow.com/questions/20411767/how-to-validate-google-analytics-tracking-id-using-a-javascript-function/20412153
@@ -120,22 +127,17 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
120
127
  // -----------------------------------------------------------------------
121
128
  // globals
122
129
  // -----------------------------------------------------------------------
123
- _this = j1.adapter.cookieConsent;
124
- logger = log4javascript.getLogger('j1.adapter.cookieConsent');
125
- url = new liteURL(window.location.href);
126
- baseUrl = url.origin;
127
- hostname = url.hostname;
128
- domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
129
- secure = (url.protocol.includes('https')) ? true : false;
130
- contentLanguage = '{{site.language}}';
131
- navigatorLanguage = navigator.language || navigator.userLanguage;
132
-
133
- // set domain used by cookies
134
- if(domain !== 'localhost') {
135
- cookie_domain = '.' + hostname;
136
- } else {
137
- cookie_domain = hostname;
138
- }
130
+ _this = j1.adapter.cookieConsent;
131
+ logger = log4javascript.getLogger('j1.adapter.cookieConsent');
132
+ cookie_names = j1.getCookieNames();
133
+ url = new liteURL(window.location.href);
134
+ baseUrl = url.origin;
135
+ hostname = url.hostname;
136
+ domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
137
+ cookie_option_domain = '{{cookie_options.domain}}';
138
+ secure = (url.protocol.includes('https')) ? true : false;
139
+ contentLanguage = '{{site.language}}';
140
+ navigatorLanguage = navigator.language || navigator.userLanguage;
139
141
 
140
142
  // initialize state flag
141
143
  _this.state = 'pending';
@@ -169,6 +171,16 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
169
171
  // initializer
170
172
  // -----------------------------------------------------------------------
171
173
  var dependencies_met_page_ready = setInterval (function (options) {
174
+ var expires = '{{cookie_options.expires}}';
175
+ var same_site = '{{cookie_options.same_site}}';
176
+
177
+ // set domain used by cookies
178
+ if (cookie_option_domain == 'auto') {
179
+ domainAttribute = domain ;
180
+ } else {
181
+ domainAttribute = '';
182
+ }
183
+
172
184
  if ( j1.getState() === 'finished' ) {
173
185
  _this.setState('started');
174
186
  logger.info('\n' + 'state: ' + _this.getState());
@@ -176,8 +188,11 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
176
188
 
177
189
  j1.cookieConsent = new CookieConsent ({
178
190
  contentURL: moduleOptions.contentURL, // dialog content (modals) for all supported languages
179
- cookieName: moduleOptions.cookieName, // name of the consent cookie
180
- cookieSameSite: moduleOptions.cookieSameSite, // restrict consent cookie
191
+ cookieName: cookie_names.user_consent, // name of the consent cookie
192
+ cookieStorageDays: expires, // lifetime of a cookie [0..365], 0: session cookie
193
+ cookieSameSite: same_site, // restrict consent cookie
194
+ cookieSecure: secure, // only sent to the server with an encrypted request over HTTPS
195
+ cookieDomain: domainAttribute, // set domain (hostname|domain)
181
196
  dialogLanguage: moduleOptions.dialogLanguage, // language for the dialog (modal)
182
197
  whitelisted: moduleOptions.whitelisted, // pages NOt dialog is shown
183
198
  reloadPageOnChange: moduleOptions.reloadPageOnChange, // reload if setzings has changed
@@ -190,16 +205,13 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
190
205
  logger.info('\n' + 'state: ' + _this.getState());
191
206
  logger.debug('\n' + 'module initialized successfully');
192
207
 
193
- // Click events moved to Navigator (core)
194
- //
195
- // $('#quickLinksCookieButton').click(function(e) {
196
- // logger.info('\n' + 'call default action');
197
- // j1.cookieConsent.showDialog();
198
- // });
208
+ // -------------------------------------------------------------------
209
+ // NOTE: Click events moved to Navigator (core)
210
+ // -------------------------------------------------------------------
199
211
 
200
212
  clearInterval(dependencies_met_page_ready);
201
213
  }
202
- });
214
+ }, 25);
203
215
  }, // END init
204
216
 
205
217
  // -------------------------------------------------------------------------
@@ -301,23 +313,27 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
301
313
  }
302
314
  }
303
315
 
304
- // Managing providers for personalization OptIn/Out (Comments|Ads)
316
+ // Managing providers using personalization OptIn/Out
317
+ // (Comments|Ads|Translation)
305
318
  //
306
319
  if (!user_consent.analysis || !user_consent.personalization) {
307
- // expire consent|state cookies to session
308
- j1.expireCookie({ name: cookie_names.user_state });
309
- j1.expireCookie({ name: cookie_names.user_consent });
310
- j1.expireCookie({ name: cookie_names.user_translate });
311
320
 
321
+ // overload cookie consent settings
322
+ user_translate.analysis = user_consent.analysis;
323
+ user_translate.personalization = user_consent.personalization;
324
+ // disable translation service
312
325
  user_translate.translationEnabled = false;
326
+
313
327
  cookie_written = j1.writeCookie({
314
328
  name: cookie_names.user_translate,
315
329
  data: user_translate,
316
- samesite: 'Strict',
317
- secure: secure,
318
- expires: 365
330
+ secure: secure
319
331
  });
320
332
 
333
+ // expire permanent cookies to session
334
+ j1.expireCookie({ name: cookie_names.user_state });
335
+ j1.expireCookie({ name: cookie_names.user_consent });
336
+ j1.expireCookie({ name: cookie_names.user_translate });
321
337
  }
322
338
  if (moduleOptions.reloadPageOnChange) {
323
339
  // reload current page (skip cache)
@@ -326,19 +342,38 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
326
342
  } else {
327
343
  // jadams, 2021-08-10: remove cookies on invalid GA config or left
328
344
  // cookies from previous session if they exists
345
+ // ---------------------------------------------------------------------
329
346
  gaCookies.forEach(function (item) {
330
- logger.warn('\n' + 'delete GA cookie: ' + item);
331
- j1.removeCookie({ name: item, domain: cookie_domain });
347
+ // Skip cookies from Google Ads
348
+ var gad = item.includes('gad');
349
+ if (!gad) {
350
+ logger.warn('\n' + 'delete GA cookie: ' + item);
351
+ j1.removeCookie({ name: item, domain: cookie_domain });
352
+ }
332
353
  });
333
354
 
334
- // Managing providers for personalization OptIn/Out (Comments|Ads)
355
+ // Managing providers using personalization OptIn/Out
356
+ // (Comments|Ads|Translation)
335
357
  //
336
358
  if (!user_consent.analysis || !user_consent.personalization) {
337
- // expire consent|state cookies to session
359
+ // overload cookie consent settings
360
+ user_translate.analysis = user_consent.analysis;
361
+ user_translate.personalization = user_consent.personalization;
362
+ // disable translation service
363
+ user_translate.translationEnabled = false;
364
+
365
+ cookie_written = j1.writeCookie({
366
+ name: cookie_names.user_translate,
367
+ data: user_translate,
368
+ secure: secure
369
+ });
370
+
371
+ // expire permanent cookies to session
338
372
  j1.expireCookie({ name: cookie_names.user_state });
339
373
  j1.expireCookie({ name: cookie_names.user_consent });
340
374
  j1.expireCookie({ name: cookie_names.user_translate });
341
375
  }
376
+
342
377
  if (moduleOptions.reloadPageOnChange) {
343
378
  // reload current page (skip cache)
344
379
  location.reload(true);
@@ -164,12 +164,9 @@ j1.adapter['framer'] = (function (j1, window) {
164
164
  logger.info('\n' + 'initializing module finished');
165
165
 
166
166
  clearInterval(dependencies_met_page_finished);
167
-
168
167
  return true;
169
-
170
168
  }
171
169
  }, 25);
172
-
173
170
  }, // END init
174
171
 
175
172
  // -------------------------------------------------------------------------