j1-template 2021.1.9 → 2021.1.13
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/content_generator_app.html +1 -1
- data/_includes/themes/j1/layouts/content_generator_blog_archive.html +1 -1
- data/_includes/themes/j1/layouts/content_generator_collection.html +1 -1
- data/_includes/themes/j1/layouts/content_generator_page.html +4 -1
- data/_includes/themes/j1/layouts/content_generator_post.html +1 -1
- data/_includes/themes/j1/layouts/content_generator_raw.html +1 -1
- data/_includes/themes/j1/layouts/layout_metadata_generator.html +55 -0
- data/_includes/themes/j1/modules/connectors/comment/commento.html +31 -0
- data/_includes/themes/j1/modules/connectors/comment/custom-provider.html +7 -8
- data/_includes/themes/j1/modules/connectors/comment/disqus.html +12 -54
- data/_includes/themes/j1/modules/connectors/comment/facebook.html +7 -8
- data/_includes/themes/j1/modules/connectors/comment/hyvor.html +33 -0
- data/_includes/themes/j1/modules/connectors/comment/just-comments.html +31 -0
- data/_includes/themes/j1/modules/connectors/comments +3 -0
- data/_layouts/default.html +51 -0
- data/assets/data/disqus.js +81 -0
- data/assets/data/hyvor.js +72 -0
- data/assets/error_pages/HTTP204.html +5 -1
- data/assets/error_pages/HTTP400.html +4 -0
- data/assets/error_pages/HTTP401.html +4 -0
- data/assets/error_pages/HTTP403.html +4 -0
- data/assets/error_pages/HTTP404.html +4 -0
- data/assets/error_pages/HTTP444.html +93 -0
- data/assets/error_pages/HTTP500.html +4 -0
- data/assets/error_pages/HTTP501.html +4 -0
- data/assets/error_pages/HTTP502.html +4 -0
- data/assets/error_pages/HTTP503.html +4 -0
- data/assets/themes/j1/adapter/js/algolia.js +10 -10
- data/assets/themes/j1/adapter/js/asciidoctor.js +6 -6
- data/assets/themes/j1/adapter/js/attic.js +17 -17
- data/assets/themes/j1/adapter/js/bmd.js +6 -6
- data/assets/themes/j1/adapter/js/carousel.js +10 -10
- data/assets/themes/j1/adapter/js/clipboard.js +10 -10
- data/assets/themes/j1/adapter/js/cookieConsent.js +68 -41
- data/assets/themes/j1/adapter/js/fam.js +34 -34
- data/assets/themes/j1/adapter/js/framer.js +6 -6
- data/assets/themes/j1/adapter/js/j1.js +531 -231
- data/assets/themes/j1/adapter/js/justifiedGallery.js +11 -11
- data/assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js +19 -19
- data/assets/themes/j1/adapter/js/lightbox.js +6 -6
- data/assets/themes/j1/adapter/js/logger.js +7 -7
- data/assets/themes/j1/adapter/js/mmenu.js +25 -25
- data/assets/themes/j1/adapter/js/navigator.js +52 -49
- data/assets/themes/j1/adapter/js/quicksearch.js +6 -6
- data/assets/themes/j1/adapter/js/rouge.js +7 -7
- data/assets/themes/j1/adapter/js/rtable.js +6 -6
- data/assets/themes/j1/adapter/js/themer.js +145 -94
- data/assets/themes/j1/adapter/js/toccer.js +9 -9
- 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/backstretch/js/backstretch.js +3 -3
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +35 -23
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +35 -23
- data/assets/themes/j1/modules/lunrSearch/js/quicksearch.js +1 -1
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +19 -19
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +42 -24
- data/lib/starter_web/_data/_defaults/private.default.yml +119 -0
- data/lib/starter_web/_data/j1_config.yml +22 -11
- data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +2 -1
- 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 +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/book.adoc +3 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +3 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +3 -0
- data/lib/starter_web/pages/public/blog/navigator/archive.html +4 -0
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +4 -0
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +4 -0
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +5 -1
- data/lib/starter_web/pages/public/blog/navigator/index.html +4 -0
- data/lib/starter_web/pages/public/cookieConsent.adoc +3 -0
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +0 -1
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +2 -1
- data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +0 -2
- data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +0 -2
- data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +0 -1
- data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +0 -1
- data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +0 -1
- data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +0 -1
- data/lib/starter_web/pages/public/learn/roundtrip/600_quicksearch.adoc +0 -1
- data/lib/starter_web/pages/public/learn/where_to_go.adoc +0 -1
- data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +3 -1
- data/lib/starter_web/pages/public/legal/en/200_impress.adoc +3 -1
- data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +78 -17
- data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +3 -1
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +9 -8
- data/assets/themes/j1/adapter/js/themer.1.js +0 -326
- 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
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.org.asciidoc +0 -244
@@ -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 %}
|
@@ -73,6 +75,23 @@ regenerate: true
|
|
73
75
|
{% assign panel_data_path = panel_config_defaults.data_path %}
|
74
76
|
|
75
77
|
{% assign hideOnReload = modules.themer_options.hideOnReload %}
|
78
|
+
{% assign comment_provider = template_config.comments.provider %}
|
79
|
+
|
80
|
+
{% comment %} Set variables
|
81
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
82
|
+
{% if comment_provider == 'disqus' %}
|
83
|
+
{% assign site_id = template_config.comments.disqus.site_id %}
|
84
|
+
{% elsif comment_provider == 'hyvor' %}
|
85
|
+
{% assign site_id = template_config.comments.hyvor.site_id %}
|
86
|
+
{% elsif comment_provider == 'commento' %}
|
87
|
+
{% assign site_id = template_config.comments.commento.site_id %}
|
88
|
+
{% elsif comment_provider == 'just-comments' %}
|
89
|
+
{% assign site_id = template_config.comments.just-comments.site_id %}
|
90
|
+
{% elsif comment_provider == 'facebook' %}
|
91
|
+
{% assign site_id = template_config.comments.facebook.site_id %}
|
92
|
+
{% else %}
|
93
|
+
{% assign site_id = false %}
|
94
|
+
{% endif %}
|
76
95
|
|
77
96
|
{% assign production = false %}
|
78
97
|
{% if environment == 'prod' or environment == 'production' %}
|
@@ -122,6 +141,18 @@ var j1 = (function () {
|
|
122
141
|
var state = 'not_started';
|
123
142
|
var mode = 'not_detected';
|
124
143
|
|
144
|
+
// Default tracking provider information
|
145
|
+
var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
|
146
|
+
var tracking_id = '{{tracking_id}}';
|
147
|
+
var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
|
148
|
+
|
149
|
+
// Default comment provider information
|
150
|
+
var comment_provider = '{{comment_provider}}';
|
151
|
+
var site_id = '{{site_id}}';
|
152
|
+
|
153
|
+
// Default translator settings (currently NOT supported)
|
154
|
+
// var translation_enabled = {{template_config.translation.enabled}};
|
155
|
+
|
125
156
|
var current_user_data;
|
126
157
|
var current_page;
|
127
158
|
var previous_page;
|
@@ -129,9 +160,7 @@ var j1 = (function () {
|
|
129
160
|
var last_pager_url;
|
130
161
|
var app_detected;
|
131
162
|
var user_session_detected;
|
132
|
-
|
133
|
-
// Translatior settings (currently NOT supported)
|
134
|
-
// var translation_enabled = {{template_config.translation.enabled}};
|
163
|
+
var cookie_written;
|
135
164
|
|
136
165
|
// Theme information
|
137
166
|
var themeName;
|
@@ -157,17 +186,16 @@ var j1 = (function () {
|
|
157
186
|
var baseUrl;
|
158
187
|
var referrer;
|
159
188
|
|
189
|
+
// initial cookie settings
|
160
190
|
var cookie_names = {
|
161
191
|
'app_session': '{{template_config.cookies.app_session}}',
|
162
192
|
'user_session': '{{template_config.cookies.user_session}}',
|
163
193
|
'user_state': '{{template_config.cookies.user_state}}',
|
164
194
|
'user_consent': '{{template_config.cookies.user_consent}}'
|
165
195
|
};
|
166
|
-
|
167
|
-
// user SESSION cookie (initial values)
|
168
196
|
var user_session = {
|
169
197
|
'mode': 'web',
|
170
|
-
'writer': '
|
198
|
+
'writer': 'j1.adapter',
|
171
199
|
'locale': navigator.language || navigator.userLanguage,
|
172
200
|
'user_name': '{{template_config.user.user_name}}',
|
173
201
|
'provider': '{{template_config.user.provider}}',
|
@@ -182,17 +210,17 @@ var j1 = (function () {
|
|
182
210
|
'previous_page': 'na',
|
183
211
|
'last_pager': '/pages/public/blog/navigator/'
|
184
212
|
};
|
185
|
-
|
186
213
|
var user_state = {
|
214
|
+
'writer': 'j1.adapter',
|
215
|
+
'theme_css': '',
|
187
216
|
'theme_css': '',
|
188
217
|
'theme_name': '',
|
189
218
|
'theme_author': '',
|
190
|
-
'theme_version': '{{
|
219
|
+
'theme_version': '{{template_version}}',
|
191
220
|
'session_active': false,
|
192
221
|
'last_session_ts': ''
|
193
222
|
};
|
194
|
-
|
195
|
-
var user_consent;
|
223
|
+
var user_consent = {};
|
196
224
|
|
197
225
|
// ---------------------------------------------------------------------------
|
198
226
|
// helper functions
|
@@ -223,12 +251,15 @@ var j1 = (function () {
|
|
223
251
|
// -----------------------------------------------------------------------
|
224
252
|
// global var (function)
|
225
253
|
// -----------------------------------------------------------------------
|
226
|
-
var logger
|
227
|
-
var url
|
228
|
-
var baseUrl
|
229
|
-
var
|
230
|
-
var
|
231
|
-
var
|
254
|
+
var logger = log4javascript.getLogger('j1.init');
|
255
|
+
var url = new liteURL(window.location.href);
|
256
|
+
var baseUrl = url.origin;
|
257
|
+
var hostname = url.hostname;
|
258
|
+
var domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
|
259
|
+
var secure = (url.protocol.includes('https')) ? true : false;
|
260
|
+
var date = new Date();
|
261
|
+
var timestamp_now = date.toISOString();
|
262
|
+
var curr_state = 'started';
|
232
263
|
|
233
264
|
// -----------------------------------------------------------------------
|
234
265
|
// options loader
|
@@ -262,30 +293,49 @@ var j1 = (function () {
|
|
262
293
|
var url;
|
263
294
|
var baseUrl;
|
264
295
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
296
|
+
// final update of the user state cookie before browser page|tab
|
297
|
+
// get closed
|
298
|
+
if (user_state) {
|
299
|
+
user_state.session_active = false;
|
300
|
+
user_state.last_session_ts = timestamp_now;
|
301
|
+
|
302
|
+
if (!user_consent.analyses || !user_consent.personalization) {
|
303
|
+
// expire consent|state cookies to session
|
304
|
+
cookie_written = j1.writeCookie({
|
305
|
+
name: cookie_names.user_consent,
|
306
|
+
data: user_consent,
|
307
|
+
samesite: 'Strict',
|
308
|
+
secure: secure
|
309
|
+
});
|
310
|
+
if (!cookie_written) {
|
311
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
|
312
|
+
}
|
313
|
+
cookie_written = j1.writeCookie({
|
314
|
+
name: cookie_names.user_state,
|
315
|
+
data: user_state,
|
316
|
+
samesite: 'Strict',
|
317
|
+
secure: secure
|
318
|
+
});
|
319
|
+
if (!cookie_written) {
|
320
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
|
321
|
+
}
|
322
|
+
} else {
|
323
|
+
cookie_written = j1.writeCookie({
|
324
|
+
name: cookie_names.user_state,
|
325
|
+
data: user_state,
|
326
|
+
samesite: 'Strict',
|
327
|
+
secure: secure,
|
328
|
+
expires: 365
|
329
|
+
});
|
330
|
+
if (!cookie_written) {
|
331
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
332
|
+
}
|
333
|
+
}
|
280
334
|
} else {
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
samesite: 'Strict',
|
285
|
-
expires: 365
|
286
|
-
});
|
335
|
+
// jadams, 2021-07-11: on beforeunload, a vaild state cookie
|
336
|
+
// is expected
|
337
|
+
logger.fatal('\n' + 'missing cookie detected: ' + cookie_names.user_state);
|
287
338
|
}
|
288
|
-
|
289
339
|
}); // END beforeunload
|
290
340
|
|
291
341
|
// -----------------------------------------------------------------------
|
@@ -297,37 +347,61 @@ var j1 = (function () {
|
|
297
347
|
user_consent = j1.readCookie(cookie_names.user_consent);
|
298
348
|
user_session = j1.existsCookie(cookie_names.user_session)
|
299
349
|
? j1.readCookie(cookie_names.user_session)
|
300
|
-
: j1.writeCookie({
|
350
|
+
: cookie_written = j1.writeCookie({
|
301
351
|
name: cookie_names.user_session,
|
302
352
|
data: user_session,
|
303
|
-
samesite: 'Strict'
|
353
|
+
samesite: 'Strict',
|
354
|
+
secure: secure
|
304
355
|
});
|
356
|
+
if (!cookie_written) {
|
357
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
358
|
+
}
|
305
359
|
|
306
360
|
user_state = j1.existsCookie(cookie_names.user_state)
|
307
361
|
? j1.readCookie(cookie_names.user_state)
|
308
|
-
: j1.writeCookie({
|
362
|
+
: cookie_written = j1.writeCookie({
|
309
363
|
name: cookie_names.user_state,
|
310
364
|
data: user_state,
|
311
365
|
samesite: 'Strict',
|
366
|
+
secure: secure,
|
312
367
|
expires: 365
|
313
368
|
});
|
369
|
+
if (!cookie_written) {
|
370
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
371
|
+
}
|
314
372
|
|
315
|
-
user_state
|
373
|
+
// jadams, 2021-07-11: Found situation that user_state NOT initialized
|
374
|
+
// correctly (user_state == false).
|
375
|
+
// TODO: Check if/why user state (cookie NOT created?) NOT initialized
|
376
|
+
// for what reason.
|
377
|
+
if (!user_state) {
|
378
|
+
logger.error('\n' + 'cookie not found: ' + cookie_names.user_state);
|
379
|
+
user_state = j1.readCookie(cookie_names.user_state);
|
380
|
+
user_state.session_active = true;
|
381
|
+
}
|
316
382
|
|
317
383
|
if (!user_consent.analyses || !user_consent.personalization) {
|
318
384
|
// expire consent|state cookies to session
|
319
|
-
j1.writeCookie({
|
385
|
+
cookie_written = j1.writeCookie({
|
320
386
|
name: cookie_names.user_state,
|
321
387
|
data: user_state,
|
322
|
-
samesite: 'Strict'
|
388
|
+
samesite: 'Strict',
|
389
|
+
secure: secure
|
323
390
|
});
|
391
|
+
if (!cookie_written) {
|
392
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
393
|
+
}
|
324
394
|
} else {
|
325
|
-
j1.writeCookie({
|
395
|
+
cookie_written = j1.writeCookie({
|
326
396
|
name: cookie_names.user_state,
|
327
397
|
data: user_state,
|
328
398
|
samesite: 'Strict',
|
399
|
+
secure: secure,
|
329
400
|
expires: 365
|
330
401
|
});
|
402
|
+
if (!cookie_written) {
|
403
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
404
|
+
}
|
331
405
|
}
|
332
406
|
|
333
407
|
// detect middleware (mode 'app') and update user session cookie
|
@@ -350,35 +424,41 @@ var j1 = (function () {
|
|
350
424
|
user_session.requested_page = window.location.pathname;
|
351
425
|
user_session.timestamp = timestamp_now;
|
352
426
|
user_session = j1.mergeData(user_session, data);
|
353
|
-
logText = 'mode detected: ' + user_session.mode;
|
427
|
+
logText = '\n' + 'mode detected: ' + user_session.mode;
|
354
428
|
|
355
429
|
logger.info(logText);
|
356
|
-
logger.info('update user session cookie');
|
357
|
-
j1.writeCookie({
|
430
|
+
logger.info('\n' + 'update user session cookie');
|
431
|
+
cookie_written = j1.writeCookie({
|
358
432
|
name: cookie_names.user_session,
|
359
433
|
data: user_session,
|
360
|
-
samesite: 'Strict'
|
434
|
+
samesite: 'Strict',
|
435
|
+
secure: secure
|
361
436
|
});
|
437
|
+
|
438
|
+
if (!cookie_written) {
|
439
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
440
|
+
}
|
441
|
+
|
362
442
|
j1.setState(curr_state);
|
363
|
-
logger.info('state: ' + j1.getState());
|
443
|
+
logger.info('\n' + 'state: ' + j1.getState());
|
364
444
|
|
365
445
|
var dependencies_met_page_displayed = setInterval (function () {
|
366
446
|
if (j1.getState() == 'finished') {
|
367
447
|
if (j1.authEnabled()) {
|
368
448
|
if (user_session.authenticated === 'true') {
|
369
449
|
// set signout
|
370
|
-
logger.info('show signout icon');
|
450
|
+
logger.info('\n' + 'show signout icon');
|
371
451
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignOut');
|
372
452
|
$('#iconSignInOut').removeClass('mdi-login').addClass('mdi-logout');
|
373
453
|
} else {
|
374
454
|
// set signin
|
375
|
-
logger.info('show signin icon');
|
455
|
+
logger.info('\n' + 'show signin icon');
|
376
456
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignIn');
|
377
457
|
$('#iconSignInOut').removeClass('mdi-logout').addClass('mdi-login');
|
378
458
|
}
|
379
|
-
logger.info('authentication detected as: ' + user_session.authenticated);
|
459
|
+
logger.info('\n' + 'authentication detected as: ' + user_session.authenticated);
|
380
460
|
$('#quickLinksSignInOutButton').css('display', 'block');
|
381
|
-
logger.info('met dependencies for: j1');
|
461
|
+
logger.info('\n' + 'met dependencies for: j1');
|
382
462
|
clearInterval(dependencies_met_page_displayed);
|
383
463
|
}
|
384
464
|
}
|
@@ -392,34 +472,39 @@ var j1 = (function () {
|
|
392
472
|
user_session.mode = 'web';
|
393
473
|
user_session.requested_page = window.location.pathname;
|
394
474
|
user_session.timestamp = timestamp_now;
|
395
|
-
logText = 'mode detected: ' + user_session.mode;
|
475
|
+
logText = '\n' + 'mode detected: ' + user_session.mode;
|
396
476
|
|
397
477
|
logger.info(logText);
|
398
|
-
j1.writeCookie({
|
478
|
+
cookie_written = j1.writeCookie({
|
399
479
|
name: cookie_names.user_session,
|
400
480
|
data: user_session,
|
401
|
-
samesite: 'Strict'
|
481
|
+
samesite: 'Strict',
|
482
|
+
secure: secure
|
402
483
|
});
|
484
|
+
if (!cookie_written) {
|
485
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
486
|
+
}
|
487
|
+
|
403
488
|
j1.setState(curr_state);
|
404
|
-
logger.info('state: ' + j1.getState());
|
489
|
+
logger.info('\n' + 'state: ' + j1.getState());
|
405
490
|
}, detectTimeout);
|
406
491
|
});
|
407
|
-
} else { //
|
492
|
+
} else { // web mode
|
408
493
|
state = 'started';
|
409
|
-
logger.info('state: ' + state);
|
410
|
-
logger.info('page is being initialized');
|
494
|
+
logger.info('\n' + 'state: ' + state);
|
495
|
+
logger.info('\n' + 'page is being initialized');
|
411
496
|
}
|
412
497
|
|
413
498
|
state = 'started';
|
414
|
-
logger.info('state: ' + state);
|
415
|
-
logger.info('page is being initialized');
|
499
|
+
logger.info('\n' + 'state: ' + state);
|
500
|
+
logger.info('\n' + 'page is being initialized');
|
416
501
|
|
417
502
|
if ( settings.scrollbar === 'false' ) {
|
418
503
|
$('body').addClass('hide-scrollbar');
|
419
504
|
$('html').addClass('hide-scrollbar-moz');
|
420
505
|
}
|
421
506
|
|
422
|
-
logger.info('read user state from cookie');
|
507
|
+
logger.info('\n' + 'read user state from cookie');
|
423
508
|
user_session = j1.readCookie(cookie_names.user_session);
|
424
509
|
|
425
510
|
// process|update user state cookie
|
@@ -449,13 +534,18 @@ var j1 = (function () {
|
|
449
534
|
last_pager = user_session.last_pager;
|
450
535
|
}
|
451
536
|
|
452
|
-
logger.info('update user session cookie');
|
453
|
-
j1.writeCookie({
|
537
|
+
logger.info('\n' + 'update user session cookie');
|
538
|
+
cookie_written = j1.writeCookie({
|
454
539
|
name: cookie_names.user_session,
|
455
540
|
data: user_session,
|
456
|
-
samesite: 'Strict'
|
541
|
+
samesite: 'Strict',
|
542
|
+
secure: secure
|
457
543
|
});
|
458
544
|
|
545
|
+
if (!cookie_written) {
|
546
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
547
|
+
}
|
548
|
+
|
459
549
|
// NOTE: asynchronous calls should be rewitten to xhrData
|
460
550
|
// initialize page resources for blocks
|
461
551
|
j1.initBanner(settings);
|
@@ -463,15 +553,19 @@ var j1 = (function () {
|
|
463
553
|
j1.initFooter(settings);
|
464
554
|
|
465
555
|
state = 'running';
|
466
|
-
logger.info('state: ' + state);
|
467
|
-
logger.info(logText);
|
556
|
+
logger.info('\n' + 'state: ' + state);
|
557
|
+
// logger.info(logText);
|
468
558
|
|
469
559
|
user_session.timestamp = timestamp_now;
|
470
|
-
j1.writeCookie({
|
560
|
+
cookie_written = j1.writeCookie({
|
471
561
|
name: cookie_names.user_session,
|
472
562
|
data: user_session,
|
473
|
-
samesite: 'Strict'
|
563
|
+
samesite: 'Strict',
|
564
|
+
secure: secure
|
474
565
|
});
|
566
|
+
if (!cookie_written) {
|
567
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
568
|
+
}
|
475
569
|
|
476
570
|
// -----------------------------------------------------------------------
|
477
571
|
// additional BS helpers from j1.core
|
@@ -502,20 +596,20 @@ var j1 = (function () {
|
|
502
596
|
return function ( responseTxt, statusTxt, xhr ) {
|
503
597
|
if ( statusTxt == 'success' ) {
|
504
598
|
var logger = log4javascript.getLogger('j1.adapter.xhrData');
|
505
|
-
logText = 'loading banner completed on id: ' +banner_id;
|
599
|
+
logText = '\n' + 'loading banner completed on id: ' +banner_id;
|
506
600
|
logger.info(logText);
|
507
601
|
j1.setXhrDataState(banner_id, statusTxt);
|
508
602
|
j1.setXhrDomState(banner_id, statusTxt);
|
509
|
-
logger.info('XHR data loaded in the DOM: ' + banner_id);
|
603
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + banner_id);
|
510
604
|
}
|
511
605
|
if ( statusTxt == 'error' ) {
|
512
|
-
logText = 'loading banner failed on id: ' +banner_id+ ', error: ' + xhr.status + ': ' + xhr.statusText;
|
606
|
+
logText = '\n' + 'loading banner failed on id: ' +banner_id+ ', error: ' + xhr.status + ': ' + xhr.statusText;
|
513
607
|
logger.error(logText);
|
514
608
|
j1.setXhrDataState(banner_id, statusTxt);
|
515
609
|
j1.setXhrDomState(banner_id, statusTxt);
|
516
610
|
// Set|Log status
|
517
611
|
state = 'failed';
|
518
|
-
logger.error('state: ' + state);
|
612
|
+
logger.error('\n' + 'state: ' + state);
|
519
613
|
}
|
520
614
|
};
|
521
615
|
};
|
@@ -576,15 +670,15 @@ var j1 = (function () {
|
|
576
670
|
var id = '#' + banner[i];
|
577
671
|
var selector = $(id);
|
578
672
|
if (selector.length) {
|
579
|
-
logText = 'loading banner on id: ' +banner[i];
|
673
|
+
logText = '\n' + 'loading banner on id: ' +banner[i];
|
580
674
|
logger.info(logText);
|
581
675
|
var banner_data_path = '{{banner_data_path}} ' + id;
|
582
676
|
selector.load(banner_data_path, cb_load_closure(id));
|
583
677
|
}
|
584
678
|
} // END for
|
585
679
|
} else {
|
586
|
-
logText = 'no banner found in site';
|
587
|
-
logger.
|
680
|
+
logText = '\n' + 'no banner found in site';
|
681
|
+
logger.warn(logText);
|
588
682
|
return false;
|
589
683
|
}
|
590
684
|
return true;
|
@@ -613,20 +707,20 @@ var j1 = (function () {
|
|
613
707
|
return function ( responseTxt, statusTxt, xhr ) {
|
614
708
|
var logger = log4javascript.getLogger('j1.adapter.xhrData');
|
615
709
|
if ( statusTxt == 'success' ) {
|
616
|
-
logText = 'loading panel completed on id: ' +panel_id;
|
710
|
+
logText = '\n' + 'loading panel completed on id: ' +panel_id;
|
617
711
|
logger.info(logText);
|
618
712
|
j1.setXhrDataState(panel_id, statusTxt);
|
619
713
|
j1.setXhrDomState(panel_id, statusTxt);
|
620
|
-
logger.info('XHR data loaded in the DOM: ' + panel_id);
|
714
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + panel_id);
|
621
715
|
}
|
622
716
|
if ( statusTxt == 'error' ) {
|
623
|
-
logText = 'loading panel failed on id: ' +panel_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
717
|
+
logText = '\n' + 'loading panel failed on id: ' +panel_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
624
718
|
logger.error(logText);
|
625
719
|
j1.setXhrDataState(panel_id, statusTxt);
|
626
720
|
j1.setXhrDomState(panel_id, statusTxt);
|
627
721
|
// Set|Log status
|
628
722
|
state = 'Error';
|
629
|
-
logger.error('state: ' + state);
|
723
|
+
logger.error('\n' + 'state: ' + state);
|
630
724
|
}
|
631
725
|
};
|
632
726
|
};
|
@@ -679,15 +773,15 @@ var j1 = (function () {
|
|
679
773
|
var id = '#' + panel[i];
|
680
774
|
var selector = $(id);
|
681
775
|
if ( selector.length ) {
|
682
|
-
logText = 'loading panel on id: ' +panel[i];
|
776
|
+
logText = '\n' + 'loading panel on id: ' +panel[i];
|
683
777
|
logger.info(logText);
|
684
778
|
var panel_data_path = '{{panel_data_path}} ' + id;
|
685
779
|
selector.load(panel_data_path, cb_load_closure(id));
|
686
780
|
}
|
687
781
|
} // END for
|
688
782
|
} else {
|
689
|
-
logText = 'no panel found in site';
|
690
|
-
logger.
|
783
|
+
logText = '\n' + 'no panel found in site';
|
784
|
+
logger.warn(logText);
|
691
785
|
return false;
|
692
786
|
}
|
693
787
|
return true;
|
@@ -702,31 +796,31 @@ var j1 = (function () {
|
|
702
796
|
var mod = 'j1';
|
703
797
|
var logText;
|
704
798
|
|
705
|
-
logText = 'loading footer started';
|
799
|
+
logText = '\n' + 'loading footer started';
|
706
800
|
logger.info(logText);
|
707
801
|
|
708
802
|
var cb_load_closure = function(footer_id) {
|
709
803
|
return function ( responseTxt, statusTxt, xhr ) {
|
710
804
|
var logger = log4javascript.getLogger('j1.adapter.xhrData');
|
711
805
|
if ( statusTxt == 'success' ) {
|
712
|
-
logText = 'footer loaded successfully on id: ' + footer_id;
|
806
|
+
logText = '\n' + 'footer loaded successfully on id: ' + footer_id;
|
713
807
|
logger.info(logText);
|
714
808
|
j1.setXhrDataState(footer_id, statusTxt);
|
715
809
|
j1.setXhrDomState(footer_id, statusTxt);
|
716
|
-
logger.info('XHR data loaded in the DOM: ' + footer_id);
|
717
|
-
logText = 'initialization finished';
|
810
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + footer_id);
|
811
|
+
logText = '\n' + 'initialization finished';
|
718
812
|
logger.info(logText);
|
719
813
|
}
|
720
814
|
if ( statusTxt == 'error' ) {
|
721
|
-
logText = 'loading footer failed on id: ' +footer_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
815
|
+
logText = '\n' + 'loading footer failed on id: ' +footer_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
722
816
|
logger.error(logText);
|
723
817
|
j1.setXhrDataState(footer_id, statusTxt);
|
724
818
|
j1.setXhrDomState(footer_id, statusTxt);
|
725
819
|
|
726
820
|
// Set|Log status
|
727
821
|
state = 'failed';
|
728
|
-
logger.error('state: ' + state);
|
729
|
-
logText = 'initialization finished';
|
822
|
+
logger.error('\n' + 'state: ' + state);
|
823
|
+
logText = '\n' + 'initialization finished';
|
730
824
|
logger.info(logText);
|
731
825
|
}
|
732
826
|
};
|
@@ -738,7 +832,7 @@ var j1 = (function () {
|
|
738
832
|
var footer_data_path = '{{footer_data_path}} ' + id;
|
739
833
|
selector.load(footer_data_path, cb_load_closure(id));
|
740
834
|
} else {
|
741
|
-
logText = 'data not loaded';
|
835
|
+
logText = '\n' + 'data not loaded';
|
742
836
|
logger.warn(logText);
|
743
837
|
j1.setXhrDataState(id, 'not loaded');
|
744
838
|
j1.setXhrDomState(id, 'pending');
|
@@ -762,9 +856,11 @@ var j1 = (function () {
|
|
762
856
|
var flickerTimeout = {{template_config.flicker_timeout}};
|
763
857
|
var url = new liteURL(window.location.href);
|
764
858
|
var baseUrl = url.origin;
|
859
|
+
var secure = (url.protocol.includes('https')) ? true : false;
|
765
860
|
var ep_status = baseUrl + '/status' + '?page=' + window.location.pathname;
|
766
861
|
var user_session = j1.readCookie(cookie_names.user_session);
|
767
862
|
var user_state = j1.readCookie(cookie_names.user_state);
|
863
|
+
var user_consent = j1.readCookie(cookie_names.user_consent);
|
768
864
|
var current_url = new liteURL(window.location.href);
|
769
865
|
var providerPermissions = {};
|
770
866
|
var provider;
|
@@ -772,14 +868,36 @@ var j1 = (function () {
|
|
772
868
|
var appDetected;
|
773
869
|
var categoryAllowed;
|
774
870
|
|
775
|
-
|
871
|
+
// provider APIs require user consent
|
872
|
+
var meta_analytics = $('meta[name=analytics]').attr('content');
|
873
|
+
var analytics = (meta_analytics === 'true') ? true: false;
|
874
|
+
var meta_comments = $('meta[name=comments]').attr('content');
|
875
|
+
var comments = (meta_comments === 'true') ? true: false;
|
876
|
+
var meta_advertising = $('meta[name=advertising]').attr('content');
|
877
|
+
var advertising = (meta_advertising === 'true') ? true: false;
|
878
|
+
var meta_youtube = $('meta[name=youtube]').attr('content');
|
879
|
+
var youtube = (meta_youtube === 'true') ? true: false;
|
880
|
+
var meta_vimeo = $('meta[name=vimeo]').attr('content');
|
881
|
+
var vimeo = (meta_vimeo === 'true') ? true: false;
|
882
|
+
|
883
|
+
// personalized content require user consent
|
884
|
+
var meta_personalization = $('meta[name=personalization]').attr('content');
|
885
|
+
var personalization = (meta_personalization === 'true') ? true: false;
|
886
|
+
|
887
|
+
// if personalized content detected, page requires user consent
|
888
|
+
if (personalization && !user_consent.personalization) {
|
889
|
+
// redirect to error paged (blocked content)
|
890
|
+
window.location.href = "/444.html";
|
891
|
+
}
|
892
|
+
|
893
|
+
logger.info('\n' + 'finalize page');
|
776
894
|
j1.setCss();
|
777
895
|
|
778
|
-
logText= 'loading page partials: started';
|
896
|
+
logText= '\n' + 'loading page partials: started';
|
779
897
|
logger.info(logText);
|
780
898
|
|
781
899
|
if (j1.appDetected()) { // app mode
|
782
|
-
logger.info('mode detected: app');
|
900
|
+
logger.info('\n' + 'mode detected: app');
|
783
901
|
|
784
902
|
$.when ($.ajax(ep_status))
|
785
903
|
.then(function(data) {
|
@@ -788,11 +906,15 @@ var j1 = (function () {
|
|
788
906
|
user_session = j1.mergeData(user_session, data);
|
789
907
|
|
790
908
|
user_session.current_page = current_url.pathname;
|
791
|
-
j1.writeCookie({
|
909
|
+
cookie_written = j1.writeCookie({
|
792
910
|
name: cookie_names.user_session,
|
793
911
|
data: user_session,
|
794
|
-
samesite: 'Strict'
|
912
|
+
samesite: 'Strict',
|
913
|
+
secure: secure
|
795
914
|
});
|
915
|
+
if (!cookie_written) {
|
916
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
917
|
+
}
|
796
918
|
|
797
919
|
providerPermissions = user_session.provider_permissions;
|
798
920
|
categoryAllowed = providerPermissions.includes(user_session.page_permission);
|
@@ -818,17 +940,66 @@ var j1 = (function () {
|
|
818
940
|
|
819
941
|
// show the page delayed
|
820
942
|
setTimeout (function() {
|
943
|
+
|
944
|
+
// Manage providers for personalization OptIn/Out (Comments|Ads)
|
945
|
+
if (!user_consent.personalization) {
|
946
|
+
logger.warn('\n' + 'disable comment provider: ' + comment_provider);
|
947
|
+
$('#leave-a-comment').remove();
|
948
|
+
if (comment_provider === 'disqus') {
|
949
|
+
$('#dsq-count-scr').remove();
|
950
|
+
$('#disqus-thread').remove();
|
951
|
+
}
|
952
|
+
if (comment_provider === 'hyvor') {
|
953
|
+
$('#hyvor-embed').remove();
|
954
|
+
$('#hyvor-talk-view').remove();
|
955
|
+
}
|
956
|
+
} else {
|
957
|
+
if (comments) {
|
958
|
+
logger.warn('\n' + 'enable comment provider: ' + comment_provider);
|
959
|
+
$('#main-content').append('<h2 id="leave-a-comment" class="mt-4">Leave a comment</h2>');
|
960
|
+
if (comment_provider === 'disqus') {
|
961
|
+
logger.info('\n' + 'load comment provider code: ' + comment_provider);
|
962
|
+
$('#main-content').append('<div id="disqus_thread"></div>');
|
963
|
+
$('body').append('<script async id="dsq-count-scr" src="//' + site_id + '.disqus.com/count.js"></script>');
|
964
|
+
j1.loadJS({
|
965
|
+
xhr_data_path: '/assets/data/' + comment_provider + '.js',
|
966
|
+
xhr_data_element: comment_provider
|
967
|
+
});
|
968
|
+
}
|
969
|
+
if (comment_provider === 'hyvor') {
|
970
|
+
$('body').append('<script> var HYVOR_TALK_WEBSITE = ' + site_id + '; var HYVOR_TALK_CONFIG = { url: false, id: false };');
|
971
|
+
$('#main-content').append('<div id="hyvor-talk-view"></div>');
|
972
|
+
$('body').append('<script async id="hyvor-embed" type="text/javascript" src="//talk.hyvor.com/web-api/embed.js"></script>');
|
973
|
+
}
|
974
|
+
} // END comments
|
975
|
+
} // END personalization
|
976
|
+
|
821
977
|
// display page
|
822
|
-
|
978
|
+
$('#no_flicker').css('display', 'block');
|
979
|
+
|
980
|
+
// NOTE: Placed tracking warning/info here because page may reloaded
|
981
|
+
// after cookie consent selection
|
982
|
+
if (user_consent.analyses) {
|
983
|
+
logger.info('\n' + 'tracking allowed, privacy settings for analysis: ' + user_consent.analyses);
|
984
|
+
if (tracking_enabled && !tracking_id_valid) {
|
985
|
+
logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
|
986
|
+
} else if (tracking_enabled && tracking_id_valid) {
|
987
|
+
logger.warn('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
|
988
|
+
} else {
|
989
|
+
logger.warn('\n' + 'tracking disabled, tracking id found: ' + tracking_id);
|
990
|
+
}
|
991
|
+
} else {
|
992
|
+
logger.warn('\n' + 'tracking not allowed, privacy settings for analysis: ' + user_consent.analyses);
|
993
|
+
}
|
823
994
|
|
824
995
|
// show|hide cookie icon (should MOVED to Cookiebar ???)
|
825
996
|
if (j1.existsCookie(cookie_names.user_consent)) {
|
826
997
|
// Display cookie icon
|
827
|
-
logText = 'show cookie icon';
|
998
|
+
logText = '\n' + 'show cookie icon';
|
828
999
|
logger.info(logText);
|
829
1000
|
$('#quickLinksCookieButton').css('display', 'block');
|
830
1001
|
} else {
|
831
|
-
logText = 'hide cookie icon';
|
1002
|
+
logText = '\n' + 'hide cookie icon';
|
832
1003
|
logger.info(logText);
|
833
1004
|
// Display cookie icon
|
834
1005
|
$('#quickLinksCookieButton').css('display', 'none');
|
@@ -836,8 +1007,8 @@ var j1 = (function () {
|
|
836
1007
|
|
837
1008
|
// show|hide translator icon (currently NOT supported)
|
838
1009
|
// if (translation_enabled) {
|
839
|
-
// logger.info('translator detected: google');
|
840
|
-
// logger.info('initialize language selector');
|
1010
|
+
// logger.info('\n' + 'translator detected: google');
|
1011
|
+
// logger.info('\n' + 'initialize language selector');
|
841
1012
|
// $('.goog-te-combo').addClass('form-control');
|
842
1013
|
// }
|
843
1014
|
|
@@ -847,16 +1018,16 @@ var j1 = (function () {
|
|
847
1018
|
if (j1.authEnabled()) {
|
848
1019
|
if (user_session.authenticated === 'true') {
|
849
1020
|
// set signout
|
850
|
-
logger.info('show signout icon');
|
1021
|
+
logger.info('\n' + 'show signout icon');
|
851
1022
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignOut');
|
852
1023
|
$('#iconSignInOut').removeClass('mdi-login').addClass('mdi-logout');
|
853
1024
|
} else {
|
854
1025
|
// set signin
|
855
|
-
logger.info('show signin icon');
|
1026
|
+
logger.info('\n' + 'show signin icon');
|
856
1027
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignIn');
|
857
1028
|
$('#iconSignInOut').removeClass('mdi-logout').addClass('mdi-login');
|
858
1029
|
}
|
859
|
-
logger.info('authentication detected as: ' + user_session.authenticated);
|
1030
|
+
logger.info('\n' + 'authentication detected as: ' + user_session.authenticated);
|
860
1031
|
$('#quickLinksSignInOutButton').css('display', 'block');
|
861
1032
|
}
|
862
1033
|
|
@@ -865,25 +1036,25 @@ var j1 = (function () {
|
|
865
1036
|
j1.scrollTo();
|
866
1037
|
|
867
1038
|
if (user_session.previous_page !== user_session.current_page) {
|
868
|
-
logText = 'page change detected';
|
1039
|
+
logText = '\n' + 'page change detected';
|
869
1040
|
logger.info(logText);
|
870
|
-
logText = 'previous page: ' + user_session.previous_page;
|
1041
|
+
logText = '\n' + 'previous page: ' + user_session.previous_page;
|
871
1042
|
logger.info(logText);
|
872
|
-
logText = 'current page: ' + user_session.current_page;
|
1043
|
+
logText = '\n' + 'current page: ' + user_session.current_page;
|
873
1044
|
logger.info(logText);
|
874
1045
|
}
|
875
1046
|
|
876
1047
|
// update sidebar for changed theme data
|
877
|
-
logger.info('update sidebar');
|
1048
|
+
logger.info('\n' + 'update sidebar');
|
878
1049
|
user_state = j1.readCookie(cookie_names.user_state);
|
879
1050
|
current_user_data = j1.mergeData(user_session, user_state);
|
880
1051
|
j1.core.navigator.updateSidebar(current_user_data);
|
881
1052
|
|
882
1053
|
// Set|Log status
|
883
1054
|
state = 'finished';
|
884
|
-
logText = 'state: ' + state;
|
1055
|
+
logText = '\n' + 'state: ' + state;
|
885
1056
|
logger.info(logText);
|
886
|
-
logText = 'page finalized successfully';
|
1057
|
+
logText = '\n' + 'page finalized successfully';
|
887
1058
|
logger.info(logText);
|
888
1059
|
|
889
1060
|
}, flickerTimeout);
|
@@ -892,27 +1063,79 @@ var j1 = (function () {
|
|
892
1063
|
// show the page delayed
|
893
1064
|
setTimeout (function() {
|
894
1065
|
j1.setState('finished');
|
895
|
-
logger.info('state: finished');
|
896
|
-
logger.info('page initialization: finished');
|
1066
|
+
logger.info('\n' + 'state: finished');
|
1067
|
+
logger.info('\n' + 'page initialization: finished');
|
1068
|
+
|
1069
|
+
// Manage providers for personalization OptIn/Out (Comments|Ads)
|
1070
|
+
if (!user_consent.personalization) {
|
1071
|
+
logger.warn('\n' + 'disable comment provider: ' + comment_provider);
|
1072
|
+
$('#leave-a-comment').remove();
|
1073
|
+
if (comment_provider === 'disqus') {
|
1074
|
+
$('#dsq-count-scr').remove();
|
1075
|
+
$('#disqus-thread').remove();
|
1076
|
+
}
|
1077
|
+
if (comment_provider === 'hyvor') {
|
1078
|
+
$('#hyvor-embed').remove();
|
1079
|
+
$('#hyvor-talk-view').remove();
|
1080
|
+
}
|
1081
|
+
} else {
|
1082
|
+
if (comments) {
|
1083
|
+
logger.warn('\n' + 'enable comment provider: ' + comment_provider);
|
1084
|
+
$('#main-content').append('<h2 id="leave-a-comment" class="mt-4">Leave a comment</h2>');
|
1085
|
+
if (comment_provider === 'disqus') {
|
1086
|
+
logger.info('\n' + 'load comment provider code: ' + comment_provider);
|
1087
|
+
$('#main-content').append('<div id="disqus_thread"></div>');
|
1088
|
+
$('body').append('<script async id="dsq-count-scr" src="//' + site_id + '.disqus.com/count.js"></script>');
|
1089
|
+
j1.loadJS({
|
1090
|
+
xhr_data_path: '/assets/data/' + comment_provider + '.js',
|
1091
|
+
xhr_data_element: comment_provider
|
1092
|
+
});
|
1093
|
+
}
|
1094
|
+
if (comment_provider === 'hyvor') {
|
1095
|
+
$('body').append('<script> var HYVOR_TALK_WEBSITE = ' + site_id + '; var HYVOR_TALK_CONFIG = { url: false, id: false };');
|
1096
|
+
$('#main-content').append('<div id="hyvor-talk-view"></div>');
|
1097
|
+
$('body').append('<script async id="hyvor-embed" type="text/javascript" src="//talk.hyvor.com/web-api/embed.js"></script>');
|
1098
|
+
}
|
1099
|
+
} // END comments
|
1100
|
+
} // END personalization
|
897
1101
|
|
898
1102
|
// display page
|
899
1103
|
$('#no_flicker').css('display', 'block');
|
900
1104
|
|
901
|
-
|
902
|
-
|
1105
|
+
// NOTE: Placed tracking warning/info here because page may reloaded
|
1106
|
+
// after cookie consent selection
|
1107
|
+
if (user_consent.analyses) {
|
1108
|
+
logger.info('\n' + 'tracking allowed, privacy settings for analysis: ' + user_consent.analyses);
|
1109
|
+
if (tracking_enabled && !tracking_id_valid) {
|
1110
|
+
logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
|
1111
|
+
} else if (tracking_enabled && tracking_id_valid) {
|
1112
|
+
logger.warn('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
|
1113
|
+
} else {
|
1114
|
+
logger.warn('\n' + 'tracking disabled, tracking id found: ' + tracking_id);
|
1115
|
+
}
|
1116
|
+
} else {
|
1117
|
+
logger.warn('\n' + 'tracking not allowed, privacy settings for analysis: ' + user_consent.analyses);
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
logger.info('\n' + 'mode detected: web');
|
1121
|
+
logger.info('\n' + 'hide signin icon');
|
903
1122
|
$('#quickLinksSignInOutButton').css('display', 'none');
|
904
1123
|
|
905
1124
|
user_session.current_page = current_url.pathname;
|
906
|
-
j1.writeCookie({
|
1125
|
+
cookie_written = j1.writeCookie({
|
907
1126
|
name: cookie_names.user_session,
|
908
1127
|
data: user_session,
|
909
|
-
samesite: 'Strict'
|
1128
|
+
samesite: 'Strict',
|
1129
|
+
secure: secure
|
910
1130
|
});
|
1131
|
+
if (!cookie_written) {
|
1132
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
1133
|
+
}
|
911
1134
|
|
912
1135
|
// show|hide translator icon (currently NOT supported)
|
913
1136
|
// if (translation_enabled) {
|
914
|
-
// logger.info('translator detected: google');
|
915
|
-
// logger.info('initialize language selector');
|
1137
|
+
// logger.info('\n' + 'translator detected: google');
|
1138
|
+
// logger.info('\n' + 'initialize language selector');
|
916
1139
|
// $('.goog-te-combo').addClass('form-control');
|
917
1140
|
// }
|
918
1141
|
|
@@ -922,11 +1145,11 @@ var j1 = (function () {
|
|
922
1145
|
// show|hide cookie icon
|
923
1146
|
if (j1.existsCookie(cookie_names.user_consent)) {
|
924
1147
|
// Display cookie icon
|
925
|
-
logText = 'show cookie icon';
|
1148
|
+
logText = '\n' + 'show cookie icon';
|
926
1149
|
logger.info(logText);
|
927
1150
|
$('#quickLinksCookieButton').css('display', 'block');
|
928
1151
|
} else {
|
929
|
-
logText = 'hide cookie icon';
|
1152
|
+
logText = '\n' + 'hide cookie icon';
|
930
1153
|
logger.info(logText);
|
931
1154
|
// Display cookie icon
|
932
1155
|
$('#quickLinksCookieButton').css('display', 'none');
|
@@ -937,25 +1160,25 @@ var j1 = (function () {
|
|
937
1160
|
j1.scrollTo();
|
938
1161
|
|
939
1162
|
if (user_session.previous_page !== user_session.current_page) {
|
940
|
-
logText = 'page change detected';
|
1163
|
+
logText = '\n' + 'page change detected';
|
941
1164
|
logger.info(logText);
|
942
|
-
logText = 'previous page: ' + user_session.previous_page;
|
1165
|
+
logText = '\n' + 'previous page: ' + user_session.previous_page;
|
943
1166
|
logger.info(logText);
|
944
|
-
logText = 'current page: ' + user_session.current_page;
|
1167
|
+
logText = '\n' + 'current page: ' + user_session.current_page;
|
945
1168
|
logger.info(logText);
|
946
1169
|
}
|
947
1170
|
|
948
1171
|
// update sidebar for changed theme data
|
949
|
-
logger.info('update sidebar');
|
1172
|
+
logger.info('\n' + 'update sidebar');
|
950
1173
|
user_state = j1.readCookie(cookie_names.user_state);
|
951
1174
|
current_user_data = j1.mergeData(user_session, user_state);
|
952
1175
|
j1.core.navigator.updateSidebar(current_user_data);
|
953
1176
|
|
954
1177
|
// set|log status
|
955
1178
|
state = 'finished';
|
956
|
-
logText = 'state: ' + state;
|
1179
|
+
logText = '\n' + 'state: ' + state;
|
957
1180
|
logger.info(logText);
|
958
|
-
logText = 'page finalized successfully';
|
1181
|
+
logText = '\n' + 'page finalized successfully';
|
959
1182
|
logger.info(logText);
|
960
1183
|
|
961
1184
|
}, flickerTimeout);
|
@@ -1063,7 +1286,7 @@ var j1 = (function () {
|
|
1063
1286
|
$(window).scrollTop($(window).scrollTop()-1);
|
1064
1287
|
} // END if anchor_id
|
1065
1288
|
} else if (anchor_id === '#') {
|
1066
|
-
logger.info('bound click event to "#", suppress default action');
|
1289
|
+
logger.info('\n' + 'bound click event to "#", suppress default action');
|
1067
1290
|
$(window).scrollTop($(window).scrollTop()+1);
|
1068
1291
|
$(window).scrollTop($(window).scrollTop()-1);
|
1069
1292
|
return false;
|
@@ -1101,12 +1324,12 @@ var j1 = (function () {
|
|
1101
1324
|
}, // END appDetected
|
1102
1325
|
|
1103
1326
|
// -------------------------------------------------------------------------
|
1104
|
-
//
|
1105
|
-
// Load data asychronously using XHR|jQuery on an
|
1327
|
+
// loadHTML()
|
1328
|
+
// Load HTML data asychronously using XHR|jQuery on an element (e.g. <div>)
|
1106
1329
|
// specified by xhr_container_id, xhr_data_path (options)
|
1107
1330
|
// -------------------------------------------------------------------------
|
1108
|
-
|
1109
|
-
var logger = log4javascript.getLogger('j1.adapter.
|
1331
|
+
loadHTML: function (options, mod, status) {
|
1332
|
+
var logger = log4javascript.getLogger('j1.adapter.loadHTML');
|
1110
1333
|
var selector = $('#' + options.xhr_container_id);
|
1111
1334
|
var state = status;
|
1112
1335
|
var observer_options = {
|
@@ -1120,12 +1343,12 @@ var j1 = (function () {
|
|
1120
1343
|
|
1121
1344
|
var cb_load_closure = function(mod, id) {
|
1122
1345
|
return function (responseTxt, statusTxt, xhr) {
|
1123
|
-
var logger = log4javascript.getLogger('j1.adapter.
|
1346
|
+
var logger = log4javascript.getLogger('j1.adapter.loadHTML');
|
1124
1347
|
if ( statusTxt === 'success' ) {
|
1125
1348
|
j1.setXhrDataState(id, statusTxt);
|
1126
1349
|
j1.setXhrDomState(id, 'pending');
|
1127
1350
|
|
1128
|
-
logText = 'data loaded successfully on id: ' +id;
|
1351
|
+
logText = '\n' + 'data loaded successfully on id: ' +id;
|
1129
1352
|
logger.info(logText);
|
1130
1353
|
state = true;
|
1131
1354
|
}
|
@@ -1133,12 +1356,12 @@ var j1 = (function () {
|
|
1133
1356
|
// jadams, 2020-07-21: to be checked why id could be UNDEFINED
|
1134
1357
|
if (typeof(id) != "undefined") {
|
1135
1358
|
state = 'failed';
|
1136
|
-
logger.info('set state for ' +mod+ ' to: ' + state);
|
1359
|
+
logger.info('\n' + 'set state for ' +mod+ ' to: ' + state);
|
1137
1360
|
// jadams, 2020-07-21: intermediate state should DISABLED
|
1138
1361
|
// executeFunctionByName(mod + '.setState', window, state);
|
1139
1362
|
j1.setXhrDataState(id, statusTxt);
|
1140
1363
|
j1.setXhrDomState(id, 'pending');
|
1141
|
-
logText = 'loading data failed on id: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
1364
|
+
logText = '\n' + 'loading data failed on id: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
1142
1365
|
logger.error(logText);
|
1143
1366
|
state = false;
|
1144
1367
|
}
|
@@ -1159,9 +1382,9 @@ var j1 = (function () {
|
|
1159
1382
|
|
1160
1383
|
// failsafe - prevent XHR load errors
|
1161
1384
|
if (options.xhr_data_element !== '') {
|
1162
|
-
logger.info('XHR data element found: ' + options.xhr_data_element);
|
1385
|
+
logger.info('\n' + 'XHR data element found: ' + options.xhr_data_element);
|
1163
1386
|
} else {
|
1164
|
-
logger.warn('no XHR data element found, loading data aborted');
|
1387
|
+
logger.warn('\n' + 'no XHR data element found, loading data aborted');
|
1165
1388
|
return;
|
1166
1389
|
}
|
1167
1390
|
|
@@ -1183,33 +1406,71 @@ var j1 = (function () {
|
|
1183
1406
|
function mutationHandler (mutationRecords) {
|
1184
1407
|
mutationRecords.forEach ( function (mutation) {
|
1185
1408
|
if (mutation.addedNodes.length) {
|
1186
|
-
logger.info('XHR data loaded in the DOM: ' + id);
|
1409
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + id);
|
1187
1410
|
j1.setXhrDomState(id, 'success');
|
1188
1411
|
}
|
1189
1412
|
});
|
1190
1413
|
}
|
1191
1414
|
} else {
|
1192
1415
|
// jadams, 2020-07-21: To be clarified why a id is "undefined"
|
1193
|
-
|
1194
1416
|
// failsafe - prevent XHR load errors
|
1195
1417
|
if (id != '#undefined') {
|
1196
|
-
logText = 'data not loaded on id:' + id;
|
1418
|
+
logText = '\n' + 'data not loaded on id:' + id;
|
1197
1419
|
logger.warn(logText);
|
1198
1420
|
j1.setXhrDataState(id, 'not loaded');
|
1199
1421
|
j1.setXhrDomState(id, 'not loaded');
|
1200
1422
|
// Set processing state to 'finished' to complete module load
|
1201
1423
|
state = 'finished';
|
1202
|
-
logger.info('state: ' + state);
|
1424
|
+
logger.info('\n' + 'state: ' + state);
|
1203
1425
|
// jadams, 2020-07-21: intermediate state should DISABLED
|
1204
1426
|
// executeFunctionByName(mod + '.setState', window, state);
|
1205
1427
|
state = false;
|
1206
1428
|
}
|
1207
1429
|
}
|
1208
1430
|
return state;
|
1209
|
-
}, // END
|
1431
|
+
}, // END loadHTML
|
1432
|
+
|
1433
|
+
// -------------------------------------------------------------------------
|
1434
|
+
// loadJS()
|
1435
|
+
// Load JS data asychronously using jQuery (XHR)
|
1436
|
+
// -------------------------------------------------------------------------
|
1437
|
+
loadJS: function (options, mod, status) {
|
1438
|
+
var logger = log4javascript.getLogger('j1.adapter.loadJS');
|
1439
|
+
var state = status;
|
1440
|
+
var logText;
|
1441
|
+
|
1442
|
+
var cb_load_closure = function(mod, id) {
|
1443
|
+
return function (responseTxt, statusTxt, xhr) {
|
1444
|
+
var logger = log4javascript.getLogger('j1.adapter.loadJS');
|
1445
|
+
if ( statusTxt === 'success' ) {
|
1446
|
+
j1.setXhrDataState(id, statusTxt);
|
1447
|
+
|
1448
|
+
logText = '\n' + 'data loaded successfully for: ' +id;
|
1449
|
+
logger.info(logText);
|
1450
|
+
state = true;
|
1451
|
+
}
|
1452
|
+
if ( statusTxt === 'error' ) {
|
1453
|
+
state = 'failed';
|
1454
|
+
logger.info('\n' + 'set state for ' +mod+ ' to: ' + state);
|
1455
|
+
j1.setXhrDataState(id, statusTxt);
|
1456
|
+
logText = '\n' + 'loading data failed for: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
1457
|
+
logger.error(logText);
|
1458
|
+
state = false;
|
1459
|
+
}
|
1460
|
+
};
|
1461
|
+
};
|
1462
|
+
|
1463
|
+
$.ajax({
|
1464
|
+
url: options.xhr_data_path,
|
1465
|
+
dataType: 'script',
|
1466
|
+
success: cb_load_closure(mod, options.xhr_data_element)
|
1467
|
+
});
|
1468
|
+
|
1469
|
+
return state;
|
1470
|
+
}, // END loadJS
|
1210
1471
|
|
1211
1472
|
// -------------------------------------------------------------------------
|
1212
|
-
// readCookie()
|
1473
|
+
// readCookie (Vanilla JS)
|
1213
1474
|
// -------------------------------------------------------------------------
|
1214
1475
|
readCookie: function (name) {
|
1215
1476
|
var data;
|
@@ -1231,20 +1492,7 @@ var j1 = (function () {
|
|
1231
1492
|
}, // END readCookie
|
1232
1493
|
|
1233
1494
|
// -------------------------------------------------------------------------
|
1234
|
-
//
|
1235
|
-
// Search for cookies (names) in the page header that matches
|
1236
|
-
// a given regex string. Returns all names found as an array.
|
1237
|
-
// -------------------------------------------------------------------------
|
1238
|
-
// See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
|
1239
|
-
// -------------------------------------------------------------------------
|
1240
|
-
findCookie: function (regex) {
|
1241
|
-
var r=[];
|
1242
|
-
document.cookie.replace(new RegExp(regex + "[^= ]*", "g"), function(a){ r.push(a.trim()); });
|
1243
|
-
return r;
|
1244
|
-
}, // END findCookie
|
1245
|
-
|
1246
|
-
// -------------------------------------------------------------------------
|
1247
|
-
// writeCookie()
|
1495
|
+
// writeCookie (Cookie lib)
|
1248
1496
|
// Write 'data' to a cookie 'name'. If not exists, the cookie gets
|
1249
1497
|
// created. Returns 'true' if cookie was written, otherwise 'false'.
|
1250
1498
|
// -------------------------------------------------------------------------
|
@@ -1269,58 +1517,61 @@ var j1 = (function () {
|
|
1269
1517
|
// must now also specify the Secure attribute (they require a secure
|
1270
1518
|
// context/HTTPS).
|
1271
1519
|
// -------------------------------------------------------------------------
|
1272
|
-
//
|
1273
1520
|
writeCookie: function (options /*name, data, [path, expires, samesite, http_only, secure]*/) {
|
1274
1521
|
var defaults = {
|
1275
1522
|
data: {},
|
1276
1523
|
name: '',
|
1277
1524
|
path: '/',
|
1278
1525
|
expires: 0,
|
1279
|
-
samesite: '
|
1526
|
+
samesite: 'Strict',
|
1280
1527
|
http_only: false,
|
1281
1528
|
secure: false
|
1282
1529
|
};
|
1283
1530
|
var settings = $.extend(defaults, options);
|
1531
|
+
|
1284
1532
|
var date = new Date();
|
1285
1533
|
var timestamp_now = date.toISOString();
|
1286
1534
|
var cookie_data = {};
|
1287
1535
|
var data_json;
|
1288
1536
|
var data_encoded;
|
1537
|
+
var expires;
|
1538
|
+
var stringifiedAttributes = '';
|
1539
|
+
|
1540
|
+
cookie_data.timestamp = timestamp_now;
|
1289
1541
|
|
1290
1542
|
if (j1.existsCookie(settings.name)) {
|
1291
|
-
cookie_data
|
1292
|
-
cookie_data.
|
1293
|
-
|
1294
|
-
|
1295
|
-
data_encoded = window.btoa(data_json);
|
1296
|
-
|
1297
|
-
if (settings.expires > 0) {
|
1298
|
-
Cookies.set(settings.name, data_encoded, {
|
1299
|
-
expires: settings.expires,
|
1300
|
-
SameSite: settings.samesite
|
1301
|
-
});
|
1302
|
-
} else {
|
1303
|
-
Cookies.set(settings.name, data_encoded, {
|
1304
|
-
SameSite: settings.samesite
|
1305
|
-
});
|
1306
|
-
}
|
1543
|
+
cookie_data = j1.readCookie(settings.name);
|
1544
|
+
cookie_data = j1.mergeData(cookie_data, settings.data);
|
1545
|
+
data_json = JSON.stringify( cookie_data );
|
1546
|
+
data_encoded = window.btoa(data_json);
|
1307
1547
|
} else {
|
1308
1548
|
cookie_data = settings.data;
|
1309
1549
|
data_json = JSON.stringify(settings.data);
|
1310
1550
|
data_encoded = window.btoa(data_json);
|
1551
|
+
}
|
1311
1552
|
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
SameSite: settings.samesite
|
1320
|
-
});
|
1321
|
-
}
|
1553
|
+
// if (settings.path !== '/') {
|
1554
|
+
stringifiedAttributes += '; ' + 'path=' + settings.path;
|
1555
|
+
// }
|
1556
|
+
|
1557
|
+
if (settings.expires > 0) {
|
1558
|
+
settings.expires = new Date(new Date() * 1 + settings.expires * 864e+5);
|
1559
|
+
stringifiedAttributes += '; ' + 'expires=' + settings.expires;
|
1322
1560
|
}
|
1323
1561
|
|
1562
|
+
// if (settings.samesite !== 'Strict') {
|
1563
|
+
stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
|
1564
|
+
// }
|
1565
|
+
|
1566
|
+
// stringify cookie attributes
|
1567
|
+
if (settings.secure) {
|
1568
|
+
stringifiedAttributes += '; ' + 'secure=' + settings.secure;
|
1569
|
+
// document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; secure';
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
// write the cookie
|
1573
|
+
document.cookie = settings.name + '=' + data_encoded + stringifiedAttributes;
|
1574
|
+
|
1324
1575
|
if (j1.existsCookie(settings.name)) {
|
1325
1576
|
return cookie_data;
|
1326
1577
|
} else {
|
@@ -1330,63 +1581,112 @@ var j1 = (function () {
|
|
1330
1581
|
}, // END writeCookie
|
1331
1582
|
|
1332
1583
|
// -------------------------------------------------------------------------
|
1333
|
-
//
|
1334
|
-
//
|
1335
|
-
//
|
1336
|
-
//
|
1337
|
-
//
|
1584
|
+
// findCookie (Vanilla JS)
|
1585
|
+
// Search for cookies (names) in the page header that matches a given
|
1586
|
+
// name. Cookie name can be give as full name, like 'j1.user.state', or
|
1587
|
+
// as a partial like 'j1'
|
1588
|
+
// Returns all names found as an array.
|
1589
|
+
// -------------------------------------------------------------------------
|
1590
|
+
// See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
|
1338
1591
|
// -------------------------------------------------------------------------
|
1339
|
-
|
1592
|
+
findCookie: function (name) {
|
1593
|
+
var rCookie=[];
|
1594
|
+
document.cookie.replace(new RegExp(name + '[^= ]*', 'g'), function(a){ rCookie.push(a.trim()); });
|
1595
|
+
|
1596
|
+
return rCookie;
|
1597
|
+
}, // END findCookie
|
1598
|
+
|
1599
|
+
// -------------------------------------------------------------------------
|
1600
|
+
// removeCookie (Vanilla JS)
|
1601
|
+
// -------------------------------------------------------------------------
|
1602
|
+
removeCookie: function (options /*name, [path, domain]*/) {
|
1340
1603
|
var cookieExists;
|
1341
1604
|
var defaults = {
|
1342
|
-
|
1605
|
+
domain: 'localhost',
|
1343
1606
|
path: '/'
|
1344
1607
|
};
|
1345
1608
|
var settings = $.extend(defaults, options);
|
1346
1609
|
|
1347
|
-
|
1348
|
-
|
1610
|
+
if (j1.findCookie(settings.name)) {
|
1611
|
+
// clear cookie CONTENT and set expiry date in the PAST
|
1612
|
+
document.cookie = settings.name + '=; domain=' + settings.domain + '; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
|
1613
|
+
return true;
|
1614
|
+
} else {
|
1615
|
+
return false;
|
1616
|
+
}
|
1349
1617
|
}, // END removeCookie
|
1350
1618
|
|
1351
1619
|
// -------------------------------------------------------------------------
|
1352
|
-
//
|
1353
|
-
//
|
1354
|
-
//
|
1355
|
-
//
|
1620
|
+
// expireCookie (Vanilla JS)
|
1621
|
+
// Expires given cookies by name except cookies set to httpOnly. For all
|
1622
|
+
// cookies the expiry date is REMOVED. This results in cookies are set
|
1623
|
+
// to 'session' for the expiry date. All session cookies are deleted
|
1624
|
+
// automatically by the browser if the last session (browser tab|window)
|
1625
|
+
// is closed.
|
1626
|
+
// -------------------------------------------------------------------------
|
1627
|
+
// expireCookie() returns 'true' if cookie is set successfully,
|
1628
|
+
// otherwise 'false' (e.g NOT found)
|
1629
|
+
// -------------------------------------------------------------------------
|
1630
|
+
// NOTE:
|
1356
1631
|
// See: https://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript
|
1632
|
+
// NOTE:
|
1633
|
+
// There is NO way you could get a trace of Path, Domain and other
|
1634
|
+
// attributes of cookies as they are only read by browsers and NOT shown
|
1635
|
+
// to JavaScript. For that reason, attributes needs to be set explicitly.
|
1357
1636
|
// -------------------------------------------------------------------------
|
1358
|
-
|
1359
|
-
var
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1637
|
+
expireCookie: function (options /*name [,path, samesite, secure]*/) {
|
1638
|
+
var defaults = {
|
1639
|
+
path: '/',
|
1640
|
+
samesite: 'Strict',
|
1641
|
+
secure: false
|
1642
|
+
};
|
1643
|
+
var settings = $.extend(defaults, options);
|
1644
|
+
|
1645
|
+
var dc = document.cookie; // all cookies in page
|
1646
|
+
var end = dc.length; // default to end of the string
|
1647
|
+
var prefix = settings.name + '='; // search string for the cookie name given
|
1648
|
+
var begin = dc.indexOf('; ' + prefix);
|
1649
|
+
var content = '';
|
1650
|
+
|
1651
|
+
// collect the cookie content
|
1652
|
+
//
|
1653
|
+
// found, and not in the first position
|
1654
|
+
if (begin !== -1) {
|
1655
|
+
// exclude the "; "
|
1656
|
+
begin += 2;
|
1657
|
+
} else {
|
1658
|
+
// see if cookie is in first position
|
1659
|
+
begin = dc.indexOf(prefix);
|
1660
|
+
// not found at all or found as a portion of another cookie name
|
1661
|
+
if (begin === -1 || begin !== 0 ) return false;
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
// if ";" is found somewhere after the prefix position then "end" is
|
1665
|
+
// that position, otherwise it defaults to the end of the string
|
1666
|
+
if (dc.indexOf(';', begin) !== -1) {
|
1667
|
+
end = dc.indexOf(';', begin);
|
1668
|
+
}
|
1669
|
+
|
1670
|
+
// expire cookie to session
|
1671
|
+
content = decodeURI(dc.substring(begin + prefix.length, end) ).replace(/"/g, '');
|
1672
|
+
if (settings.secure) {
|
1673
|
+
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; secure';
|
1375
1674
|
} else {
|
1376
|
-
document.cookie = name + '
|
1675
|
+
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite;
|
1377
1676
|
}
|
1378
1677
|
|
1379
1678
|
return true;
|
1380
|
-
}, // END
|
1679
|
+
}, // END expireCookie
|
1381
1680
|
|
1382
1681
|
// -------------------------------------------------------------------------
|
1383
|
-
//
|
1682
|
+
// existsCookie (Vanilla JS)
|
1683
|
+
// returns true if a given cookie exists
|
1384
1684
|
// -------------------------------------------------------------------------
|
1385
1685
|
existsCookie: function (name) {
|
1386
1686
|
var dc = document.cookie;
|
1387
1687
|
var prefix = name + '=';
|
1388
1688
|
var begin = dc.indexOf('; ' + prefix);
|
1389
|
-
var end = dc.length;
|
1689
|
+
var end = dc.length; // default to end of the string
|
1390
1690
|
var cookieExists = false;
|
1391
1691
|
var cookieContent = '';
|
1392
1692
|
|
@@ -1479,11 +1779,11 @@ var j1 = (function () {
|
|
1479
1779
|
});
|
1480
1780
|
|
1481
1781
|
});
|
1482
|
-
logger.info('met dependencies for: sidebarLoaded');
|
1782
|
+
logger.info('\n' + 'met dependencies for: sidebarLoaded');
|
1483
1783
|
clearInterval(sidebarLoaded);
|
1484
1784
|
return true;
|
1485
1785
|
} else {
|
1486
|
-
logger.error('no user data provided');
|
1786
|
+
logger.error('\n' + 'no user data provided');
|
1487
1787
|
clearInterval(sidebarLoaded);
|
1488
1788
|
return false;
|
1489
1789
|
}
|
@@ -1537,11 +1837,11 @@ var j1 = (function () {
|
|
1537
1837
|
});
|
1538
1838
|
|
1539
1839
|
});
|
1540
|
-
logger.info('met dependencies for: sidebarLoaded');
|
1840
|
+
logger.info('\n' + 'met dependencies for: sidebarLoaded');
|
1541
1841
|
clearInterval(sidebarLoaded);
|
1542
1842
|
return true;
|
1543
1843
|
} else {
|
1544
|
-
logger.error('no user data provided');
|
1844
|
+
logger.error('\n' + 'no user data provided');
|
1545
1845
|
clearInterval(sidebarLoaded);
|
1546
1846
|
return false;
|
1547
1847
|
}
|
@@ -1580,11 +1880,11 @@ var j1 = (function () {
|
|
1580
1880
|
var json_message = JSON.stringify(message);
|
1581
1881
|
|
1582
1882
|
if ( receiver === 'j1' ) {
|
1583
|
-
logText = 'send message from ' + sender + ' to' + receiver + ': ' + json_message;
|
1883
|
+
logText = '\n' + 'send message from ' + sender + ' to' + receiver + ': ' + json_message;
|
1584
1884
|
logger.debug(logText);
|
1585
1885
|
executeFunctionByName('j1' + '.messageHandler', window, sender, message);
|
1586
1886
|
} else {
|
1587
|
-
logText = 'send message from ' + sender + ' to ' + receiver + ': ' + json_message;
|
1887
|
+
logText = '\n' + 'send message from ' + sender + ' to ' + receiver + ': ' + json_message;
|
1588
1888
|
logger.debug(logText);
|
1589
1889
|
//executeFunctionByName('j1.' + receiver + '.messageHandler', window, sender, message)
|
1590
1890
|
executeFunctionByName(receiver + '.messageHandler', window, sender, message);
|
@@ -1600,7 +1900,7 @@ var j1 = (function () {
|
|
1600
1900
|
// var json_message = JSON.stringify(message, undefined, 2); // multiline
|
1601
1901
|
var json_message = JSON.stringify(message);
|
1602
1902
|
|
1603
|
-
logText = 'received message from ' + sender + ': ' + json_message;
|
1903
|
+
logText = '\n' + 'received message from ' + sender + ': ' + json_message;
|
1604
1904
|
logger.debug(logText);
|
1605
1905
|
|
1606
1906
|
// -----------------------------------------------------------------------
|
@@ -1608,7 +1908,7 @@ var j1 = (function () {
|
|
1608
1908
|
// -----------------------------------------------------------------------
|
1609
1909
|
if ( message.type === 'command' && message.action === 'module_initialized' ) {
|
1610
1910
|
_this.setState('finished');
|
1611
|
-
logger.info(message.text);
|
1911
|
+
logger.info('\n' + message.text);
|
1612
1912
|
}
|
1613
1913
|
|
1614
1914
|
//
|
@@ -1671,7 +1971,7 @@ var j1 = (function () {
|
|
1671
1971
|
var bg_primary = j1.getStyleValue('bg-primary', 'background-color');
|
1672
1972
|
var bg_secondary = j1.getStyleValue('bg-secondary', 'background-color');
|
1673
1973
|
|
1674
|
-
logger.info('set color scheme for selected theme');
|
1974
|
+
logger.info('\n' + 'set color scheme for selected theme');
|
1675
1975
|
|
1676
1976
|
// globals
|
1677
1977
|
// -----------------------------------------------------------------------
|