j1-template 2021.1.11 → 2021.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/assets/themes/j1/adapter/js/cookieConsent.js +6 -22
- data/assets/themes/j1/adapter/js/j1.js +189 -86
- data/assets/themes/j1/adapter/js/themer.js +9 -7
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +14 -9
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +1 -0
- data/lib/starter_web/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a06e7a1afc748fb3e46ecd414787526660fbfbca1c1b144b9155756be344bca
|
4
|
+
data.tar.gz: 3dc366715975779e7a0feb554e5668d831405d0f4721969cc7cc8f972017667f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a21ef1eef607b721deb207a886514cc0ef239c13ed58af632c6840b610afbd4f84197e0d0b0ff8d0023b125f380c6ee3fa341502a8e8062b3b47454e79472855
|
7
|
+
data.tar.gz: 971468ca62b8d074d43b7dd2930b848b0196cb1bff076a2f98f4e2cb8b44e3413a2de0149dd5ae9d0b0adced874996206afa91f9bb008545e28b5eecbd78cbf1
|
@@ -154,6 +154,7 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
154
154
|
whitelisted: moduleOptions.whitelisted,
|
155
155
|
reloadPageOnChange: moduleOptions.reloadPageOnChange,
|
156
156
|
xhr_data_element: moduleOptions.xhr_data_element + '-' + moduleOptions.language,
|
157
|
+
sameSite: moduleOptions.sameSite,
|
157
158
|
postSelectionCallback: function () {j1.adapter.cookieConsent.cbCookie()}
|
158
159
|
});
|
159
160
|
|
@@ -265,38 +266,21 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
265
266
|
if (!user_agent.includes('iPad')) {
|
266
267
|
gaCookies.forEach(function (item) {
|
267
268
|
logger.warn('Delete GA cookie: ' + item);
|
268
|
-
j1.removeCookie(
|
269
|
+
j1.removeCookie(item);
|
269
270
|
});
|
270
271
|
}
|
271
272
|
}
|
272
|
-
|
273
273
|
if (!user_consent.analyses || !user_consent.personalization) {
|
274
274
|
// expire consent|state cookies to session
|
275
|
-
|
276
|
-
|
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
|
-
}
|
275
|
+
j1.expireCookie({ name: cookie_names.user_state });
|
276
|
+
j1.expireCookie({ name: cookie_names.user_consent });
|
292
277
|
}
|
293
|
-
|
294
|
-
if (moduleOptions.reloadPageOnChange) {
|
278
|
+
if (moduleOptions.reloadPageOnChange) {
|
295
279
|
// reload current page (skip cache)
|
296
280
|
location.reload(true);
|
297
281
|
}
|
298
|
-
} // END if tracking_enabled
|
299
282
|
|
283
|
+
} // END if tracking_enabled
|
300
284
|
} // END cbCookie
|
301
285
|
|
302
286
|
}; // END return
|
@@ -269,6 +269,8 @@ var j1 = (function () {
|
|
269
269
|
var url;
|
270
270
|
var baseUrl;
|
271
271
|
|
272
|
+
// final update of the user state cookie before browser page|tab
|
273
|
+
// get closed
|
272
274
|
if (user_state) {
|
273
275
|
user_state.session_active = false;
|
274
276
|
user_state.last_session_ts = timestamp_now;
|
@@ -277,7 +279,7 @@ var j1 = (function () {
|
|
277
279
|
// expire consent|state cookies to session
|
278
280
|
cookie_written = j1.writeCookie({
|
279
281
|
name: cookie_names.user_consent,
|
280
|
-
data:
|
282
|
+
data: user_consent,
|
281
283
|
samesite: 'Strict'
|
282
284
|
});
|
283
285
|
if (!cookie_written) {
|
@@ -305,7 +307,7 @@ var j1 = (function () {
|
|
305
307
|
} else {
|
306
308
|
// jadams, 2021-07-11: on beforeunload, a vaild state cookie
|
307
309
|
// is expected
|
308
|
-
logger.fatal('missing cookie detected
|
310
|
+
logger.fatal('missing cookie detected: ' + cookie_names.user_state);
|
309
311
|
}
|
310
312
|
}); // END beforeunload
|
311
313
|
|
@@ -344,7 +346,7 @@ var j1 = (function () {
|
|
344
346
|
// TODO: Check if/why user state (cookie NOT created?) NOT initialized
|
345
347
|
// for what reason.
|
346
348
|
if (!user_state) {
|
347
|
-
logger.
|
349
|
+
logger.error('cookie not found: ' + cookie_names.user_state);
|
348
350
|
user_state = j1.readCookie(cookie_names.user_state);
|
349
351
|
user_state.session_active = true;
|
350
352
|
}
|
@@ -1290,7 +1292,7 @@ var j1 = (function () {
|
|
1290
1292
|
}, // END xhrData
|
1291
1293
|
|
1292
1294
|
// -------------------------------------------------------------------------
|
1293
|
-
// readCookie()
|
1295
|
+
// readCookie (Vanilla JS)
|
1294
1296
|
// -------------------------------------------------------------------------
|
1295
1297
|
readCookie: function (name) {
|
1296
1298
|
var data;
|
@@ -1312,23 +1314,7 @@ var j1 = (function () {
|
|
1312
1314
|
}, // END readCookie
|
1313
1315
|
|
1314
1316
|
// -------------------------------------------------------------------------
|
1315
|
-
//
|
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.
|
1320
|
-
// -------------------------------------------------------------------------
|
1321
|
-
// See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
|
1322
|
-
// -------------------------------------------------------------------------
|
1323
|
-
findCookie: function (name) {
|
1324
|
-
var r=[];
|
1325
|
-
|
1326
|
-
document.cookie.replace(new RegExp(name + '[^= ]*', 'g'), function(a){ r.push(a.trim()); });
|
1327
|
-
return r;
|
1328
|
-
}, // END findCookie
|
1329
|
-
|
1330
|
-
// -------------------------------------------------------------------------
|
1331
|
-
// writeCookie()
|
1317
|
+
// writeCookie (Cookie lib)
|
1332
1318
|
// Write 'data' to a cookie 'name'. If not exists, the cookie gets
|
1333
1319
|
// created. Returns 'true' if cookie was written, otherwise 'false'.
|
1334
1320
|
// -------------------------------------------------------------------------
|
@@ -1354,57 +1340,121 @@ var j1 = (function () {
|
|
1354
1340
|
// context/HTTPS).
|
1355
1341
|
// -------------------------------------------------------------------------
|
1356
1342
|
//
|
1343
|
+
// writeCookie: function (options /*name, data, [path, expires, samesite, http_only, secure]*/) {
|
1344
|
+
// var defaults = {
|
1345
|
+
// data: {},
|
1346
|
+
// name: '',
|
1347
|
+
// path: '/',
|
1348
|
+
// expires: 0,
|
1349
|
+
// samesite: 'Lax',
|
1350
|
+
// http_only: false,
|
1351
|
+
// secure: false
|
1352
|
+
// };
|
1353
|
+
// var settings = $.extend(defaults, options);
|
1354
|
+
// var date = new Date();
|
1355
|
+
// var timestamp_now = date.toISOString();
|
1356
|
+
// var cookie_data = {};
|
1357
|
+
// var data_json;
|
1358
|
+
// var data_encoded;
|
1359
|
+
//
|
1360
|
+
// if (j1.existsCookie(settings.name)) {
|
1361
|
+
// cookie_data = j1.readCookie(settings.name);
|
1362
|
+
// cookie_data.timestamp = timestamp_now;
|
1363
|
+
// cookie_data = j1.mergeData(cookie_data, settings.data);
|
1364
|
+
// data_json = JSON.stringify( cookie_data );
|
1365
|
+
// data_encoded = window.btoa(data_json);
|
1366
|
+
//
|
1367
|
+
// if (settings.expires > 0) {
|
1368
|
+
// Cookies.set(settings.name, data_encoded, {
|
1369
|
+
// expires: settings.expires,
|
1370
|
+
// SameSite: settings.samesite
|
1371
|
+
// });
|
1372
|
+
// } else {
|
1373
|
+
// Cookies.set(settings.name, data_encoded, {
|
1374
|
+
// SameSite: settings.samesite
|
1375
|
+
// });
|
1376
|
+
// }
|
1377
|
+
// } else {
|
1378
|
+
// cookie_data = settings.data;
|
1379
|
+
// data_json = JSON.stringify(settings.data);
|
1380
|
+
// data_encoded = window.btoa(data_json);
|
1381
|
+
//
|
1382
|
+
// if (settings.expires > 0) {
|
1383
|
+
// Cookies.set(settings.name, data_encoded, {
|
1384
|
+
// expires: settings.expires,
|
1385
|
+
// SameSite: settings.samesite
|
1386
|
+
// });
|
1387
|
+
// } else {
|
1388
|
+
// Cookies.set(settings.name, data_encoded, {
|
1389
|
+
// SameSite: settings.samesite
|
1390
|
+
// });
|
1391
|
+
// }
|
1392
|
+
// }
|
1393
|
+
//
|
1394
|
+
// if (j1.existsCookie(settings.name)) {
|
1395
|
+
// return cookie_data;
|
1396
|
+
// } else {
|
1397
|
+
// return false;
|
1398
|
+
// }
|
1399
|
+
//
|
1400
|
+
// }, // END writeCookie
|
1401
|
+
|
1402
|
+
|
1357
1403
|
writeCookie: function (options /*name, data, [path, expires, samesite, http_only, secure]*/) {
|
1358
1404
|
var defaults = {
|
1359
1405
|
data: {},
|
1360
1406
|
name: '',
|
1361
1407
|
path: '/',
|
1362
1408
|
expires: 0,
|
1363
|
-
samesite: '
|
1409
|
+
samesite: 'Strict',
|
1364
1410
|
http_only: false,
|
1365
1411
|
secure: false
|
1366
1412
|
};
|
1367
1413
|
var settings = $.extend(defaults, options);
|
1414
|
+
|
1368
1415
|
var date = new Date();
|
1369
1416
|
var timestamp_now = date.toISOString();
|
1370
1417
|
var cookie_data = {};
|
1371
1418
|
var data_json;
|
1372
1419
|
var data_encoded;
|
1420
|
+
var expires;
|
1421
|
+
var stringifiedAttributes = '';
|
1422
|
+
|
1423
|
+
cookie_data.timestamp = timestamp_now;
|
1373
1424
|
|
1374
1425
|
if (j1.existsCookie(settings.name)) {
|
1375
|
-
cookie_data
|
1376
|
-
cookie_data.
|
1377
|
-
|
1378
|
-
|
1379
|
-
data_encoded = window.btoa(data_json);
|
1380
|
-
|
1381
|
-
if (settings.expires > 0) {
|
1382
|
-
Cookies.set(settings.name, data_encoded, {
|
1383
|
-
expires: settings.expires,
|
1384
|
-
SameSite: settings.samesite
|
1385
|
-
});
|
1386
|
-
} else {
|
1387
|
-
Cookies.set(settings.name, data_encoded, {
|
1388
|
-
SameSite: settings.samesite
|
1389
|
-
});
|
1390
|
-
}
|
1426
|
+
cookie_data = j1.readCookie(settings.name);
|
1427
|
+
cookie_data = j1.mergeData(cookie_data, settings.data);
|
1428
|
+
data_json = JSON.stringify( cookie_data );
|
1429
|
+
data_encoded = window.btoa(data_json);
|
1391
1430
|
} else {
|
1392
1431
|
cookie_data = settings.data;
|
1393
1432
|
data_json = JSON.stringify(settings.data);
|
1394
1433
|
data_encoded = window.btoa(data_json);
|
1434
|
+
}
|
1395
1435
|
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
SameSite: settings.samesite
|
1404
|
-
});
|
1405
|
-
}
|
1436
|
+
// if (settings.path !== '/') {
|
1437
|
+
stringifiedAttributes += '; ' + 'path=' + settings.path;
|
1438
|
+
// }
|
1439
|
+
|
1440
|
+
if (settings.expires > 0) {
|
1441
|
+
settings.expires = new Date(new Date() * 1 + settings.expires * 864e+5);
|
1442
|
+
stringifiedAttributes += '; ' + 'expires=' + settings.expires;
|
1406
1443
|
}
|
1407
1444
|
|
1445
|
+
// if (settings.samesite !== 'Strict') {
|
1446
|
+
stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
|
1447
|
+
// }
|
1448
|
+
|
1449
|
+
// stringify cookie attributes
|
1450
|
+
if (settings.secure) {
|
1451
|
+
stringifiedAttributes += '; ' + 'secure=' + settings.secure;
|
1452
|
+
// document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; secure';
|
1453
|
+
}
|
1454
|
+
|
1455
|
+
// write the cookie
|
1456
|
+
document.cookie = settings.name + '=' + data_encoded + stringifiedAttributes;
|
1457
|
+
|
1408
1458
|
if (j1.existsCookie(settings.name)) {
|
1409
1459
|
return cookie_data;
|
1410
1460
|
} else {
|
@@ -1414,63 +1464,116 @@ var j1 = (function () {
|
|
1414
1464
|
}, // END writeCookie
|
1415
1465
|
|
1416
1466
|
// -------------------------------------------------------------------------
|
1417
|
-
//
|
1418
|
-
//
|
1419
|
-
//
|
1420
|
-
//
|
1421
|
-
//
|
1467
|
+
// findCookie (Vanilla JS)
|
1468
|
+
// Search for cookies (names) in the page header that matches a given
|
1469
|
+
// name. Cookie name can be give as full name, like 'j1.user.state', or
|
1470
|
+
// as a partial like 'j1'
|
1471
|
+
// Returns all names found as an array.
|
1422
1472
|
// -------------------------------------------------------------------------
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
};
|
1429
|
-
var settings = $.extend(defaults, options);
|
1473
|
+
// See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
|
1474
|
+
// -------------------------------------------------------------------------
|
1475
|
+
findCookie: function (name) {
|
1476
|
+
var rCookie=[];
|
1477
|
+
document.cookie.replace(new RegExp(name + '[^= ]*', 'g'), function(a){ rCookie.push(a.trim()); });
|
1430
1478
|
|
1431
|
-
|
1479
|
+
return rCookie;
|
1480
|
+
}, // END findCookie
|
1432
1481
|
|
1482
|
+
// -------------------------------------------------------------------------
|
1483
|
+
// removeCookie (Vanilla JS)
|
1484
|
+
// -------------------------------------------------------------------------
|
1485
|
+
// removeCookie: function (options /*name [, path]*/) {
|
1486
|
+
// var cookieExists;
|
1487
|
+
// var defaults = {
|
1488
|
+
// name: '',
|
1489
|
+
// path: '/'
|
1490
|
+
// };
|
1491
|
+
// var settings = $.extend(defaults, options);
|
1492
|
+
//
|
1493
|
+
// Cookies.remove(settings.name, { path: settings.path });
|
1494
|
+
//
|
1495
|
+
// }, // END removeCookie
|
1496
|
+
removeCookie: function (name) {
|
1497
|
+
if (j1.findCookie(name)) {
|
1498
|
+
// clear cookie content and set expiry date in the past
|
1499
|
+
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
|
1500
|
+
return true;
|
1501
|
+
} else {
|
1502
|
+
return false;
|
1503
|
+
}
|
1433
1504
|
}, // END removeCookie
|
1434
1505
|
|
1435
1506
|
// -------------------------------------------------------------------------
|
1436
|
-
//
|
1437
|
-
//
|
1438
|
-
//
|
1439
|
-
//
|
1507
|
+
// expireCookie (Vanilla JS)
|
1508
|
+
// Expires given cookies by name except cookies set to httpOnly. For all
|
1509
|
+
// cookies the expiry date is REMOVED. This results in cookies are set
|
1510
|
+
// to 'session' for the expiry date. All session cookies are deleted
|
1511
|
+
// automatically by the browser if the last session (browser tab|window)
|
1512
|
+
// is closed.
|
1513
|
+
// -------------------------------------------------------------------------
|
1514
|
+
// expireCookie() returns 'true' if cookie is set successfully,
|
1515
|
+
// otherwise 'false' (e.g NOT found)
|
1516
|
+
// -------------------------------------------------------------------------
|
1517
|
+
// NOTE:
|
1440
1518
|
// See: https://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript
|
1519
|
+
// NOTE:
|
1520
|
+
// There is NO way you could get a trace of Path, Domain and other
|
1521
|
+
// attributes of cookies as they are only read by browsers and NOT shown
|
1522
|
+
// to JavaScript. For that reason, attributes needs to be set explicitly.
|
1441
1523
|
// -------------------------------------------------------------------------
|
1442
|
-
|
1443
|
-
var
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1524
|
+
expireCookie: function (options /*name [,path, samesite, secure]*/) {
|
1525
|
+
var defaults = {
|
1526
|
+
path: '/',
|
1527
|
+
samesite: 'Strict',
|
1528
|
+
secure: false
|
1529
|
+
};
|
1530
|
+
var settings = $.extend(defaults, options);
|
1531
|
+
|
1532
|
+
var dc = document.cookie; // all cookies in page
|
1533
|
+
var end = dc.length; // default to end of the string
|
1534
|
+
var prefix = settings.name + '='; // search string for the cookie name given
|
1535
|
+
var begin = dc.indexOf('; ' + prefix);
|
1536
|
+
var content = '';
|
1537
|
+
|
1538
|
+
// collect the cookie content
|
1539
|
+
//
|
1540
|
+
// found, and not in the first position
|
1541
|
+
if (begin !== -1) {
|
1542
|
+
// exclude the "; "
|
1543
|
+
begin += 2;
|
1544
|
+
} else {
|
1545
|
+
// see if cookie is in first position
|
1546
|
+
begin = dc.indexOf(prefix);
|
1547
|
+
// not found at all or found as a portion of another cookie name
|
1548
|
+
if (begin === -1 || begin !== 0 ) return false;
|
1549
|
+
}
|
1550
|
+
|
1551
|
+
// if ";" is found somewhere after the prefix position then "end" is
|
1552
|
+
// that position, otherwise it defaults to the end of the string
|
1553
|
+
if (dc.indexOf(';', begin) !== -1) {
|
1554
|
+
end = dc.indexOf(';', begin);
|
1555
|
+
}
|
1556
|
+
|
1557
|
+
// expire cookie to session
|
1558
|
+
content = decodeURI(dc.substring(begin + prefix.length, end) ).replace(/"/g, '');
|
1559
|
+
if (settings.secure) {
|
1560
|
+
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; secure';
|
1459
1561
|
} else {
|
1460
|
-
document.cookie = name + '
|
1562
|
+
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite;
|
1461
1563
|
}
|
1462
1564
|
|
1463
1565
|
return true;
|
1464
|
-
}, // END
|
1566
|
+
}, // END expireCookie
|
1465
1567
|
|
1466
1568
|
// -------------------------------------------------------------------------
|
1467
|
-
//
|
1569
|
+
// existsCookie (Vanilla JS)
|
1570
|
+
// returns true if a given cookie exists
|
1468
1571
|
// -------------------------------------------------------------------------
|
1469
1572
|
existsCookie: function (name) {
|
1470
1573
|
var dc = document.cookie;
|
1471
1574
|
var prefix = name + '=';
|
1472
1575
|
var begin = dc.indexOf('; ' + prefix);
|
1473
|
-
var end = dc.length;
|
1576
|
+
var end = dc.length; // default to end of the string
|
1474
1577
|
var cookieExists = false;
|
1475
1578
|
var cookieContent = '';
|
1476
1579
|
|
@@ -275,12 +275,11 @@ j1.adapter['themer'] = (function (j1, window) {
|
|
275
275
|
logger.info('themes detected as: disabled');
|
276
276
|
}
|
277
277
|
clearInterval(dependencies_met_user_state_available);
|
278
|
-
} else {
|
279
|
-
logger.info('wait for cookie to be loaded: ' + cookie_names.user_state);
|
280
278
|
}
|
279
|
+
|
281
280
|
if (interval_count > max_count) {
|
282
|
-
logger.error('interval max count
|
283
|
-
logger.error('check failed after: ' +
|
281
|
+
logger.error('interval max count reached: ' + max_count);
|
282
|
+
logger.error('check failed after: ' + max_count * 25 + ' ms');
|
284
283
|
logger.fatal('loading cookie failed: ' + cookie_names.user_state);
|
285
284
|
|
286
285
|
// for development only
|
@@ -289,10 +288,13 @@ j1.adapter['themer'] = (function (j1, window) {
|
|
289
288
|
j1Cookies.forEach(item => console.log('cookieConsent: ' + item));
|
290
289
|
}
|
291
290
|
|
292
|
-
// jadams, 2021-07-
|
291
|
+
// jadams, 2021-07-15: redirect to homepage
|
292
|
+
// NOTE: UNCLEAR why it is needed to create the user state
|
293
|
+
// cookie THIS way
|
293
294
|
//
|
294
|
-
logger.warn('redirect to
|
295
|
-
|
295
|
+
logger.warn('redirect to home page');
|
296
|
+
// window.location.href = error_page;
|
297
|
+
window.location.href = '/';
|
296
298
|
clearInterval(dependencies_met_user_state_available);
|
297
299
|
}
|
298
300
|
}, 25); // END dependencies_met_user_state_available
|
@@ -58,7 +58,8 @@ function BootstrapCookieConsent(props) {
|
|
58
58
|
cookieStorageDays: 365, // the duration the cookie configuration is stored on the client
|
59
59
|
postSelectionCallback: undefined, // callback function, called after the user has made his selection
|
60
60
|
whitelisted: [], // pages NO consent modal page is issued
|
61
|
-
xhr_data_element: ""
|
61
|
+
xhr_data_element: "", // container for the language-specific consent modal taken from /assets/data/cookieconsent.html
|
62
|
+
sameSite: "Strict" // restrict consent cookie to first-party, do NOT send cookie to other domains
|
62
63
|
}
|
63
64
|
|
64
65
|
for (var property in props) {
|
@@ -75,7 +76,7 @@ function BootstrapCookieConsent(props) {
|
|
75
76
|
}
|
76
77
|
|
77
78
|
var Cookie = {
|
78
|
-
set: function (name, value, days) {
|
79
|
+
set: function (name, value, days, samesite) {
|
79
80
|
var value_encoded = window.btoa(value);
|
80
81
|
var expires = "";
|
81
82
|
if (days) {
|
@@ -83,7 +84,7 @@ function BootstrapCookieConsent(props) {
|
|
83
84
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
84
85
|
expires = "; expires=" + date.toUTCString();
|
85
86
|
}
|
86
|
-
document.cookie = name + "=" + (value_encoded ||
|
87
|
+
document.cookie = name + "=" + (value_encoded || '') + expires + '; Path=/; SameSite=' + samesite + ';';
|
87
88
|
},
|
88
89
|
get: function (name) {
|
89
90
|
var nameEQ = name + "=";
|
@@ -238,21 +239,25 @@ function BootstrapCookieConsent(props) {
|
|
238
239
|
}
|
239
240
|
|
240
241
|
function agreeAll() {
|
241
|
-
Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(true)), self.props.cookieStorageDays);
|
242
|
+
Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(true)), self.props.cookieStorageDays, self.props.sameSite);
|
242
243
|
self.$modal.modal("hide");
|
243
244
|
}
|
244
245
|
|
245
246
|
function doNotAgree() {
|
246
|
-
Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(false)), self.props.cookieStorageDays);
|
247
|
-
|
248
|
-
//
|
249
|
-
|
247
|
+
Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(false)), self.props.cookieStorageDays, self.props.sameSite);
|
248
|
+
|
249
|
+
// jadams, 2021-07-15: all cookies NOT longer supported by j1.expireCookie
|
250
|
+
// TODO: Create loop over all cookies found in page
|
251
|
+
//
|
252
|
+
// logger.warn('expire all cookies');
|
253
|
+
// j1.expireCookie('all');
|
254
|
+
|
250
255
|
self.$modal.modal('hide')
|
251
256
|
j1.goHome();
|
252
257
|
}
|
253
258
|
|
254
259
|
function saveSettings() {
|
255
|
-
Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions()), self.props.cookieStorageDays);
|
260
|
+
Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions()), self.props.cookieStorageDays, self.props.sameSite);
|
256
261
|
self.$modal.modal("hide");
|
257
262
|
}
|
258
263
|
|
data/lib/j1/version.rb
CHANGED
data/lib/starter_web/Gemfile
CHANGED
@@ -54,7 +54,7 @@ gem 'jekyll', '~> 4.2'
|
|
54
54
|
|
55
55
|
# Theme Rubies, default: J1 Template (NOT used for the development system)
|
56
56
|
#
|
57
|
-
gem 'j1-template', '~> 2021.1.
|
57
|
+
gem 'j1-template', '~> 2021.1.12'
|
58
58
|
|
59
59
|
# ------------------------------------------------------------------------------
|
60
60
|
# PRODUCTION: Gem needed for the Jekyll and J1 prod environment
|
data/lib/starter_web/_config.yml
CHANGED
@@ -53,7 +53,7 @@ environment: production
|
|
53
53
|
# ------------------------------------------------------------------------------
|
54
54
|
# Sets the build version of J1 Template Gem
|
55
55
|
#
|
56
|
-
version: 2021.1.
|
56
|
+
version: 2021.1.12
|
57
57
|
|
58
58
|
# version
|
59
59
|
# ------------------------------------------------------------------------------
|
@@ -35,6 +35,7 @@ defaults:
|
|
35
35
|
postSelectionCallback: j1.adapter.cookieConsent.cbCookie # currently hardcoded
|
36
36
|
|
37
37
|
reloadPageOnChange: false # reload current page if user settings has been changed
|
38
|
+
sameSite: Strict # restrict consent cookie to first-party, do NOT send cookie to other domains
|
38
39
|
xhr_data_element: consent-data # container for the language-specific consent modal (taken from /assets/data/cookieconsent.html)
|
39
40
|
whitelisted: [ /pages/public/legal/en/privacy ] # pages NO consent issued, currently NOT supported
|
40
41
|
|
@@ -412,7 +412,7 @@ end::tables[]
|
|
412
412
|
// -----------------------------------------------------------------------------
|
413
413
|
tag::products[]
|
414
414
|
:j1--license: MIT License
|
415
|
-
:j1--version: 2021.1.
|
415
|
+
:j1--version: 2021.1.12
|
416
416
|
:j1--site-name: Jekyll One
|
417
417
|
end::products[]
|
418
418
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: j1-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2021.1.
|
4
|
+
version: 2021.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- juergen_jekyll_one
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|