j1-template 2021.1.7 → 2021.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/themes/j1/layouts/layout_metadata_generator.html +4 -4
- data/_includes/themes/j1/modules/connectors/ads +18 -7
- data/_includes/themes/j1/modules/connectors/analytic/google-analytics.html +6 -6
- data/_includes/themes/j1/modules/connectors/analytics +17 -3
- data/_includes/themes/j1/modules/connectors/comments +22 -8
- data/_includes/themes/j1/modules/connectors/translator +20 -6
- data/_includes/themes/j1/procedures/global/select_location.proc +3 -3
- data/assets/error_pages/HTTP204.html +33 -10
- data/assets/error_pages/HTTP400.html +32 -8
- data/assets/error_pages/HTTP401.html +32 -9
- data/assets/error_pages/HTTP403.html +32 -8
- data/assets/error_pages/HTTP404.html +32 -8
- data/assets/error_pages/HTTP500.html +32 -8
- data/assets/error_pages/HTTP501.html +32 -8
- data/assets/error_pages/HTTP502.html +32 -8
- data/assets/error_pages/HTTP503.html +33 -8
- data/assets/themes/j1/adapter/js/cookieConsent.js +78 -57
- data/assets/themes/j1/adapter/js/fam.js +2 -1
- data/assets/themes/j1/adapter/js/j1.js +135 -51
- data/assets/themes/j1/adapter/js/navigator.js +5 -2
- data/assets/themes/j1/adapter/js/themer.js +137 -92
- data/assets/themes/j1/core/js/template.js +24 -4
- data/assets/themes/j1/core/js/template.js.map +1 -1
- data/assets/themes/j1/core/js/template.min.js +24 -4
- data/assets/themes/j1/core/js/template.min.js.map +1 -1
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +22 -7
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +2 -3
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +1 -2
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +18 -10
- data/lib/starter_web/_data/_defaults/private.default.yml +119 -0
- data/lib/starter_web/_data/j1_config.yml +1 -1
- data/lib/starter_web/_data/modules/cookieconsent.yml +1 -0
- data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +10 -9
- data/lib/starter_web/_data/resources.yml +0 -4
- data/lib/starter_web/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/dot.gitignore +1 -1
- data/lib/starter_web/index.html +3 -3
- data/lib/starter_web/package.json +2 -2
- data/lib/starter_web/pages/public/blog/navigator/archive.html +2 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +3 -2
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +20 -3
- data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +9 -6
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +3 -65
- data/assets/error_pages/HTTP520.html +0 -68
- data/assets/error_pages/HTTP521.html +0 -68
- data/assets/error_pages/HTTP533.html +0 -68
- data/assets/themes/j1/adapter/js/navigator.1.js +0 -896
- data/assets/themes/j1/adapter/js/navigator.2.js +0 -928
- data/assets/themes/j1/adapter/js/themer.1.js +0 -326
- data/assets/themes/j1/modules/_lightGallery/css/core/lg-fb-comment-box.css +0 -58
- data/assets/themes/j1/modules/_lightGallery/css/core/lg-fb-comment-box.min.css +0 -5
- data/assets/themes/j1/modules/_lightGallery/css/core/lg-transitions.css +0 -778
- data/assets/themes/j1/modules/_lightGallery/css/core/lg-transitions.min.css +0 -5
- data/assets/themes/j1/modules/_lightGallery/css/core/lightgallery.css +0 -981
- data/assets/themes/j1/modules/_lightGallery/css/core/lightgallery.min.css +0 -5
- data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.eot +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.svg +0 -47
- data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.ttf +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.woff +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/img/loading.gif +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/img/video-play.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/img/vimeo-play.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/img/youtube-play.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/animation-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/customize-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/dynamic-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/facebook-icon.svg +0 -10
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/googleplus-icon.svg +0 -30
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/html5-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/linked-in.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/module-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/play-button.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/responsive-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/thumb-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/touch-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/twitter-icon.svg +0 -15
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/twitter.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/video1-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/zoom-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/zoom.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/uno.css +0 -262
- data/assets/themes/j1/modules/_lightGallery/css/themes/uno.min.css +0 -15
- data/assets/themes/j1/modules/_lightGallery/js/core/lightgallery.js +0 -1362
- data/assets/themes/j1/modules/_lightGallery/js/core/lightgallery.min.js +0 -4
- data/assets/themes/j1/modules/_lightGallery/js/modules/j1/j1-video.js +0 -402
- data/assets/themes/j1/modules/_lightGallery/js/modules/j1/j1-video.min.js +0 -8
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-autoplay.js +0 -206
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-autoplay.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-fullscreen.js +0 -126
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-fullscreen.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-hash.js +0 -101
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-hash.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-pager.js +0 -105
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-pager.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-share.js +0 -107
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-share.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-thumbnail.js +0 -478
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-thumbnail.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-video.js +0 -342
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-video.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-zoom.js +0 -527
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-zoom.min.js +0 -5
- data/assets/themes/j1/modules/util/js/js.cookie.js +0 -163
- data/assets/themes/j1/modules/util/js/lite-url.js +0 -203
- data/assets/themes/j1/modules/util/js/lite-url.min.js +0 -7
- data/assets/themes/j1/modules/util/js/platform.js +0 -1260
@@ -28,14 +28,16 @@ regenerate: true
|
|
28
28
|
{% comment %} Set config files
|
29
29
|
-------------------------------------------------------------------------------- {% endcomment %}
|
30
30
|
{% assign environment = site.environment %}
|
31
|
+
{% assign blocks = site.data.blocks %}
|
31
32
|
{% assign modules = site.data.modules %}
|
33
|
+
{% assign template_config = site.data.j1_config %}
|
32
34
|
|
33
35
|
{% comment %} Set config data
|
34
36
|
-------------------------------------------------------------------------------- {% endcomment %}
|
35
37
|
{% assign consent_defaults = modules.defaults.cookieconsent.defaults %}
|
36
38
|
{% assign consent_settings = modules.cookieconsent.settings %}
|
37
|
-
{% assign tracking_enabled =
|
38
|
-
{% assign tracking_id =
|
39
|
+
{% assign tracking_enabled = template_config.analytics.enabled %}
|
40
|
+
{% assign tracking_id = template_config.analytics.google.tracking_id %}
|
39
41
|
|
40
42
|
{% comment %} Set config options
|
41
43
|
-------------------------------------------------------------------------------- {% endcomment %}
|
@@ -89,6 +91,7 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
89
91
|
var user_cookie;
|
90
92
|
var logger;
|
91
93
|
var logText;
|
94
|
+
var cookie_written;
|
92
95
|
|
93
96
|
// NOTE: RegEx for tracking_id: ^(G|UA|YT|MO)-[a-zA-Z0-9-]+$
|
94
97
|
// See: https://stackoverflow.com/questions/20411767/how-to-validate-google-analytics-tracking-id-using-a-javascript-function/20412153
|
@@ -138,31 +141,28 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
138
141
|
// -----------------------------------------------------------------------
|
139
142
|
// initializer
|
140
143
|
// -----------------------------------------------------------------------
|
141
|
-
_this.setState('started');
|
142
|
-
logger.info('state: ' + _this.getState());
|
143
|
-
logger.info('module is being initialized');
|
144
|
-
|
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
|
-
}
|
155
|
-
});
|
156
|
-
|
157
144
|
var dependencies_met_page_ready = setInterval (function (options) {
|
158
|
-
if ( j1.
|
145
|
+
if ( j1.getState() === 'finished' ) {
|
146
|
+
_this.setState('started');
|
147
|
+
logger.info('state: ' + _this.getState());
|
148
|
+
logger.info('module is being initialized');
|
149
|
+
|
150
|
+
j1.cookieConsent = new BootstrapCookieConsent({
|
151
|
+
contentURL: moduleOptions.contentURL,
|
152
|
+
cookieName: moduleOptions.cookieName,
|
153
|
+
language: moduleOptions.language,
|
154
|
+
whitelisted: moduleOptions.whitelisted,
|
155
|
+
reloadPageOnChange: moduleOptions.reloadPageOnChange,
|
156
|
+
xhr_data_element: moduleOptions.xhr_data_element + '-' + moduleOptions.language,
|
157
|
+
postSelectionCallback: function () {j1.adapter.cookieConsent.cbCookie()}
|
158
|
+
});
|
159
|
+
|
159
160
|
_this.setState('finished');
|
160
161
|
logger.info('state: ' + _this.getState());
|
161
162
|
logger.debug('module initialized successfully');
|
162
163
|
clearInterval(dependencies_met_page_ready);
|
163
164
|
}
|
164
165
|
});
|
165
|
-
|
166
166
|
}, // END init
|
167
167
|
|
168
168
|
// -------------------------------------------------------------------------
|
@@ -214,23 +214,42 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
214
214
|
// made his selection (callback)
|
215
215
|
// -------------------------------------------------------------------------
|
216
216
|
cbCookie: function () {
|
217
|
-
var gaCookies
|
218
|
-
var
|
219
|
-
var
|
220
|
-
var
|
217
|
+
var gaCookies = j1.findCookie('_ga');
|
218
|
+
var j1Cookies = j1.findCookie('j1');
|
219
|
+
var cookie_names = j1.getCookieNames();
|
220
|
+
var user_state = j1.readCookie(cookie_names.user_state);
|
221
|
+
var user_consent = j1.readCookie(cookie_names.user_consent);
|
222
|
+
var json = JSON.stringify(user_consent);
|
223
|
+
var user_agent = platform.ua;
|
221
224
|
|
222
225
|
logger.info('Entered post selection callback from CookieConsent');
|
223
226
|
logger.info('Current values from CookieConsent: ' + json);
|
224
227
|
|
228
|
+
// enable cookie button if not visible
|
229
|
+
if ($('#quickLinksCookieButton').css('display') === 'none') {
|
230
|
+
$('#quickLinksCookieButton').css('display', 'block');
|
231
|
+
}
|
232
|
+
|
233
|
+
// jadams, 2021-07-11: moved to j1 adapter (displayPage)
|
225
234
|
// NOTE: Warning needs to be moved to another module
|
226
235
|
// because page is reloaded after selection
|
227
236
|
//
|
228
|
-
if (tracking_enabled && !tracking_id_valid) {
|
229
|
-
|
237
|
+
// if (tracking_enabled && !tracking_id_valid) {
|
238
|
+
// logger.error('tracking enabled, but invalid tracking id found: ' + tracking_id);
|
239
|
+
// } else {
|
240
|
+
// logger.warn('tracking enabled, tracking id found: ' + tracking_id);
|
241
|
+
// }
|
242
|
+
|
243
|
+
// for development only
|
244
|
+
if (environment === 'development') {
|
245
|
+
gaCookies.forEach(item => console.log('cookieConsent: ' + item));
|
246
|
+
j1Cookies.forEach(item => console.log('cookieConsent: ' + item));
|
230
247
|
}
|
231
248
|
|
232
|
-
|
233
|
-
|
249
|
+
if (user_agent.includes('iPad')) {
|
250
|
+
logger.warn('Product detected : ' + platform.product);
|
251
|
+
logger.warn('Skip deleting (unwanted) cookies for this platform');
|
252
|
+
}
|
234
253
|
|
235
254
|
// Manage Google Analytics OptIn/Out
|
236
255
|
// See: https://github.com/luciomartinez/gtag-opt-in/wiki
|
@@ -242,39 +261,41 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
242
261
|
} else {
|
243
262
|
logger.warn('Disable: GA');
|
244
263
|
GTagOptIn.optOut();
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
name: item,
|
250
|
-
path: '/'
|
264
|
+
|
265
|
+
if (!user_agent.includes('iPad')) {
|
266
|
+
gaCookies.forEach(function (item) {
|
267
|
+
logger.warn('Delete GA cookie: ' + item);
|
268
|
+
j1.removeCookie({name: item, path: '/'});
|
251
269
|
});
|
252
|
-
}
|
270
|
+
}
|
253
271
|
}
|
254
|
-
}
|
255
272
|
|
273
|
+
if (!user_consent.analyses || !user_consent.personalization) {
|
274
|
+
// expire consent|state cookies to session
|
275
|
+
cookie_written = j1.writeCookie({
|
276
|
+
name: cookie_names.user_state,
|
277
|
+
data: user_state,
|
278
|
+
samesite: 'Strict'
|
279
|
+
});
|
280
|
+
if (!cookie_written) {
|
281
|
+
logger.error('failed to write cookie: ' + cookie_names.user_state);
|
282
|
+
}
|
283
|
+
|
284
|
+
cookie_written = j1.writeCookie({
|
285
|
+
name: cookie_names.user_consent,
|
286
|
+
data: user_consent,
|
287
|
+
samesite: 'Strict'
|
288
|
+
});
|
289
|
+
if (!cookie_written) {
|
290
|
+
logger.error('failed to write cookie: ' + cookie_names.user_consent);
|
291
|
+
}
|
292
|
+
}
|
256
293
|
|
257
|
-
|
258
|
-
|
259
|
-
|
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();
|
294
|
+
if (moduleOptions.reloadPageOnChange) {
|
295
|
+
// reload current page (skip cache)
|
296
|
+
location.reload(true);
|
297
|
+
}
|
298
|
+
} // END if tracking_enabled
|
278
299
|
|
279
300
|
} // END cbCookie
|
280
301
|
|
@@ -393,7 +393,8 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
393
393
|
// reload page
|
394
394
|
// -------------------------------------------------------------------------
|
395
395
|
reload_page: function () {
|
396
|
-
|
396
|
+
// reload current page (skip cache)
|
397
|
+
location.reload(true);
|
397
398
|
}, // END reload_page
|
398
399
|
|
399
400
|
// -------------------------------------------------------------------------
|
@@ -41,9 +41,9 @@ regenerate: true
|
|
41
41
|
|
42
42
|
{% comment %} Set config files
|
43
43
|
-------------------------------------------------------------------------------- {% endcomment %}
|
44
|
-
{% assign template_config = site.data.j1_config %}
|
45
44
|
{% assign blocks = site.data.blocks %}
|
46
45
|
{% assign modules = site.data.modules %}
|
46
|
+
{% assign template_config = site.data.j1_config %}
|
47
47
|
|
48
48
|
{% comment %} Set config data
|
49
49
|
-------------------------------------------------------------------------------- {% endcomment %}
|
@@ -56,6 +56,8 @@ regenerate: true
|
|
56
56
|
{% assign toccer_settings = modules.toccer.settings %}
|
57
57
|
{% assign themer_defaults = modules.defaults.themer.defaults %}
|
58
58
|
{% assign themer_settings = modules.themer.settings %}
|
59
|
+
{% assign tracking_enabled = template_config.analytics.enabled %}
|
60
|
+
{% assign tracking_id = template_config.analytics.google.tracking_id %}
|
59
61
|
|
60
62
|
{% assign authentication_defaults = modules.defaults.authentication.defaults %}
|
61
63
|
{% assign authentication_settings = modules.authentication.settings %}
|
@@ -122,6 +124,11 @@ var j1 = (function () {
|
|
122
124
|
var state = 'not_started';
|
123
125
|
var mode = 'not_detected';
|
124
126
|
|
127
|
+
// Tracking information (GA)
|
128
|
+
var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
|
129
|
+
var tracking_id = '{{tracking_id}}';
|
130
|
+
var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
|
131
|
+
|
125
132
|
var current_user_data;
|
126
133
|
var current_page;
|
127
134
|
var previous_page;
|
@@ -129,6 +136,7 @@ var j1 = (function () {
|
|
129
136
|
var last_pager_url;
|
130
137
|
var app_detected;
|
131
138
|
var user_session_detected;
|
139
|
+
var cookie_written;
|
132
140
|
|
133
141
|
// Translatior settings (currently NOT supported)
|
134
142
|
// var translation_enabled = {{template_config.translation.enabled}};
|
@@ -157,17 +165,16 @@ var j1 = (function () {
|
|
157
165
|
var baseUrl;
|
158
166
|
var referrer;
|
159
167
|
|
168
|
+
// initial cookie values
|
160
169
|
var cookie_names = {
|
161
170
|
'app_session': '{{template_config.cookies.app_session}}',
|
162
171
|
'user_session': '{{template_config.cookies.user_session}}',
|
163
172
|
'user_state': '{{template_config.cookies.user_state}}',
|
164
173
|
'user_consent': '{{template_config.cookies.user_consent}}'
|
165
174
|
};
|
166
|
-
|
167
|
-
// user SESSION cookie (initial values)
|
168
175
|
var user_session = {
|
169
176
|
'mode': 'web',
|
170
|
-
'writer': '
|
177
|
+
'writer': 'j1.adapter',
|
171
178
|
'locale': navigator.language || navigator.userLanguage,
|
172
179
|
'user_name': '{{template_config.user.user_name}}',
|
173
180
|
'provider': '{{template_config.user.provider}}',
|
@@ -182,17 +189,17 @@ var j1 = (function () {
|
|
182
189
|
'previous_page': 'na',
|
183
190
|
'last_pager': '/pages/public/blog/navigator/'
|
184
191
|
};
|
185
|
-
|
186
192
|
var user_state = {
|
193
|
+
'writer': 'j1.adapter',
|
194
|
+
'theme_css': '',
|
187
195
|
'theme_css': '',
|
188
196
|
'theme_name': '',
|
189
197
|
'theme_author': '',
|
190
|
-
'theme_version': '{{
|
198
|
+
'theme_version': '{{template_version}}',
|
191
199
|
'session_active': false,
|
192
200
|
'last_session_ts': ''
|
193
201
|
};
|
194
|
-
|
195
|
-
var user_consent;
|
202
|
+
var user_consent = {};
|
196
203
|
|
197
204
|
// ---------------------------------------------------------------------------
|
198
205
|
// helper functions
|
@@ -223,12 +230,12 @@ var j1 = (function () {
|
|
223
230
|
// -----------------------------------------------------------------------
|
224
231
|
// global var (function)
|
225
232
|
// -----------------------------------------------------------------------
|
226
|
-
var logger
|
227
|
-
var url
|
228
|
-
var baseUrl
|
229
|
-
var date
|
230
|
-
var timestamp_now
|
231
|
-
var curr_state
|
233
|
+
var logger = log4javascript.getLogger('j1.init');
|
234
|
+
var url = new liteURL(window.location.href);
|
235
|
+
var baseUrl = url.origin;
|
236
|
+
var date = new Date();
|
237
|
+
var timestamp_now = date.toISOString();
|
238
|
+
var curr_state = 'started';
|
232
239
|
|
233
240
|
// -----------------------------------------------------------------------
|
234
241
|
// options loader
|
@@ -262,30 +269,44 @@ var j1 = (function () {
|
|
262
269
|
var url;
|
263
270
|
var baseUrl;
|
264
271
|
|
265
|
-
user_state
|
266
|
-
|
272
|
+
if (user_state) {
|
273
|
+
user_state.session_active = false;
|
274
|
+
user_state.last_session_ts = timestamp_now;
|
267
275
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
276
|
+
if (!user_consent.analyses || !user_consent.personalization) {
|
277
|
+
// expire consent|state cookies to session
|
278
|
+
cookie_written = j1.writeCookie({
|
279
|
+
name: cookie_names.user_consent,
|
280
|
+
data: user_state,
|
281
|
+
samesite: 'Strict'
|
282
|
+
});
|
283
|
+
if (!cookie_written) {
|
284
|
+
logger.error('failed to write cookie: ' + cookie_names.user_consent);
|
285
|
+
}
|
286
|
+
cookie_written = j1.writeCookie({
|
287
|
+
name: cookie_names.user_state,
|
288
|
+
data: user_state,
|
289
|
+
samesite: 'Strict'
|
290
|
+
});
|
291
|
+
if (!cookie_written) {
|
292
|
+
logger.error('failed to write cookie: ' + cookie_names.user_consent);
|
293
|
+
}
|
294
|
+
} else {
|
295
|
+
cookie_written = j1.writeCookie({
|
296
|
+
name: cookie_names.user_state,
|
297
|
+
data: user_state,
|
298
|
+
samesite: 'Strict',
|
299
|
+
expires: 365
|
300
|
+
});
|
301
|
+
if (!cookie_written) {
|
302
|
+
logger.error('failed to write cookie: ' + cookie_names.user_state);
|
303
|
+
}
|
304
|
+
}
|
280
305
|
} else {
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
samesite: 'Strict',
|
285
|
-
expires: 365
|
286
|
-
});
|
306
|
+
// jadams, 2021-07-11: on beforeunload, a vaild state cookie
|
307
|
+
// is expected
|
308
|
+
logger.fatal('missing cookie detected for: ' + cookie_names.user_state);
|
287
309
|
}
|
288
|
-
|
289
310
|
}); // END beforeunload
|
290
311
|
|
291
312
|
// -----------------------------------------------------------------------
|
@@ -297,37 +318,57 @@ var j1 = (function () {
|
|
297
318
|
user_consent = j1.readCookie(cookie_names.user_consent);
|
298
319
|
user_session = j1.existsCookie(cookie_names.user_session)
|
299
320
|
? j1.readCookie(cookie_names.user_session)
|
300
|
-
: j1.writeCookie({
|
321
|
+
: cookie_written = j1.writeCookie({
|
301
322
|
name: cookie_names.user_session,
|
302
323
|
data: user_session,
|
303
324
|
samesite: 'Strict'
|
304
325
|
});
|
326
|
+
if (!cookie_written) {
|
327
|
+
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
328
|
+
}
|
305
329
|
|
306
330
|
user_state = j1.existsCookie(cookie_names.user_state)
|
307
331
|
? j1.readCookie(cookie_names.user_state)
|
308
|
-
: j1.writeCookie({
|
332
|
+
: cookie_written = j1.writeCookie({
|
309
333
|
name: cookie_names.user_state,
|
310
334
|
data: user_state,
|
311
335
|
samesite: 'Strict',
|
312
336
|
expires: 365
|
313
337
|
});
|
338
|
+
if (!cookie_written) {
|
339
|
+
logger.error('failed to write cookie: ' + cookie_names.user_state);
|
340
|
+
}
|
314
341
|
|
315
|
-
user_state
|
342
|
+
// jadams, 2021-07-11: Found situation that user_state NOT initialized
|
343
|
+
// correctly (user_state == false).
|
344
|
+
// TODO: Check if/why user state (cookie NOT created?) NOT initialized
|
345
|
+
// for what reason.
|
346
|
+
if (!user_state) {
|
347
|
+
logger.warn('cookie not found: ' + cookie_names.user_state);
|
348
|
+
user_state = j1.readCookie(cookie_names.user_state);
|
349
|
+
user_state.session_active = true;
|
350
|
+
}
|
316
351
|
|
317
352
|
if (!user_consent.analyses || !user_consent.personalization) {
|
318
353
|
// expire consent|state cookies to session
|
319
|
-
j1.writeCookie({
|
354
|
+
cookie_written = j1.writeCookie({
|
320
355
|
name: cookie_names.user_state,
|
321
356
|
data: user_state,
|
322
357
|
samesite: 'Strict'
|
323
358
|
});
|
359
|
+
if (!cookie_written) {
|
360
|
+
logger.error('failed to write cookie: ' + cookie_names.user_state);
|
361
|
+
}
|
324
362
|
} else {
|
325
|
-
j1.writeCookie({
|
363
|
+
cookie_written = j1.writeCookie({
|
326
364
|
name: cookie_names.user_state,
|
327
365
|
data: user_state,
|
328
366
|
samesite: 'Strict',
|
329
367
|
expires: 365
|
330
368
|
});
|
369
|
+
if (!cookie_written) {
|
370
|
+
logger.error('failed to write cookie: ' + cookie_names.user_state);
|
371
|
+
}
|
331
372
|
}
|
332
373
|
|
333
374
|
// detect middleware (mode 'app') and update user session cookie
|
@@ -354,11 +395,16 @@ var j1 = (function () {
|
|
354
395
|
|
355
396
|
logger.info(logText);
|
356
397
|
logger.info('update user session cookie');
|
357
|
-
j1.writeCookie({
|
398
|
+
cookie_written = j1.writeCookie({
|
358
399
|
name: cookie_names.user_session,
|
359
400
|
data: user_session,
|
360
401
|
samesite: 'Strict'
|
361
402
|
});
|
403
|
+
|
404
|
+
if (!cookie_written) {
|
405
|
+
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
406
|
+
}
|
407
|
+
|
362
408
|
j1.setState(curr_state);
|
363
409
|
logger.info('state: ' + j1.getState());
|
364
410
|
|
@@ -395,16 +441,20 @@ var j1 = (function () {
|
|
395
441
|
logText = 'mode detected: ' + user_session.mode;
|
396
442
|
|
397
443
|
logger.info(logText);
|
398
|
-
j1.writeCookie({
|
444
|
+
cookie_written = j1.writeCookie({
|
399
445
|
name: cookie_names.user_session,
|
400
446
|
data: user_session,
|
401
447
|
samesite: 'Strict'
|
402
448
|
});
|
449
|
+
if (!cookie_written) {
|
450
|
+
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
451
|
+
}
|
452
|
+
|
403
453
|
j1.setState(curr_state);
|
404
454
|
logger.info('state: ' + j1.getState());
|
405
455
|
}, detectTimeout);
|
406
456
|
});
|
407
|
-
} else { //
|
457
|
+
} else { // web mode
|
408
458
|
state = 'started';
|
409
459
|
logger.info('state: ' + state);
|
410
460
|
logger.info('page is being initialized');
|
@@ -450,12 +500,16 @@ var j1 = (function () {
|
|
450
500
|
}
|
451
501
|
|
452
502
|
logger.info('update user session cookie');
|
453
|
-
j1.writeCookie({
|
503
|
+
cookie_written = j1.writeCookie({
|
454
504
|
name: cookie_names.user_session,
|
455
505
|
data: user_session,
|
456
506
|
samesite: 'Strict'
|
457
507
|
});
|
458
508
|
|
509
|
+
if (!cookie_written) {
|
510
|
+
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
511
|
+
}
|
512
|
+
|
459
513
|
// NOTE: asynchronous calls should be rewitten to xhrData
|
460
514
|
// initialize page resources for blocks
|
461
515
|
j1.initBanner(settings);
|
@@ -467,11 +521,14 @@ var j1 = (function () {
|
|
467
521
|
logger.info(logText);
|
468
522
|
|
469
523
|
user_session.timestamp = timestamp_now;
|
470
|
-
j1.writeCookie({
|
524
|
+
cookie_written = j1.writeCookie({
|
471
525
|
name: cookie_names.user_session,
|
472
526
|
data: user_session,
|
473
527
|
samesite: 'Strict'
|
474
528
|
});
|
529
|
+
if (!cookie_written) {
|
530
|
+
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
531
|
+
}
|
475
532
|
|
476
533
|
// -----------------------------------------------------------------------
|
477
534
|
// additional BS helpers from j1.core
|
@@ -788,11 +845,14 @@ var j1 = (function () {
|
|
788
845
|
user_session = j1.mergeData(user_session, data);
|
789
846
|
|
790
847
|
user_session.current_page = current_url.pathname;
|
791
|
-
j1.writeCookie({
|
848
|
+
cookie_written = j1.writeCookie({
|
792
849
|
name: cookie_names.user_session,
|
793
850
|
data: user_session,
|
794
851
|
samesite: 'Strict'
|
795
852
|
});
|
853
|
+
if (!cookie_written) {
|
854
|
+
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
855
|
+
}
|
796
856
|
|
797
857
|
providerPermissions = user_session.provider_permissions;
|
798
858
|
categoryAllowed = providerPermissions.includes(user_session.page_permission);
|
@@ -821,6 +881,15 @@ var j1 = (function () {
|
|
821
881
|
// display page
|
822
882
|
$('#no_flicker').css('display', 'block');
|
823
883
|
|
884
|
+
// NOTE: Placed tracking warning/info here because page may reloaded
|
885
|
+
// after cookie consent selection
|
886
|
+
//
|
887
|
+
if (tracking_enabled && !tracking_id_valid) {
|
888
|
+
logger.error('tracking enabled, but invalid tracking id found: ' + tracking_id);
|
889
|
+
} else {
|
890
|
+
logger.warn('tracking enabled, tracking id found: ' + tracking_id);
|
891
|
+
}
|
892
|
+
|
824
893
|
// show|hide cookie icon (should MOVED to Cookiebar ???)
|
825
894
|
if (j1.existsCookie(cookie_names.user_consent)) {
|
826
895
|
// Display cookie icon
|
@@ -898,16 +967,28 @@ var j1 = (function () {
|
|
898
967
|
// display page
|
899
968
|
$('#no_flicker').css('display', 'block');
|
900
969
|
|
970
|
+
// NOTE: Placed tracking warning/info here because page may reloaded
|
971
|
+
// after cookie consent selection
|
972
|
+
//
|
973
|
+
if (tracking_enabled && !tracking_id_valid) {
|
974
|
+
logger.error('tracking enabled, but invalid tracking id found: ' + tracking_id);
|
975
|
+
} else {
|
976
|
+
logger.warn('tracking enabled, tracking id found: ' + tracking_id);
|
977
|
+
}
|
978
|
+
|
901
979
|
logger.info('mode detected: web');
|
902
980
|
logger.info('hide signin icon');
|
903
981
|
$('#quickLinksSignInOutButton').css('display', 'none');
|
904
982
|
|
905
983
|
user_session.current_page = current_url.pathname;
|
906
|
-
j1.writeCookie({
|
984
|
+
cookie_written = j1.writeCookie({
|
907
985
|
name: cookie_names.user_session,
|
908
986
|
data: user_session,
|
909
987
|
samesite: 'Strict'
|
910
988
|
});
|
989
|
+
if (!cookie_written) {
|
990
|
+
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
991
|
+
}
|
911
992
|
|
912
993
|
// show|hide translator icon (currently NOT supported)
|
913
994
|
// if (translation_enabled) {
|
@@ -1232,14 +1313,17 @@ var j1 = (function () {
|
|
1232
1313
|
|
1233
1314
|
// -------------------------------------------------------------------------
|
1234
1315
|
// findCookie()
|
1235
|
-
// Search for cookies (names) in the page header that matches
|
1236
|
-
//
|
1316
|
+
// Search for cookies (names) in the page header that matches a given
|
1317
|
+
// name. Cookie name can be give as full name, like 'j1.user.state', or
|
1318
|
+
// as partials like 'j1'
|
1319
|
+
// Returns all names found as an array.
|
1237
1320
|
// -------------------------------------------------------------------------
|
1238
1321
|
// See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
|
1239
1322
|
// -------------------------------------------------------------------------
|
1240
|
-
findCookie: function (
|
1323
|
+
findCookie: function (name) {
|
1241
1324
|
var r=[];
|
1242
|
-
|
1325
|
+
|
1326
|
+
document.cookie.replace(new RegExp(name + '[^= ]*', 'g'), function(a){ r.push(a.trim()); });
|
1243
1327
|
return r;
|
1244
1328
|
}, // END findCookie
|
1245
1329
|
|