j1-template 2022.0.4 → 2022.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_layouts/default.html +34 -75
- data/assets/error_pages/HTTP444.html +4 -4
- data/assets/error_pages/HTTP445.html +3 -3
- data/assets/error_pages/HTTP446.html +110 -0
- data/assets/themes/j1/adapter/js/cookieConsent.js +53 -25
- data/assets/themes/j1/adapter/js/j1.js +81 -196
- data/assets/themes/j1/adapter/js/themer.js +0 -1
- data/assets/themes/j1/adapter/js/translator.js +107 -56
- data/assets/themes/j1/core/css/themes/unodark/bootstrap.css +6 -0
- data/assets/themes/j1/core/css/themes/unodark/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/js/template.js +5 -6
- data/assets/themes/j1/core/js/template.min.js +1 -1
- data/assets/themes/j1/core/js/template.min.js.map +1 -1
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +29 -13
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +1 -1
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +0 -1
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
- data/assets/themes/j1/modules/translator/js/translator.js +98 -63
- data/assets/themes/j1/modules/translator/js/translator.min.js +1 -1
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +2 -3
- data/lib/starter_web/_data/modules/cookies.yml +30 -0
- data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +3 -3
- data/lib/starter_web/_data/modules/defaults/cookies.yml +103 -0
- data/lib/starter_web/_data/modules/navigator_menu.yml +10 -1
- data/lib/starter_web/_includes/attributes.asciidoc +6 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/_test_pages/google-translate-tester.1.adoc +0 -2
- data/lib/starter_web/pages/_test_pages/google-translate-tester.4.adoc +0 -2
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/100_converter.adoc +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/200_themes.adoc +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive.html +1 -1
- data/lib/starter_web/pages/public/blog/navigator/index.html +1 -1
- data/lib/starter_web/pages/public/learn/quickstart.adoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +2 -2
- data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/600_quicksearch.adoc +1 -1
- data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +2 -12
- data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +2 -12
- data/lib/starter_web/pages/public/manuals/dropdown-help.adoc +1 -1
- data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +1 -1
- data/lib/starter_web/pages/public/previewer/preview_bootstrap_theme.adoc +1 -1
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +5 -2
@@ -54,6 +54,9 @@ regenerate: true
|
|
54
54
|
{% assign footer_config_defaults = blocks.defaults.footer.defaults %}
|
55
55
|
{% assign toccer_defaults = modules.defaults.toccer.defaults %}
|
56
56
|
|
57
|
+
{% assign cookie_defaults = modules.defaults.cookies.defaults %}
|
58
|
+
{% assign cookie_settings = modules.cookies.settings %}
|
59
|
+
|
57
60
|
{% assign themer_defaults = modules.defaults.themer.defaults %}
|
58
61
|
{% assign themer_settings = modules.themer.settings %}
|
59
62
|
|
@@ -67,6 +70,7 @@ regenerate: true
|
|
67
70
|
-------------------------------------------------------------------------------- {% endcomment %}
|
68
71
|
{% assign toccer_options = toccer_defaults | merge: toccer_settings %}
|
69
72
|
{% assign themer_options = themer_defaults| merge: themer_settings %}
|
73
|
+
{% assign cookie_options = cookie_defaults | merge: cookie_settings %}
|
70
74
|
|
71
75
|
{% assign authentication_options = authentication_defaults | merge: authentication_settings %}
|
72
76
|
|
@@ -171,9 +175,6 @@ var j1 = (function () {
|
|
171
175
|
var comment_provider = '{{comment_provider}}';
|
172
176
|
var site_id = '{{site_id}}';
|
173
177
|
|
174
|
-
// Default translator settings (currently NOT supported)
|
175
|
-
// var translation_enabled = {{template_config.translation.enabled}};
|
176
|
-
|
177
178
|
var current_user_data;
|
178
179
|
var current_page;
|
179
180
|
var previous_page;
|
@@ -305,7 +306,7 @@ var j1 = (function () {
|
|
305
306
|
j1['xhrDOMState'] = {};
|
306
307
|
|
307
308
|
// -----------------------------------------------------------------------
|
308
|
-
//
|
309
|
+
// final updates before browser page|tab
|
309
310
|
// see: https://stackoverflow.com/questions/3888902/detect-browser-or-tab-closing
|
310
311
|
// -----------------------------------------------------------------------
|
311
312
|
window.addEventListener('beforeunload', function (event) {
|
@@ -318,52 +319,27 @@ var j1 = (function () {
|
|
318
319
|
var url;
|
319
320
|
var baseUrl;
|
320
321
|
|
321
|
-
// final update of the user state cookie
|
322
|
-
|
323
|
-
|
324
|
-
user_state.session_active = false;
|
325
|
-
user_state.last_session_ts = timestamp_now;
|
322
|
+
// final update of the user state cookie
|
323
|
+
user_state.session_active = false;
|
324
|
+
user_state.last_session_ts = timestamp_now;
|
326
325
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
});
|
337
|
-
if (!cookie_written) {
|
338
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
|
339
|
-
}
|
340
|
-
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
341
|
-
cookie_written = j1.writeCookie({
|
342
|
-
name: cookie_names.user_state,
|
343
|
-
data: user_state,
|
344
|
-
samesite: 'Strict',
|
345
|
-
secure: secure,
|
346
|
-
expires: 0
|
347
|
-
});
|
348
|
-
if (!cookie_written) {
|
349
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
|
350
|
-
}
|
351
|
-
} else {
|
352
|
-
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
353
|
-
cookie_written = j1.writeCookie({
|
354
|
-
name: cookie_names.user_state,
|
355
|
-
data: user_state,
|
356
|
-
samesite: 'Strict',
|
357
|
-
secure: secure,
|
358
|
-
expires: 365
|
359
|
-
});
|
360
|
-
if (!cookie_written) {
|
361
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
362
|
-
}
|
363
|
-
}
|
326
|
+
if (!user_consent.analysis || !user_consent.personalization) {
|
327
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
328
|
+
|
329
|
+
cookie_written = j1.writeCookie({
|
330
|
+
name: cookie_names.user_state,
|
331
|
+
data: user_state,
|
332
|
+
secure: secure,
|
333
|
+
expires: 0
|
334
|
+
});
|
364
335
|
} else {
|
365
|
-
|
366
|
-
|
336
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
337
|
+
cookie_written = j1.writeCookie({
|
338
|
+
name: cookie_names.user_state,
|
339
|
+
data: user_state,
|
340
|
+
secure: secure,
|
341
|
+
expires: 365
|
342
|
+
});
|
367
343
|
}
|
368
344
|
}); // END beforeunload
|
369
345
|
|
@@ -379,115 +355,35 @@ var j1 = (function () {
|
|
379
355
|
: cookie_written = j1.writeCookie({
|
380
356
|
name: cookie_names.user_session,
|
381
357
|
data: user_session,
|
382
|
-
samesite: 'Strict',
|
383
358
|
secure: secure,
|
384
359
|
expires: 0
|
385
360
|
});
|
386
|
-
if (!cookie_written) {
|
387
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
388
|
-
}
|
389
361
|
|
390
362
|
user_state = j1.existsCookie(cookie_names.user_state)
|
391
363
|
? j1.readCookie(cookie_names.user_state)
|
392
364
|
: cookie_written = j1.writeCookie({
|
393
365
|
name: cookie_names.user_state,
|
394
366
|
data: user_state,
|
395
|
-
samesite: 'Strict',
|
396
367
|
secure: secure,
|
397
368
|
expires: 365
|
398
369
|
});
|
399
|
-
if (!cookie_written) {
|
400
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
401
|
-
}
|
402
370
|
|
403
|
-
// jadams, 2021-
|
404
|
-
//
|
405
|
-
// TODO: Check if/why user state (cookie NOT created?) NOT initialized
|
406
|
-
// for what reason.
|
371
|
+
// jadams, 2021-12-06: Access to cookies for this site failed.
|
372
|
+
// Possibly, a third-party domain or an attacker tries to access it.
|
407
373
|
if (!user_state) {
|
408
|
-
logger.error('\n' + 'cookie not found: ' + cookie_names.user_state);
|
374
|
+
logger.error('\n' + 'Access to cookie failed or cookie not found: ' + cookie_names.user_state);
|
409
375
|
logger.debug('\n' + 'j1 cookies found:' + j1Cookies.length);
|
410
|
-
|
411
|
-
|
412
|
-
gaCookies.forEach(item => console.log('j1.core.switcher: ' + item));
|
413
|
-
user_state = j1.readCookie(cookie_names.user_state);
|
414
|
-
user_state.session_active = true;
|
376
|
+
// redirect to error page: blocked content
|
377
|
+
window.location.href = '/446.html';
|
415
378
|
}
|
416
379
|
|
417
380
|
if (!user_consent.analysis || !user_consent.personalization) {
|
418
|
-
//
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
data: user_state,
|
423
|
-
samesite: 'Strict',
|
424
|
-
secure: secure,
|
425
|
-
expires: 0
|
426
|
-
});
|
427
|
-
if (!cookie_written) {
|
428
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
429
|
-
}
|
430
|
-
} else {
|
431
|
-
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
432
|
-
cookie_written = j1.writeCookie({
|
433
|
-
name: cookie_names.user_state,
|
434
|
-
data: user_state,
|
435
|
-
samesite: 'Strict',
|
436
|
-
secure: secure,
|
437
|
-
expires: 365
|
438
|
-
});
|
439
|
-
if (!cookie_written) {
|
440
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
441
|
-
}
|
381
|
+
// expire permanent cookies to session
|
382
|
+
j1.expireCookie({ name: cookie_names.user_state });
|
383
|
+
j1.expireCookie({ name: cookie_names.user_consent });
|
384
|
+
j1.expireCookie({ name: cookie_names.user_translate });
|
442
385
|
}
|
443
386
|
|
444
|
-
// jadams, 2021-11-10: anchor links of type #void are used/managed
|
445
|
-
// by the FAB module. No geneneraL use for NOW.
|
446
|
-
// -----------------------------------------------------------------------
|
447
|
-
// initialize event handler for smooth scroll on in-page anchors
|
448
|
-
// $('a[href*=\\#]').on('click', function (event) {
|
449
|
-
// // ignore void links
|
450
|
-
// if (window.location.href.includes('#void')||this.href.includes('#void')) {
|
451
|
-
// return false;
|
452
|
-
// }
|
453
|
-
// // for external links, redirect to this page
|
454
|
-
// if (window.location.pathname !== this.pathname) {
|
455
|
-
// window.location.href = this.href;
|
456
|
-
// } else {
|
457
|
-
// // continue on in-page anchor
|
458
|
-
// var toccerScrollDuration = 300;
|
459
|
-
// var toccerScrollOffset = 10;
|
460
|
-
//
|
461
|
-
// // calculate offset value for correct (smooth) scroll position
|
462
|
-
// //
|
463
|
-
// var $pagehead = $('.attic');
|
464
|
-
// var $navbar = $('nav.navbar');
|
465
|
-
// var $adblock = $('#adblock');
|
466
|
-
// var navbarType = $navbar.hasClass('navbar-fixed') ? 'fixed' : 'scrolled';
|
467
|
-
// var fontSize = $('body').css('font-size').replace('px','');
|
468
|
-
// var start = window.pageYOffset;
|
469
|
-
// var l = parseInt(fontSize);
|
470
|
-
// var h = $pagehead.length ? $pagehead.height() : 0;
|
471
|
-
// var n = $navbar.length ? $navbar.height() : 0;
|
472
|
-
// var a = $adblock.length ? $adblock.height() : 0;
|
473
|
-
// var scrollOffset = navbarType == 'fixed' ? -1*(n + a + l) : -1*(h + n + a + l);
|
474
|
-
//
|
475
|
-
// // TODO: to be checked why this static offset (toccerScrollOffset)
|
476
|
-
// // is needed
|
477
|
-
// scrollOffset = scrollOffset + toccerScrollOffset;
|
478
|
-
//
|
479
|
-
// logger.debug('\n' + 'scroll to anchor: ' + this.hash);
|
480
|
-
// $("html, body").animate({
|
481
|
-
// scrollTop: $($(this).attr("href")).offset().top + scrollOffset + "px"
|
482
|
-
// }, {
|
483
|
-
// duration: toccerScrollDuration,
|
484
|
-
// easing: "swing"
|
485
|
-
// });
|
486
|
-
// // disable bubble up the event
|
487
|
-
// return false;
|
488
|
-
// } // End in-page link
|
489
|
-
// }); // END click event on anchors
|
490
|
-
|
491
387
|
// initialize event handler for window/history/back on <ESC>
|
492
388
|
// -----------------------------------------------------------------------
|
493
389
|
window.onkeyup = function (event) {
|
@@ -522,15 +418,10 @@ var j1 = (function () {
|
|
522
418
|
cookie_written = j1.writeCookie({
|
523
419
|
name: cookie_names.user_session,
|
524
420
|
data: user_session,
|
525
|
-
samesite: 'Strict',
|
526
421
|
secure: secure,
|
527
422
|
expires: 0
|
528
423
|
});
|
529
424
|
|
530
|
-
if (!cookie_written) {
|
531
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
532
|
-
}
|
533
|
-
|
534
425
|
j1.setState(curr_state);
|
535
426
|
logger.info('\n' + 'state: ' + j1.getState());
|
536
427
|
|
@@ -571,13 +462,9 @@ var j1 = (function () {
|
|
571
462
|
cookie_written = j1.writeCookie({
|
572
463
|
name: cookie_names.user_session,
|
573
464
|
data: user_session,
|
574
|
-
samesite: 'Strict',
|
575
465
|
secure: secure,
|
576
466
|
expires: 0
|
577
467
|
});
|
578
|
-
if (!cookie_written) {
|
579
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
580
|
-
}
|
581
468
|
|
582
469
|
j1.setState(curr_state);
|
583
470
|
logger.info('\n' + 'state: ' + j1.getState());
|
@@ -606,7 +493,8 @@ var j1 = (function () {
|
|
606
493
|
themeName = user_session.theme_name;
|
607
494
|
themeCss = user_session.theme_css;
|
608
495
|
|
609
|
-
//
|
496
|
+
// -----------------------------------------------------------------------
|
497
|
+
// Save last page access
|
610
498
|
// see: https://stackoverflow.com/questions/3528324/how-to-get-the-previous-url-in-javascript
|
611
499
|
// see: https://developer.mozilla.org/de/docs/Web/API/Window/history
|
612
500
|
//
|
@@ -634,15 +522,10 @@ var j1 = (function () {
|
|
634
522
|
cookie_written = j1.writeCookie({
|
635
523
|
name: cookie_names.user_session,
|
636
524
|
data: user_session,
|
637
|
-
samesite: 'Strict',
|
638
525
|
secure: secure,
|
639
526
|
expires: 0
|
640
527
|
});
|
641
528
|
|
642
|
-
if (!cookie_written) {
|
643
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
644
|
-
}
|
645
|
-
|
646
529
|
// NOTE: asynchronous calls should be rewitten to xhrData
|
647
530
|
// initialize page resources for blocks
|
648
531
|
j1.initBanner(settings);
|
@@ -651,20 +534,15 @@ var j1 = (function () {
|
|
651
534
|
|
652
535
|
state = 'running';
|
653
536
|
logger.info('\n' + 'state: ' + state);
|
654
|
-
// logger.info(logText);
|
655
537
|
|
656
538
|
user_session.timestamp = timestamp_now;
|
657
539
|
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
658
540
|
cookie_written = j1.writeCookie({
|
659
541
|
name: cookie_names.user_session,
|
660
542
|
data: user_session,
|
661
|
-
samesite: 'Strict',
|
662
543
|
secure: secure,
|
663
544
|
expires: 0
|
664
545
|
});
|
665
|
-
if (!cookie_written) {
|
666
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
667
|
-
}
|
668
546
|
|
669
547
|
// -----------------------------------------------------------------------
|
670
548
|
// additional BS helpers from j1.core
|
@@ -786,7 +664,6 @@ var j1 = (function () {
|
|
786
664
|
// initPanel()
|
787
665
|
// AJAX fetcher to load and place all panel used for a page
|
788
666
|
// -------------------------------------------------------------------------
|
789
|
-
// ToDo:
|
790
667
|
initPanel: function ( options ) {
|
791
668
|
var logger = log4javascript.getLogger('j1.initPanel');
|
792
669
|
var panel = [];
|
@@ -1007,20 +884,17 @@ var j1 = (function () {
|
|
1007
884
|
cookie_written = j1.writeCookie({
|
1008
885
|
name: cookie_names.user_session,
|
1009
886
|
data: user_session,
|
1010
|
-
samesite: 'Strict',
|
1011
887
|
secure: secure,
|
1012
888
|
expires: 0
|
1013
889
|
});
|
1014
|
-
if (!cookie_written) {
|
1015
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
1016
|
-
}
|
1017
890
|
|
1018
891
|
providerPermissions = user_session.provider_permissions;
|
1019
892
|
categoryAllowed = providerPermissions.includes(user_session.page_permission);
|
1020
893
|
|
894
|
+
// -------------------------------------------------------------------
|
1021
895
|
// check protected pages (applies for APP only)
|
1022
896
|
// make sure that protected pages are ALWAYS checked for permissions
|
1023
|
-
//
|
897
|
+
//
|
1024
898
|
if (
|
1025
899
|
j1.authEnabled() &&
|
1026
900
|
user_session.page_permission !== 'public' &&
|
@@ -1123,13 +997,7 @@ var j1 = (function () {
|
|
1123
997
|
$('#quickLinksCookieButton').css('display', 'none');
|
1124
998
|
}
|
1125
999
|
|
1126
|
-
//
|
1127
|
-
// if (translation_enabled) {
|
1128
|
-
// logger.info('\n' + 'translator detected: google');
|
1129
|
-
// logger.info('\n' + 'initialize language selector');
|
1130
|
-
// $('.goog-te-combo').addClass('form-control');
|
1131
|
-
// }
|
1132
|
-
|
1000
|
+
// -----------------------------------------------------------------
|
1133
1001
|
// show cc icon (currently NOT supported)
|
1134
1002
|
// $('#quickLinksControlCenterButton').css('display', 'block');
|
1135
1003
|
|
@@ -1301,20 +1169,9 @@ var j1 = (function () {
|
|
1301
1169
|
cookie_written = j1.writeCookie({
|
1302
1170
|
name: cookie_names.user_session,
|
1303
1171
|
data: user_session,
|
1304
|
-
samesite: 'Strict',
|
1305
1172
|
secure: secure,
|
1306
1173
|
expires: 0
|
1307
1174
|
});
|
1308
|
-
if (!cookie_written) {
|
1309
|
-
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
1310
|
-
}
|
1311
|
-
|
1312
|
-
// show|hide translator icon (currently NOT supported)
|
1313
|
-
// if (translation_enabled) {
|
1314
|
-
// logger.info('\n' + 'translator detected: google');
|
1315
|
-
// logger.info('\n' + 'initialize language selector');
|
1316
|
-
// $('.goog-te-combo').addClass('form-control');
|
1317
|
-
// }
|
1318
1175
|
|
1319
1176
|
// show cc icon (currently NOT supported)
|
1320
1177
|
// $('#quickLinksControlCenterButton').css('display', 'block');
|
@@ -1450,6 +1307,7 @@ var j1 = (function () {
|
|
1450
1307
|
|
1451
1308
|
return scrollOffset;
|
1452
1309
|
},
|
1310
|
+
|
1453
1311
|
// -------------------------------------------------------------------------
|
1454
1312
|
// scrollTo()
|
1455
1313
|
// Scrolls smooth to any anchor referenced by an page URL on
|
@@ -1754,25 +1612,29 @@ var j1 = (function () {
|
|
1754
1612
|
// context/HTTPS).
|
1755
1613
|
// -------------------------------------------------------------------------
|
1756
1614
|
writeCookie: function (options /*name, data, [path, expires, domain, samesite, http_only, secure]*/) {
|
1757
|
-
var date
|
1758
|
-
var timestamp_now
|
1759
|
-
var
|
1615
|
+
var date = new Date();
|
1616
|
+
var timestamp_now = date.toISOString()
|
1617
|
+
var url = new liteURL(window.location.href);
|
1618
|
+
var baseUrl = url.origin;;
|
1619
|
+
var hostname = url.hostname;
|
1620
|
+
var domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
|
1621
|
+
var domain_enabled = '{{cookie_options.domain}}';
|
1622
|
+
var cookie_data = {};
|
1760
1623
|
var data_json;
|
1761
1624
|
var data_encoded;
|
1762
1625
|
var expires;
|
1763
1626
|
var stringifiedAttributes = '';
|
1764
1627
|
|
1765
1628
|
var defaults = {
|
1766
|
-
data:
|
1767
|
-
name:
|
1768
|
-
path:
|
1769
|
-
expires:
|
1770
|
-
domain:
|
1771
|
-
samesite:
|
1772
|
-
http_only:
|
1773
|
-
secure:
|
1629
|
+
data: {},
|
1630
|
+
name: '',
|
1631
|
+
path: '{{cookie_options.path}}',
|
1632
|
+
expires: '{{cookie_options.expires}}',
|
1633
|
+
domain: 'localhost',
|
1634
|
+
samesite: '{{cookie_options.same_site}}',
|
1635
|
+
http_only: '{{cookie_options.http_only}}',
|
1636
|
+
secure: '{{cookie_options.secure}}'
|
1774
1637
|
};
|
1775
|
-
|
1776
1638
|
var settings = $.extend(defaults, options);
|
1777
1639
|
|
1778
1640
|
cookie_data.timestamp = timestamp_now;
|
@@ -1797,6 +1659,16 @@ var j1 = (function () {
|
|
1797
1659
|
|
1798
1660
|
stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
|
1799
1661
|
|
1662
|
+
// settings.domain = settings.domain ? '.' + domain : hostname;
|
1663
|
+
|
1664
|
+
if (domain != hostname) {
|
1665
|
+
settings.domain = domain_enabled ? '.' + domain : hostname;
|
1666
|
+
} else {
|
1667
|
+
settings.domain = hostname;
|
1668
|
+
}
|
1669
|
+
|
1670
|
+
stringifiedAttributes += '; ' + 'domain=' + settings.domain;
|
1671
|
+
|
1800
1672
|
if (settings.secure) {
|
1801
1673
|
stringifiedAttributes += '; ' + 'secure=' + settings.secure;
|
1802
1674
|
}
|
@@ -1868,13 +1740,26 @@ var j1 = (function () {
|
|
1868
1740
|
// to JavaScript. For that reason, attributes needs to be set explicitly.
|
1869
1741
|
// -------------------------------------------------------------------------
|
1870
1742
|
expireCookie: function (options /*name [,path, samesite, secure]*/) {
|
1743
|
+
var url = new liteURL(window.location.href);
|
1744
|
+
var baseUrl = url.origin;;
|
1745
|
+
var hostname = url.hostname;
|
1746
|
+
var domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
|
1747
|
+
var domain_enabled = '{{cookie_options.domain}}';
|
1748
|
+
|
1871
1749
|
var defaults = {
|
1872
1750
|
path: '/',
|
1873
|
-
samesite: '
|
1751
|
+
samesite: 'Lax',
|
1874
1752
|
secure: false
|
1875
1753
|
};
|
1754
|
+
|
1876
1755
|
var settings = $.extend(defaults, options);
|
1877
1756
|
|
1757
|
+
if (domain != hostname) {
|
1758
|
+
settings.domain = domain_enabled ? '.' + domain : hostname;
|
1759
|
+
} else {
|
1760
|
+
settings.domain = hostname;
|
1761
|
+
}
|
1762
|
+
|
1878
1763
|
var dc = document.cookie; // all cookies in page
|
1879
1764
|
var end = dc.length; // default to end of the string
|
1880
1765
|
var prefix = settings.name + '='; // search string for the cookie name given
|
@@ -1903,9 +1788,9 @@ var j1 = (function () {
|
|
1903
1788
|
// expire cookie to session
|
1904
1789
|
content = decodeURI(dc.substring(begin + prefix.length, end) ).replace(/"/g, '');
|
1905
1790
|
if (settings.secure) {
|
1906
|
-
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; secure';
|
1791
|
+
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; ' + 'Domain=' + settings.domain + '; secure' + '; ';
|
1907
1792
|
} else {
|
1908
|
-
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite;
|
1793
|
+
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; ' + 'Domain=' + settings.domain + '; ';
|
1909
1794
|
}
|
1910
1795
|
|
1911
1796
|
return true;
|