j1-template 2022.0.12 → 2022.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/themes/j1/adapter/js/advertising.js +65 -44
- data/assets/themes/j1/adapter/js/algolia.js +9 -9
- data/assets/themes/j1/adapter/js/analytics.js +46 -24
- data/assets/themes/j1/adapter/js/asciidoctor.js +9 -9
- data/assets/themes/j1/adapter/js/attic.js +9 -1
- data/assets/themes/j1/adapter/js/bmd.js +9 -10
- data/assets/themes/j1/adapter/js/carousel.js +9 -9
- data/assets/themes/j1/adapter/js/clipboard.js +9 -9
- data/assets/themes/j1/adapter/js/comments.js +31 -10
- data/assets/themes/j1/adapter/js/cookieConsent.js +73 -80
- data/assets/themes/j1/adapter/js/fab.js +10 -10
- data/assets/themes/j1/adapter/js/framer.js +59 -58
- data/assets/themes/j1/adapter/js/j1.js +166 -103
- data/assets/themes/j1/adapter/js/justifiedGallery.js +11 -10
- data/assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js +9 -9
- data/assets/themes/j1/adapter/js/lightbox.js +11 -4
- data/assets/themes/j1/adapter/js/logger.js +10 -3
- data/assets/themes/j1/adapter/js/mmenu.js +9 -9
- data/assets/themes/j1/adapter/js/navigator.js +9 -9
- data/assets/themes/j1/adapter/js/quicksearch.js +9 -9
- data/assets/themes/j1/adapter/js/rouge.js +9 -9
- data/assets/themes/j1/adapter/js/rtable.js +9 -9
- data/assets/themes/j1/adapter/js/rtextResizer.js +9 -9
- data/assets/themes/j1/adapter/js/scroller.js +12 -7
- data/assets/themes/j1/adapter/js/themer.js +11 -2
- data/assets/themes/j1/adapter/js/toccer.js +9 -9
- data/assets/themes/j1/adapter/js/translator.js +13 -16
- data/assets/themes/j1/core/css/vendor.css +6 -1
- data/assets/themes/j1/core/css/vendor.min.css +1 -1
- data/assets/themes/j1/core/js/template.js +4 -3
- 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/advertising/js/google/adInitializer.js +14 -4
- data/exe/j1 +31 -11
- data/lib/j1/commands/generate.rb +37 -36
- data/lib/j1/commands/help.rb +35 -0
- data/lib/j1/commands/patch.rb +81 -0
- data/lib/j1/commands/reset.rb +36 -0
- data/lib/j1/commands/setup.rb +126 -0
- data/lib/j1/commands/site.rb +27 -0
- data/lib/j1/external.rb +1 -1
- data/lib/j1/utils/exec_until_trap.rb +28 -0
- data/lib/j1/utils.rb +31 -0
- 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/layouts/home.ads.yml +262 -0
- data/lib/starter_web/_data/layouts/home.no-ads.yml +262 -0
- data/lib/starter_web/_data/layouts/home.yml +1 -1
- data/lib/starter_web/_data/modules/advertising.yml +1 -12
- data/lib/starter_web/_data/modules/analytics.yml +1 -1
- data/lib/starter_web/_data/modules/cookies.yml +5 -2
- data/lib/starter_web/_data/modules/defaults/advertising.yml +7 -8
- data/lib/starter_web/_data/modules/defaults/comments.yml +4 -4
- data/lib/starter_web/_data/modules/defaults/cookies.yml +106 -36
- data/lib/starter_web/_data/modules/defaults/themer.yml +3 -2
- data/lib/starter_web/_data/modules/themer.yml +2 -1
- data/lib/starter_web/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +1 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.adoc +1 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.ads.asciidoc +1 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.comments.asciidoc +1 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-02-01-site-generators.adoc +1 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-03-about-j1.adoc +1 -1
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-wiki-series.adoc +1 -1
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-wiki-series.adoc +1 -1
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-wiki-series.adoc +1 -1
- data/lib/starter_web/index.html +0 -3
- data/lib/starter_web/package.json +5 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/000_intro.adoc +1 -1
- 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/asciidoc_skeletons/documentation/documentation.adoc +1 -4
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +1 -4
- data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +1 -4
- data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +7 -7
- data/lib/starter_web/pages/public/manuals/dropdown-help.adoc +23 -2
- data/lib/starter_web/pages/public/previewer/preview_bootstrap_theme.adoc +100 -166
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +11 -3
@@ -60,8 +60,8 @@ regenerate: true
|
|
60
60
|
{% assign themer_defaults = modules.defaults.themer.defaults %}
|
61
61
|
{% assign themer_settings = modules.themer.settings %}
|
62
62
|
|
63
|
-
{% assign tracking_enabled =
|
64
|
-
{% assign tracking_id =
|
63
|
+
{% assign tracking_enabled = modules.analytics.enabled %}
|
64
|
+
{% assign tracking_id = modules.analytics.google.trackingID %}
|
65
65
|
|
66
66
|
{% assign authentication_defaults = modules.defaults.authentication.defaults %}
|
67
67
|
{% assign authentication_settings = modules.authentication.settings %}
|
@@ -134,24 +134,25 @@ var j1 = (function () {
|
|
134
134
|
// ---------------------------------------------------------------------------
|
135
135
|
// globals
|
136
136
|
// ---------------------------------------------------------------------------
|
137
|
-
var rePager
|
138
|
-
var environment
|
139
|
-
var moduleOptions
|
140
|
-
var j1_runtime_data
|
137
|
+
var rePager = new RegExp('navigator|dateview|tagview|archive');
|
138
|
+
var environment = '{{environment}}';
|
139
|
+
var moduleOptions = {};
|
140
|
+
var j1_runtime_data = {};
|
141
141
|
|
142
142
|
// Status information
|
143
|
-
var state
|
144
|
-
var mode
|
143
|
+
var state = 'not_started';
|
144
|
+
var mode = 'not_detected';
|
145
145
|
|
146
146
|
// Default tracking provider information
|
147
|
-
var tracking_enabled
|
148
|
-
var tracking_id
|
149
|
-
var tracking_id_valid
|
147
|
+
// var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
|
148
|
+
// var tracking_id = '{{tracking_id}}';
|
149
|
+
// var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
|
150
150
|
|
151
151
|
// Default comment provider information
|
152
|
-
var comment_provider
|
153
|
-
var site_id
|
154
|
-
var
|
152
|
+
var comment_provider = '{{comment_provider}}';
|
153
|
+
var site_id = '{{site_id}}';
|
154
|
+
var checkCookies = {{cookie_options.checkCookies}};
|
155
|
+
var expireCookiesOnRequiredOnly = ('{{cookie_options.expireCookiesOnRequiredOnly}}' === 'true') ? true: false;
|
155
156
|
|
156
157
|
var current_user_data;
|
157
158
|
var current_page;
|
@@ -252,7 +253,15 @@ var j1 = (function () {
|
|
252
253
|
init: function (options) {
|
253
254
|
|
254
255
|
// -----------------------------------------------------------------------
|
255
|
-
//
|
256
|
+
// Default module settings
|
257
|
+
// -----------------------------------------------------------------------
|
258
|
+
var settings = $.extend({
|
259
|
+
module_name: 'j1',
|
260
|
+
generated: '{{site.time}}'
|
261
|
+
}, options);
|
262
|
+
|
263
|
+
// -----------------------------------------------------------------------
|
264
|
+
// Global variable settings
|
256
265
|
// -----------------------------------------------------------------------
|
257
266
|
var logger = log4javascript.getLogger('j1.init');
|
258
267
|
var url = new liteURL(window.location.href);
|
@@ -264,18 +273,8 @@ var j1 = (function () {
|
|
264
273
|
var timestamp_now = date.toISOString();
|
265
274
|
var curr_state = 'started';
|
266
275
|
var gaCookies = j1.findCookie('_ga');
|
267
|
-
var j1Cookies = j1.findCookie('j1');
|
268
276
|
var themerOptions = $.extend({}, {{themer_options | replace: '=>', ':' | replace: 'nil', '""' }});
|
269
277
|
|
270
|
-
// -----------------------------------------------------------------------
|
271
|
-
// options loader
|
272
|
-
// -----------------------------------------------------------------------
|
273
|
-
var settings = $.extend({
|
274
|
-
foo: 'foo_option',
|
275
|
-
bar: 'bar_option'
|
276
|
-
},
|
277
|
-
options
|
278
|
-
);
|
279
278
|
// -----------------------------------------------------------------------
|
280
279
|
// status settings
|
281
280
|
// save status into the adapter object for (later) global access
|
@@ -346,22 +345,13 @@ var j1 = (function () {
|
|
346
345
|
expires: 365
|
347
346
|
});
|
348
347
|
|
349
|
-
// jadams, 2021-12-06: Check if access to cookies for this site failed.
|
350
|
-
// Possibly, a third-party domain or an attacker tries to access it.
|
351
|
-
if (check_cookies) {
|
352
|
-
if (!user_state) {
|
353
|
-
logger.error('\n' + 'Access to cookie failed or cookie not found: ' + cookie_names.user_state);
|
354
|
-
logger.debug('\n' + 'j1 cookies found:' + j1Cookies.length);
|
355
|
-
// redirect to error page: blocked content
|
356
|
-
window.location.href = '/446.html';
|
357
|
-
}
|
358
|
-
}
|
359
|
-
|
360
348
|
if (!user_consent.analysis || !user_consent.personalization) {
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
349
|
+
if (expireCookiesOnRequiredOnly) {
|
350
|
+
// expire permanent cookies to session
|
351
|
+
j1.expireCookie({ name: cookie_names.user_state });
|
352
|
+
j1.expireCookie({ name: cookie_names.user_consent });
|
353
|
+
j1.expireCookie({ name: cookie_names.user_translate });
|
354
|
+
}
|
365
355
|
}
|
366
356
|
|
367
357
|
// initialize event handler for window/history/back on <ESC>
|
@@ -900,6 +890,20 @@ var j1 = (function () {
|
|
900
890
|
// display page
|
901
891
|
$('#no_flicker').css('display', 'block');
|
902
892
|
|
893
|
+
// jadams, 2021-12-06: Check if access to cookies for this site failed.
|
894
|
+
// Possibly, a third-party domain or an attacker tries to access it.
|
895
|
+
if (checkCookies) {
|
896
|
+
var j1Cookies = j1.findCookie('j1');
|
897
|
+
if (!j1.existsCookie(cookie_names.user_state)) {
|
898
|
+
logger.error('\n' + 'Access to cookie failed or cookie not found: ' + cookie_names.user_state);
|
899
|
+
logger.info('\n' + 'j1 cookies found:' + j1Cookies.length);
|
900
|
+
// redirect to error page: blocked content
|
901
|
+
window.location.href = '/446.html';
|
902
|
+
} else {
|
903
|
+
logger.info('\n' + 'j1 cookies found:' + j1Cookies.length);
|
904
|
+
}
|
905
|
+
}
|
906
|
+
|
903
907
|
// manage Dropcaps if translation is enabled|disabled
|
904
908
|
// -----------------------------------------------------------------
|
905
909
|
if (user_translate.translationEnabled) {
|
@@ -1006,6 +1010,20 @@ var j1 = (function () {
|
|
1006
1010
|
// display the page loaded
|
1007
1011
|
$('#no_flicker').css('display', 'block');
|
1008
1012
|
|
1013
|
+
// jadams, 2021-12-06: Check if access to cookies for this site failed.
|
1014
|
+
// Possibly, a third-party domain or an attacker tries to access it.
|
1015
|
+
if (checkCookies) {
|
1016
|
+
var j1Cookies = j1.findCookie('j1');
|
1017
|
+
if (!j1.existsCookie(cookie_names.user_state)) {
|
1018
|
+
logger.error('\n' + 'Access to cookie failed or cookie not found: ' + cookie_names.user_state);
|
1019
|
+
logger.info('\n' + 'j1 cookies found:' + j1Cookies.length);
|
1020
|
+
// redirect to error page: blocked content
|
1021
|
+
window.location.href = '/446.html';
|
1022
|
+
} else {
|
1023
|
+
logger.info('\n' + 'j1 cookies found:' + j1Cookies.length);
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
|
1009
1027
|
// jadams, 2021-11-19: test code for 'tapTarget' of 'materializeCss'
|
1010
1028
|
// See:
|
1011
1029
|
// https://stackoverflow.com/questions/49422111/opening-tap-target-in-materialize-css-for-2-seconds
|
@@ -1509,22 +1527,19 @@ var j1 = (function () {
|
|
1509
1527
|
var baseUrl = url.origin;;
|
1510
1528
|
var hostname = url.hostname;
|
1511
1529
|
var auto_domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
|
1530
|
+
var auto_secure = (url.protocol.includes('https')) ? true : false;
|
1512
1531
|
var stringifiedAttributes = '';
|
1513
1532
|
var cookie_data = {};
|
1514
1533
|
var data_json;
|
1515
1534
|
var data_encoded;
|
1516
|
-
var expires;
|
1517
|
-
var domainAttribute;
|
1518
1535
|
|
1519
1536
|
var defaults = {
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
http_only: '{{cookie_options.http_only}}',
|
1527
|
-
secure: '{{cookie_options.secure}}'
|
1537
|
+
path: '{{cookie_options.path}}',
|
1538
|
+
expires: '{{cookie_options.expires}}',
|
1539
|
+
domain: ('{{cookie_options.domain}}' === 'false') ? false : '{{cookie_options.domain}}',
|
1540
|
+
samesite: '{{cookie_options.same_site}}',
|
1541
|
+
http_only: ('{{cookie_options.http_only}}' === 'true'),
|
1542
|
+
secure: ('{{cookie_options.secure}}' === 'false') ? false : '{{cookie_options.secure}}'
|
1528
1543
|
};
|
1529
1544
|
var settings = $.extend(defaults, options);
|
1530
1545
|
|
@@ -1547,6 +1562,8 @@ var j1 = (function () {
|
|
1547
1562
|
data_encoded = window.btoa(data_json);
|
1548
1563
|
}
|
1549
1564
|
|
1565
|
+
// collect the cookie attributes
|
1566
|
+
// -----------------------------------------------------------------------
|
1550
1567
|
stringifiedAttributes += '; ' + 'Path=' + settings.path;
|
1551
1568
|
|
1552
1569
|
if (settings.expires > 0) {
|
@@ -1559,20 +1576,23 @@ var j1 = (function () {
|
|
1559
1576
|
// set domain used by cookies
|
1560
1577
|
if (settings.domain) {
|
1561
1578
|
if (settings.domain == 'auto') {
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
domainAttribute = settings.domain;
|
1566
|
-
stringifiedAttributes += '; ' + 'Domain=' + domainAttribute;
|
1579
|
+
stringifiedAttributes += '; ' + 'Domain=' + auto_domain;
|
1580
|
+
} else {
|
1581
|
+
stringifiedAttributes += '; ' + 'Domain=' + settings.domain;
|
1567
1582
|
}
|
1568
1583
|
}
|
1569
1584
|
|
1570
|
-
|
1571
|
-
|
1585
|
+
// set secure attribute
|
1586
|
+
if (settings.secure) {
|
1587
|
+
if (settings.secure == 'auto') {
|
1588
|
+
stringifiedAttributes += '; ' + 'Secure=' + auto_secure;
|
1589
|
+
} else {
|
1590
|
+
stringifiedAttributes += '; ' + 'Secure=' + settings.secure;
|
1591
|
+
}
|
1572
1592
|
}
|
1573
1593
|
|
1574
1594
|
// write the cookie
|
1575
|
-
//
|
1595
|
+
// -----------------------------------------------------------------------
|
1576
1596
|
document.cookie = settings.name + '=' + data_encoded + stringifiedAttributes;
|
1577
1597
|
|
1578
1598
|
if (j1.existsCookie(settings.name)) {
|
@@ -1580,14 +1600,13 @@ var j1 = (function () {
|
|
1580
1600
|
} else {
|
1581
1601
|
return false;
|
1582
1602
|
}
|
1583
|
-
|
1584
1603
|
},
|
1585
1604
|
|
1586
1605
|
// -------------------------------------------------------------------------
|
1587
1606
|
// findCookie (Vanilla JS)
|
1588
|
-
// Search for cookies (
|
1589
|
-
// name.
|
1590
|
-
// as a partial like 'j1'
|
1607
|
+
// Search for cookies (by name) in the page header that matches a given
|
1608
|
+
// (name) string. A cookie name can be given as full name, like 'j1.user.state',
|
1609
|
+
// or as a partial like 'j1'
|
1591
1610
|
// Returns all names found as an array.
|
1592
1611
|
// -------------------------------------------------------------------------
|
1593
1612
|
// See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
|
@@ -1603,31 +1622,51 @@ var j1 = (function () {
|
|
1603
1622
|
// removeCookie (Vanilla JS)
|
1604
1623
|
// -------------------------------------------------------------------------
|
1605
1624
|
removeCookie: function (options /*name, [path, domain]*/) {
|
1606
|
-
var
|
1625
|
+
var url = new liteURL(window.location.href);
|
1626
|
+
var baseUrl = url.origin;;
|
1627
|
+
var hostname = url.hostname;
|
1628
|
+
var auto_domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
|
1629
|
+
var auto_secure = (url.protocol.includes('https')) ? true : false;
|
1630
|
+
var stringifiedAttributes = '';
|
1607
1631
|
|
1608
1632
|
var defaults = {
|
1609
1633
|
path: '{{cookie_options.path}}',
|
1610
|
-
expires: '
|
1611
|
-
domain: '{{cookie_options.domain}}',
|
1634
|
+
expires: 'Thu, 01 Jan 1970 00:00:00 UTC', // clear cookies by settting the expiry date in the PAST
|
1635
|
+
domain: ('{{cookie_options.domain}}' === 'false') ? false : '{{cookie_options.domain}}',
|
1612
1636
|
samesite: '{{cookie_options.same_site}}',
|
1613
|
-
http_only: '{{cookie_options.http_only}}',
|
1614
|
-
secure: '{{cookie_options.secure}}'
|
1637
|
+
http_only: ('{{cookie_options.http_only}}' === 'true'),
|
1638
|
+
secure: ('{{cookie_options.secure}}' === 'false') ? false : '{{cookie_options.secure}}'
|
1615
1639
|
};
|
1616
|
-
var
|
1640
|
+
var settings = $.extend(defaults, options);
|
1617
1641
|
|
1618
|
-
|
1642
|
+
// collect the cookie attributes
|
1643
|
+
// -----------------------------------------------------------------------
|
1644
|
+
stringifiedAttributes += '; ' + 'Path=' + settings.path;
|
1645
|
+
stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
|
1646
|
+
stringifiedAttributes += '; ' + 'Expires=' + settings.expires;
|
1619
1647
|
|
1620
1648
|
// set domain used by cookies
|
1621
|
-
if (settings.domain
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1649
|
+
if (settings.domain) {
|
1650
|
+
if (settings.domain == 'auto') {
|
1651
|
+
stringifiedAttributes += '; ' + 'Domain=' + auto_domain;
|
1652
|
+
} else if (typeof settings.domain == 'string') {
|
1653
|
+
stringifiedAttributes += '; ' + 'Domain=' + settings.domain;
|
1654
|
+
}
|
1655
|
+
}
|
1656
|
+
|
1657
|
+
// set secure attribute
|
1658
|
+
if (settings.secure) {
|
1659
|
+
if (settings.secure == 'auto') {
|
1660
|
+
stringifiedAttributes += '; ' + 'Secure=' + auto_secure;
|
1661
|
+
} else {
|
1662
|
+
stringifiedAttributes += '; ' + 'Secure=' + settings.secure;
|
1663
|
+
}
|
1626
1664
|
}
|
1627
1665
|
|
1666
|
+
// clear|remove the cookie if exists
|
1667
|
+
// -----------------------------------------------------------------------
|
1628
1668
|
if (j1.findCookie(settings.name)) {
|
1629
|
-
|
1630
|
-
document.cookie = settings.name + '=; Domain=' + domainAttribute + '; Expires=Thu, 01 Jan 1970 00:00:00 UTC; Path=/;';
|
1669
|
+
document.cookie = settings.name + '=;' + stringifiedAttributes;
|
1631
1670
|
return true;
|
1632
1671
|
} else {
|
1633
1672
|
return false;
|
@@ -1642,49 +1681,71 @@ var j1 = (function () {
|
|
1642
1681
|
// automatically by the browser if the last session (browser tab|window)
|
1643
1682
|
// is closed.
|
1644
1683
|
// -------------------------------------------------------------------------
|
1645
|
-
// expireCookie() returns 'true' if cookie is set successfully
|
1646
|
-
// otherwise 'false' (e.g NOT found)
|
1684
|
+
// expireCookie() returns 'true' if cookie is set successfully
|
1685
|
+
// (to session), otherwise 'false' (e.g. NOT found)
|
1647
1686
|
// -------------------------------------------------------------------------
|
1648
1687
|
// NOTE:
|
1649
1688
|
// See: https://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript
|
1689
|
+
//
|
1650
1690
|
// NOTE:
|
1651
1691
|
// There is NO way you could get a trace of Path, Domain and other
|
1652
1692
|
// attributes of cookies as they are only read by browsers and NOT shown
|
1653
|
-
// to JavaScript. For that reason, attributes needs to be set explicitly
|
1693
|
+
// to JavaScript. For that reason, attributes needs to be set explicitly
|
1694
|
+
// to already KNOWN values.
|
1695
|
+
//
|
1654
1696
|
// -------------------------------------------------------------------------
|
1655
1697
|
expireCookie: function (options /*name [,path, samesite, secure]*/) {
|
1656
|
-
var url
|
1657
|
-
var baseUrl
|
1658
|
-
var hostname
|
1659
|
-
var
|
1660
|
-
var
|
1698
|
+
var url = new liteURL(window.location.href);
|
1699
|
+
var baseUrl = url.origin;;
|
1700
|
+
var hostname = url.hostname;
|
1701
|
+
var auto_domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
|
1702
|
+
var auto_secure = (url.protocol.includes('https')) ? true : false;
|
1703
|
+
var stringifiedAttributes = '';
|
1661
1704
|
|
1662
1705
|
var defaults = {
|
1663
1706
|
path: '{{cookie_options.path}}',
|
1664
1707
|
expires: '{{cookie_options.expires}}',
|
1665
|
-
domain: '{{cookie_options.domain}}',
|
1708
|
+
domain: ('{{cookie_options.domain}}' === 'false') ? false : '{{cookie_options.domain}}',
|
1666
1709
|
samesite: '{{cookie_options.same_site}}',
|
1667
|
-
http_only: '{{cookie_options.http_only}}',
|
1668
|
-
secure: '{{cookie_options.secure}}'
|
1710
|
+
http_only: ('{{cookie_options.http_only}}' === 'true'),
|
1711
|
+
secure: ('{{cookie_options.secure}}' === 'false') ? false : '{{cookie_options.secure}}'
|
1669
1712
|
};
|
1670
1713
|
var settings = $.extend(defaults, options);
|
1671
1714
|
|
1715
|
+
// collect the cookie attributes
|
1716
|
+
// -----------------------------------------------------------------------
|
1717
|
+
stringifiedAttributes += '; ' + 'Path=' + settings.path;
|
1718
|
+
stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
|
1719
|
+
|
1672
1720
|
// set domain used by cookies
|
1673
|
-
if (settings.domain
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1721
|
+
if (settings.domain) {
|
1722
|
+
if (settings.domain == 'auto') {
|
1723
|
+
stringifiedAttributes += '; ' + 'Domain=' + auto_domain;
|
1724
|
+
} else if (typeof settings.domain == 'string') {
|
1725
|
+
if (settings.domain !== 'false') {
|
1726
|
+
stringifiedAttributes += '; ' + 'Domain=' + settings.domain;
|
1727
|
+
}
|
1728
|
+
}
|
1678
1729
|
}
|
1679
1730
|
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1731
|
+
// set secure attribute
|
1732
|
+
if (settings.secure) {
|
1733
|
+
if (settings.secure == 'auto') {
|
1734
|
+
stringifiedAttributes += '; ' + 'Secure=' + auto_secure;
|
1735
|
+
} else {
|
1736
|
+
stringifiedAttributes += '; ' + 'Secure=' + settings.secure;
|
1737
|
+
}
|
1738
|
+
}
|
1739
|
+
|
1740
|
+
var dc = document.cookie; // all cookies in page
|
1741
|
+
var end = dc.length; // default to end of the string
|
1742
|
+
var prefix = settings.name + '='; // search string for the cookie name given
|
1683
1743
|
var begin = dc.indexOf('; ' + prefix);
|
1684
1744
|
var content = '';
|
1685
1745
|
|
1686
1746
|
// collect the cookie content
|
1687
|
-
//
|
1747
|
+
// -----------------------------------------------------------------------
|
1748
|
+
|
1688
1749
|
// found, and not in the first position
|
1689
1750
|
if (begin !== -1) {
|
1690
1751
|
// exclude the "; "
|
@@ -1702,20 +1763,17 @@ var j1 = (function () {
|
|
1702
1763
|
end = dc.indexOf(';', begin);
|
1703
1764
|
}
|
1704
1765
|
|
1705
|
-
//
|
1766
|
+
// write the cookie content, expire to session
|
1767
|
+
// -----------------------------------------------------------------------
|
1706
1768
|
content = decodeURI(dc.substring(begin + prefix.length, end) ).replace(/"/g, '');
|
1707
|
-
|
1708
|
-
document.cookie = settings.name + '=' + content +'; Path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; ' + 'Domain=' + domainAttribute + '; Secure' + '; ';
|
1709
|
-
} else {
|
1710
|
-
document.cookie = settings.name + '=' + content +'; Path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; ' + 'Domain=' + domainAttribute + '; ';
|
1711
|
-
}
|
1769
|
+
document.cookie = settings.name + '=' + content + stringifiedAttributes;
|
1712
1770
|
|
1713
1771
|
return true;
|
1714
1772
|
},
|
1715
1773
|
|
1716
1774
|
// -------------------------------------------------------------------------
|
1717
1775
|
// existsCookie (Vanilla JS)
|
1718
|
-
// returns true if a given
|
1776
|
+
// returns true if a cookie of given name exists
|
1719
1777
|
// -------------------------------------------------------------------------
|
1720
1778
|
existsCookie: function (name) {
|
1721
1779
|
var dc = document.cookie;
|
@@ -1725,6 +1783,9 @@ var j1 = (function () {
|
|
1725
1783
|
var cookieExists = false;
|
1726
1784
|
var cookieContent = '';
|
1727
1785
|
|
1786
|
+
// collect the cookie content
|
1787
|
+
// -----------------------------------------------------------------------
|
1788
|
+
|
1728
1789
|
// found, and not in first position
|
1729
1790
|
if (begin !== -1) {
|
1730
1791
|
// exclude the "; "
|
@@ -1742,6 +1803,8 @@ var j1 = (function () {
|
|
1742
1803
|
end = dc.indexOf(';', begin);
|
1743
1804
|
}
|
1744
1805
|
|
1806
|
+
// check if the cookie exists
|
1807
|
+
// -----------------------------------------------------------------------
|
1745
1808
|
cookieContent = decodeURI(dc.substring(begin + prefix.length, end) ).replace(/"/g, '');
|
1746
1809
|
cookieExists = cookieContent.length ? true : false;
|
1747
1810
|
|
@@ -100,16 +100,6 @@ j1.adapter.justifiedGallery = (function (j1, window) {
|
|
100
100
|
// -------------------------------------------------------------------------
|
101
101
|
init: function (options) {
|
102
102
|
|
103
|
-
{% comment %} Set global variables
|
104
|
-
-------------------------------------------------------------------------- {% endcomment %}
|
105
|
-
_this = j1.adapter.justifiedGallery;
|
106
|
-
logger = log4javascript.getLogger('j1.adapter.justifiedGallery');
|
107
|
-
|
108
|
-
// initialize state flag
|
109
|
-
_this.setState('started');
|
110
|
-
logger.info('\n' + 'state: ' + _this.getState());
|
111
|
-
logger.info('\n' + 'module is being initialized');
|
112
|
-
|
113
103
|
// -----------------------------------------------------------------------
|
114
104
|
// Default module settings
|
115
105
|
// -----------------------------------------------------------------------
|
@@ -118,6 +108,17 @@ j1.adapter.justifiedGallery = (function (j1, window) {
|
|
118
108
|
generated: '{{site.time}}'
|
119
109
|
}, options);
|
120
110
|
|
111
|
+
// -----------------------------------------------------------------------
|
112
|
+
// Global variable settings
|
113
|
+
// -----------------------------------------------------------------------
|
114
|
+
_this = j1.adapter.justifiedGallery;
|
115
|
+
logger = log4javascript.getLogger('j1.adapter.justifiedGallery');
|
116
|
+
|
117
|
+
// initialize state flag
|
118
|
+
_this.setState('started');
|
119
|
+
logger.info('\n' + 'state: ' + _this.getState());
|
120
|
+
logger.info('\n' + 'module is being initialized');
|
121
|
+
|
121
122
|
{% comment %} Load module config from yml data
|
122
123
|
-------------------------------------------------------------------------- {% endcomment %}
|
123
124
|
// Load module DEFAULTS|CONFIG
|
@@ -111,7 +111,15 @@ j1.adapter.justifiedGalleryCustomizer = (function (j1, window) {
|
|
111
111
|
init: function (options) {
|
112
112
|
|
113
113
|
// -----------------------------------------------------------------------
|
114
|
-
//
|
114
|
+
// Default module settings
|
115
|
+
// -----------------------------------------------------------------------
|
116
|
+
var settings = $.extend({
|
117
|
+
module_name: 'j1.adapter.justifiedGalleryCustomizer',
|
118
|
+
generated: '{{site.time}}'
|
119
|
+
}, options);
|
120
|
+
|
121
|
+
// -----------------------------------------------------------------------
|
122
|
+
// Global variable settings
|
115
123
|
// -----------------------------------------------------------------------
|
116
124
|
_this = j1.adapter.justifiedGalleryCustomizer;
|
117
125
|
logger = log4javascript.getLogger('j1.adapter.justifiedGalleryCustomizer');
|
@@ -121,14 +129,6 @@ j1.adapter.justifiedGalleryCustomizer = (function (j1, window) {
|
|
121
129
|
logger.info('\n' + 'state: ' + _this.getState());
|
122
130
|
logger.info('\n' + 'module is being initialized');
|
123
131
|
|
124
|
-
// -----------------------------------------------------------------------
|
125
|
-
// Default module settings
|
126
|
-
// -----------------------------------------------------------------------
|
127
|
-
var settings = $.extend({
|
128
|
-
module_name: 'j1.adapter.justifiedGalleryCustomizer',
|
129
|
-
generated: '{{site.time}}'
|
130
|
-
}, options);
|
131
|
-
|
132
132
|
{% comment %} Load gallery config from yml data
|
133
133
|
-------------------------------------------------------------------------- {% endcomment %}
|
134
134
|
/* eslint-disable */
|
@@ -102,16 +102,23 @@ j1.adapter.lightbox = (function (j1, window) {
|
|
102
102
|
// -------------------------------------------------------------------------
|
103
103
|
// Initializer
|
104
104
|
// -------------------------------------------------------------------------
|
105
|
-
init: function () {
|
106
|
-
// initialize state flag
|
107
|
-
j1.adapter.lightbox.state = 'pending';
|
105
|
+
init: function (options) {
|
108
106
|
|
109
107
|
// -----------------------------------------------------------------------
|
110
|
-
//
|
108
|
+
// Default module settings
|
109
|
+
// -----------------------------------------------------------------------
|
110
|
+
var settings = $.extend({
|
111
|
+
module_name: 'j1.adapter.lightbox',
|
112
|
+
generated: '{{site.time}}'
|
113
|
+
}, options);
|
114
|
+
|
115
|
+
// -----------------------------------------------------------------------
|
116
|
+
// Global variable settings
|
111
117
|
// -----------------------------------------------------------------------
|
112
118
|
_this = j1.adapter.lightbox;
|
113
119
|
logger = log4javascript.getLogger('j1.adapter.lightbox');
|
114
120
|
|
121
|
+
j1.adapter.lightbox.state = 'pending';
|
115
122
|
_this.setState('started');
|
116
123
|
logger.info('\n' + 'state: ' + _this.getState());
|
117
124
|
logger.info('\n' + 'module is being initialized');
|
@@ -175,7 +175,14 @@ j1.adapter.logger = (function (j1, window) {
|
|
175
175
|
// initialize state flag
|
176
176
|
j1.adapter.logger.state = 'started';
|
177
177
|
|
178
|
-
//
|
178
|
+
// -----------------------------------------------------------------------
|
179
|
+
// Default module settings
|
180
|
+
// -----------------------------------------------------------------------
|
181
|
+
var settings = $.extend({
|
182
|
+
module_name: 'j1.adapter.logger',
|
183
|
+
generated: '{{site.time}}'
|
184
|
+
}, options);
|
185
|
+
|
179
186
|
/* eslint-disable */
|
180
187
|
loggerOptions = $.extend({}, {{logger_options | replace: '=>', ':' | replace: 'nil', '""'}});
|
181
188
|
utilServerOptions = $.extend({}, {{util_server_options | replace: '=>', ':' | replace: 'nil', '""'}});
|
@@ -183,8 +190,8 @@ j1.adapter.logger = (function (j1, window) {
|
|
183
190
|
ajaxAppenderOptions = loggerOptions.appenders[1].appender;
|
184
191
|
|
185
192
|
// -----------------------------------------------------------------------
|
186
|
-
//
|
187
|
-
//
|
193
|
+
// Global variable settings
|
194
|
+
// -----------------------------------------------------------------------
|
188
195
|
_this = j1.adapter.logger;
|
189
196
|
logger = log4javascript.getLogger('j1.adapter.logger');
|
190
197
|
|
@@ -135,7 +135,15 @@ j1.adapter.mmenu = (function (j1, window) {
|
|
135
135
|
init: function (options) {
|
136
136
|
|
137
137
|
// -----------------------------------------------------------------------
|
138
|
-
//
|
138
|
+
// Default module settings
|
139
|
+
// -----------------------------------------------------------------------
|
140
|
+
var settings = $.extend({
|
141
|
+
module_name: 'j1.adapter.mmenu',
|
142
|
+
generated: '{{site.time}}'
|
143
|
+
}, options);
|
144
|
+
|
145
|
+
// -----------------------------------------------------------------------
|
146
|
+
// Global variable settings
|
139
147
|
// -----------------------------------------------------------------------
|
140
148
|
_this = j1.adapter.mmenu;
|
141
149
|
logger = log4javascript.getLogger('j1.adapter.mmenu');
|
@@ -145,14 +153,6 @@ j1.adapter.mmenu = (function (j1, window) {
|
|
145
153
|
logger.info('\n' + 'state: ' + _this.getState());
|
146
154
|
logger.info('\n' + 'module is being initialized');
|
147
155
|
|
148
|
-
// -----------------------------------------------------------------------
|
149
|
-
// defaults
|
150
|
-
// -----------------------------------------------------------------------
|
151
|
-
var settings = $.extend({
|
152
|
-
module_name: 'j1.adapter.mmenu',
|
153
|
-
generated: '{{site.time}}'
|
154
|
-
}, options);
|
155
|
-
|
156
156
|
// -----------------------------------------------------------------------
|
157
157
|
// options loader
|
158
158
|
// -----------------------------------------------------------------------
|
@@ -202,7 +202,15 @@ j1.adapter.navigator = (function (j1, window) {
|
|
202
202
|
init: function (options) {
|
203
203
|
|
204
204
|
// -----------------------------------------------------------------------
|
205
|
-
//
|
205
|
+
// Default module settings
|
206
|
+
// -----------------------------------------------------------------------
|
207
|
+
var settings = $.extend({
|
208
|
+
module_name: 'j1.adapter.navigator',
|
209
|
+
generated: '{{site.time}}'
|
210
|
+
}, options);
|
211
|
+
|
212
|
+
// -----------------------------------------------------------------------
|
213
|
+
// Global variable settings
|
206
214
|
// -----------------------------------------------------------------------
|
207
215
|
_this = j1.adapter.navigator;
|
208
216
|
logger = log4javascript.getLogger('j1.adapter.navigator');
|
@@ -212,14 +220,6 @@ j1.adapter.navigator = (function (j1, window) {
|
|
212
220
|
logger.info('\n' + 'state: ' + _this.getState());
|
213
221
|
logger.info('\n' + 'module is being initialized');
|
214
222
|
|
215
|
-
// -----------------------------------------------------------------------
|
216
|
-
// defaults
|
217
|
-
// -----------------------------------------------------------------------
|
218
|
-
var settings = $.extend({
|
219
|
-
module_name: 'j1.adapter.navigator',
|
220
|
-
generated: '{{site.time}}'
|
221
|
-
}, options);
|
222
|
-
|
223
223
|
// -----------------------------------------------------------------------
|
224
224
|
// options loader
|
225
225
|
// -----------------------------------------------------------------------
|