j1-template 2021.1.10 → 2021.1.14
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 +4 -0
- 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 +60 -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 +537 -237
- 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 +58 -48
- 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 +149 -96
- 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 +2 -2
- data/assets/themes/j1/modules/lunrSearch/js/quicksearch.js +1 -1
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +74 -55
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +75 -57
- 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/j1_config.yml +22 -11
- data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +11 -9
- data/lib/starter_web/_data/modules/defaults/themer.yml +2 -0
- 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/assets/images/modules/attics/matthew-dockery-1920x1280.jpg +0 -0
- 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/quickstart.adoc +473 -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 +81 -20
- data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +34 -16
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +10 -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
@@ -39,6 +39,8 @@ regenerate: true
|
|
39
39
|
{% assign tracking_enabled = template_config.analytics.enabled %}
|
40
40
|
{% assign tracking_id = template_config.analytics.google.tracking_id %}
|
41
41
|
|
42
|
+
{% assign comment_provider = site.data.j1_config.comments.provider %}
|
43
|
+
|
42
44
|
{% comment %} Set config options
|
43
45
|
-------------------------------------------------------------------------------- {% endcomment %}
|
44
46
|
{% assign consent_options = consent_defaults | merge: consent_settings %}
|
@@ -78,19 +80,27 @@ regenerate: true
|
|
78
80
|
'use strict';
|
79
81
|
|
80
82
|
{% comment %} Main
|
81
|
-
|
83
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
82
84
|
j1.adapter['cookieConsent'] = (function (j1, window) {
|
83
85
|
|
84
86
|
var environment = '{{environment}}';
|
85
87
|
var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
|
86
88
|
var tracking_id = '{{tracking_id}}';
|
87
89
|
var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
|
90
|
+
var comment_provider = '{{comment_provider}}';
|
88
91
|
var moduleOptions = {};
|
89
92
|
var _this;
|
90
93
|
var $modal;
|
91
94
|
var user_cookie;
|
92
95
|
var logger;
|
96
|
+
var url;
|
97
|
+
var baseUrl;
|
98
|
+
var hostname;
|
99
|
+
var domain;
|
100
|
+
var cookie_domain;
|
101
|
+
var secure;
|
93
102
|
var logText;
|
103
|
+
var cookie_written;
|
94
104
|
|
95
105
|
// NOTE: RegEx for tracking_id: ^(G|UA|YT|MO)-[a-zA-Z0-9-]+$
|
96
106
|
// See: https://stackoverflow.com/questions/20411767/how-to-validate-google-analytics-tracking-id-using-a-javascript-function/20412153
|
@@ -112,8 +122,20 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
112
122
|
// -----------------------------------------------------------------------
|
113
123
|
// globals
|
114
124
|
// -----------------------------------------------------------------------
|
115
|
-
_this
|
116
|
-
logger
|
125
|
+
_this = j1.adapter.cookieConsent;
|
126
|
+
logger = log4javascript.getLogger('j1.adapter.cookieConsent');
|
127
|
+
url = new liteURL(window.location.href);
|
128
|
+
baseUrl = url.origin;
|
129
|
+
hostname = url.hostname;
|
130
|
+
domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
|
131
|
+
secure = (url.protocol.includes('https')) ? true : false;
|
132
|
+
|
133
|
+
// set domain used by cookies
|
134
|
+
if(domain !== 'localhost') {
|
135
|
+
cookie_domain = '.' + hostname;
|
136
|
+
} else {
|
137
|
+
cookie_domain = hostname;
|
138
|
+
}
|
117
139
|
|
118
140
|
// initialize state flag
|
119
141
|
_this.state = 'pending';
|
@@ -143,8 +165,8 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
143
165
|
var dependencies_met_page_ready = setInterval (function (options) {
|
144
166
|
if ( j1.getState() === 'finished' ) {
|
145
167
|
_this.setState('started');
|
146
|
-
logger.info('state: ' + _this.getState());
|
147
|
-
logger.info('module is being initialized');
|
168
|
+
logger.info('\n' + 'state: ' + _this.getState());
|
169
|
+
logger.info('\n' + 'module is being initialized');
|
148
170
|
|
149
171
|
j1.cookieConsent = new BootstrapCookieConsent({
|
150
172
|
contentURL: moduleOptions.contentURL,
|
@@ -153,12 +175,14 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
153
175
|
whitelisted: moduleOptions.whitelisted,
|
154
176
|
reloadPageOnChange: moduleOptions.reloadPageOnChange,
|
155
177
|
xhr_data_element: moduleOptions.xhr_data_element + '-' + moduleOptions.language,
|
178
|
+
sameSite: moduleOptions.sameSite,
|
179
|
+
secure: secure,
|
156
180
|
postSelectionCallback: function () {j1.adapter.cookieConsent.cbCookie()}
|
157
181
|
});
|
158
182
|
|
159
183
|
_this.setState('finished');
|
160
|
-
logger.info('state: ' + _this.getState());
|
161
|
-
logger.debug('module initialized successfully');
|
184
|
+
logger.info('\n' + 'state: ' + _this.getState());
|
185
|
+
logger.debug('\n' + 'module initialized successfully');
|
162
186
|
clearInterval(dependencies_met_page_ready);
|
163
187
|
}
|
164
188
|
});
|
@@ -171,7 +195,7 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
171
195
|
messageHandler: function (sender, message) {
|
172
196
|
var json_message = JSON.stringify(message, undefined, 2);
|
173
197
|
|
174
|
-
logText = 'received message from ' + sender + ': ' + json_message;
|
198
|
+
logText = '\n' + 'received message from ' + sender + ': ' + json_message;
|
175
199
|
logger.debug(logText);
|
176
200
|
|
177
201
|
// -----------------------------------------------------------------------
|
@@ -181,7 +205,7 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
181
205
|
//
|
182
206
|
// Place handling of command|action here
|
183
207
|
//
|
184
|
-
logger.info(message.text);
|
208
|
+
logger.info('\n' + message.text);
|
185
209
|
}
|
186
210
|
|
187
211
|
//
|
@@ -214,38 +238,39 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
214
238
|
// -------------------------------------------------------------------------
|
215
239
|
cbCookie: function () {
|
216
240
|
var gaCookies = j1.findCookie('_ga');
|
217
|
-
var
|
218
|
-
var
|
241
|
+
var j1Cookies = j1.findCookie('j1');
|
242
|
+
var cookie_names = j1.getCookieNames();
|
243
|
+
var user_state = j1.readCookie(cookie_names.user_state);
|
244
|
+
var user_consent = j1.readCookie(cookie_names.user_consent);
|
219
245
|
var json = JSON.stringify(user_consent);
|
220
246
|
var user_agent = platform.ua;
|
221
247
|
|
222
|
-
logger.info('
|
223
|
-
logger.info('
|
248
|
+
logger.info('\n' + 'entered post selection callback from CookieConsent');
|
249
|
+
logger.info('\n' + 'current values from CookieConsent: ' + json);
|
224
250
|
|
225
251
|
// enable cookie button if not visible
|
226
252
|
if ($('#quickLinksCookieButton').css('display') === 'none') {
|
227
253
|
$('#quickLinksCookieButton').css('display', 'block');
|
228
254
|
}
|
229
255
|
|
230
|
-
// jadams, 2021-07-11:
|
231
|
-
//
|
256
|
+
// jadams, 2021-07-11: moved to j1 adapter (displayPage)
|
232
257
|
// NOTE: Warning needs to be moved to another module
|
233
258
|
// because page is reloaded after selection
|
234
259
|
//
|
235
260
|
// if (tracking_enabled && !tracking_id_valid) {
|
236
|
-
// logger.error('tracking enabled, but invalid tracking id found: ' + tracking_id);
|
261
|
+
// logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
|
237
262
|
// } else {
|
238
|
-
// logger.warn('tracking enabled, tracking id found: ' + tracking_id);
|
263
|
+
// logger.warn('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
|
239
264
|
// }
|
240
265
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
266
|
+
logger.debug('\n' + 'j1 cookies found:' + j1Cookies.length);
|
267
|
+
j1Cookies.forEach(item => console.log('j1.core.switcher: ' + item));
|
268
|
+
logger.debug('\n' + 'ga cookies found:' + gaCookies.length);
|
269
|
+
gaCookies.forEach(item => console.log('j1.core.switcher: ' + item));
|
245
270
|
|
246
271
|
if (user_agent.includes('iPad')) {
|
247
|
-
logger.warn('
|
248
|
-
logger.warn('
|
272
|
+
logger.warn('\n' + 'product detected : ' + platform.product);
|
273
|
+
logger.warn('\n' + 'skip deleting (unwanted) cookies for this platform');
|
249
274
|
}
|
250
275
|
|
251
276
|
// Manage Google Analytics OptIn/Out
|
@@ -253,40 +278,34 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
|
|
253
278
|
if (tracking_enabled && tracking_id_valid) {
|
254
279
|
GTagOptIn.register(tracking_id);
|
255
280
|
if (user_consent.analyses) {
|
256
|
-
logger.info('
|
281
|
+
logger.info('\n' + 'enable: GA');
|
257
282
|
GTagOptIn.optIn();
|
258
283
|
} else {
|
259
|
-
logger.warn('
|
284
|
+
logger.warn('\n' + 'disable: GA');
|
260
285
|
GTagOptIn.optOut();
|
261
286
|
|
262
287
|
if (!user_agent.includes('iPad')) {
|
263
288
|
gaCookies.forEach(function (item) {
|
264
|
-
logger.warn('
|
265
|
-
j1.removeCookie({name: item,
|
289
|
+
logger.warn('\n' + 'delete GA cookie: ' + item);
|
290
|
+
j1.removeCookie({ name: item, domain: cookie_domain });
|
266
291
|
});
|
267
292
|
}
|
268
293
|
}
|
269
294
|
|
270
|
-
|
295
|
+
// Managing providers for personalization OptIn/Out (Comments|Ads)
|
296
|
+
// moved to J1 adapter
|
297
|
+
|
298
|
+
if (!user_consent.analyses || !user_consent.personalization) {
|
271
299
|
// expire consent|state cookies to session
|
272
|
-
j1.
|
273
|
-
|
274
|
-
data: user_state,
|
275
|
-
samesite: 'Strict'
|
276
|
-
});
|
277
|
-
j1.writeCookie({
|
278
|
-
name: 'j1.user.consent',
|
279
|
-
data: user_consent,
|
280
|
-
samesite: 'Strict'
|
281
|
-
});
|
300
|
+
j1.expireCookie({ name: cookie_names.user_state });
|
301
|
+
j1.expireCookie({ name: cookie_names.user_consent });
|
282
302
|
}
|
283
|
-
|
284
|
-
if (moduleOptions.reloadPageOnChange) {
|
303
|
+
if (moduleOptions.reloadPageOnChange) {
|
285
304
|
// reload current page (skip cache)
|
286
305
|
location.reload(true);
|
287
306
|
}
|
288
|
-
} // END if tracking_enabled
|
289
307
|
|
308
|
+
} // END if tracking_enabled
|
290
309
|
} // END cbCookie
|
291
310
|
|
292
311
|
}; // END return
|
@@ -127,8 +127,8 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
127
127
|
|
128
128
|
// initialize state flag
|
129
129
|
_this.setState('started');
|
130
|
-
logger.info('set module state to: ' + _this.getState());
|
131
|
-
logger.info('module is being initialized');
|
130
|
+
logger.info('\n' + 'set module state to: ' + _this.getState());
|
131
|
+
logger.info('\n' + 'module is being initialized');
|
132
132
|
|
133
133
|
// create settings object from frontmatterOptions
|
134
134
|
var frontmatterOptions = options != null ? $.extend({}, options) : {};
|
@@ -161,7 +161,7 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
161
161
|
|
162
162
|
var dependencies_met_navigator = setInterval(function() {
|
163
163
|
if (j1.adapter.navigator.getState() == 'finished') {
|
164
|
-
logger.info('met dependencies for: navigator');
|
164
|
+
logger.info('\n' + 'met dependencies for: navigator');
|
165
165
|
_this.famLoader(moduleOptions);
|
166
166
|
clearInterval(dependencies_met_navigator);
|
167
167
|
}
|
@@ -175,10 +175,10 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
175
175
|
famLoader: function (famOptions) {
|
176
176
|
|
177
177
|
_this.setState('loading');
|
178
|
-
logger.info('set module state to: ' + _this.getState());
|
179
|
-
logger.info('load HTML data for fam');
|
178
|
+
logger.info('\n' + 'set module state to: ' + _this.getState());
|
179
|
+
logger.info('\n' + 'load HTML data for fam');
|
180
180
|
|
181
|
-
j1.
|
181
|
+
j1.loadHTML({
|
182
182
|
xhr_container_id: famOptions.xhr_container_id,
|
183
183
|
xhr_data_path: famOptions.xhr_data_path,
|
184
184
|
xhr_data_element: famOptions.fam_menu_id },
|
@@ -192,15 +192,15 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
192
192
|
var dependencies_met_fam_initialized = setInterval (function () {
|
193
193
|
if (j1.xhrDOMState['#' + famOptions.xhr_container_id] == 'success' && j1.getState() == 'finished') {
|
194
194
|
_this.setState('loaded');
|
195
|
-
logger.info('set module state to: ' + _this.getState());
|
196
|
-
logger.info('HTML data for fam: ' + _this.getState());
|
195
|
+
logger.info('\n' + 'set module state to: ' + _this.getState());
|
196
|
+
logger.info('\n' + 'HTML data for fam: ' + _this.getState());
|
197
197
|
|
198
198
|
// _this.scrollSpy(famOptions);
|
199
199
|
_this.buttonInitializer(famOptions);
|
200
200
|
|
201
201
|
_this.setState('finished');
|
202
|
-
logger.info('state: ' + _this.getState());
|
203
|
-
logger.info('module initialized successfully');
|
202
|
+
logger.info('\n' + 'state: ' + _this.getState());
|
203
|
+
logger.info('\n' + 'module initialized successfully');
|
204
204
|
|
205
205
|
$('.fam-btn').show();
|
206
206
|
|
@@ -231,14 +231,14 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
231
231
|
//
|
232
232
|
$('a[href="#void"]').click(function(e) {
|
233
233
|
e.preventDefault ? e.preventDefault() : e.returnValue = false;
|
234
|
-
logger.info('bound click event to "#void", suppress default action');
|
234
|
+
logger.info('\n' + 'bound click event to "#void", suppress default action');
|
235
235
|
});
|
236
236
|
|
237
237
|
// check if multiple buttons detected
|
238
238
|
if ( famButtons.length == 1 ) {
|
239
239
|
_this.setState('processing');
|
240
|
-
logger.info('set module state to: ' + _this.getState());
|
241
|
-
logger.info('initialize fam menu');
|
240
|
+
logger.info('\n' + 'set module state to: ' + _this.getState());
|
241
|
+
logger.info('\n' + 'initialize fam menu');
|
242
242
|
|
243
243
|
actionButtonId = famButtons[0].firstElementChild.id;
|
244
244
|
actionMenuId = actionButtonId.replace('_button', '');
|
@@ -281,25 +281,25 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
281
281
|
eventHandler = item.event_handler;
|
282
282
|
// check if eventhandler configured is a SINGLE word
|
283
283
|
if (eventHandler.split(' ').length == 1) {
|
284
|
-
logger.info('register pre-configured eventhandler ' +eventHandler+ ' on id: #' + item.id);
|
284
|
+
logger.info('\n' + 'register pre-configured eventhandler ' +eventHandler+ ' on id: #' + item.id);
|
285
285
|
|
286
286
|
if ( eventHandler === 'open_mmenu_toc' ) {
|
287
287
|
if ($('#j1-toc-mgr').length) {
|
288
|
-
logger.info('found toc in page: enabled');
|
288
|
+
logger.info('\n' + 'found toc in page: enabled');
|
289
289
|
var dependencies_met_toccer_finished = setInterval (function () {
|
290
290
|
if ( j1.adapter.toccer.getState() == 'finished' ) {
|
291
|
-
logger.info('met dependencies for: toccer');
|
291
|
+
logger.info('\n' + 'met dependencies for: toccer');
|
292
292
|
|
293
293
|
// famOptions.mode === 'icon'
|
294
|
-
// ? logger.info('fam mode detected: icon')
|
295
|
-
// : logger.info('fam mode detected: menu');
|
294
|
+
// ? logger.info('\n' + 'fam mode detected: icon')
|
295
|
+
// : logger.info('\n' + 'fam mode detected: menu');
|
296
296
|
|
297
297
|
$('#open_mmenu_toc').show();
|
298
298
|
clearInterval(dependencies_met_toccer_finished);
|
299
299
|
}
|
300
300
|
}, 25); // END dependencies_met_toccer_finished
|
301
301
|
} else {
|
302
|
-
logger.info('found toc in page: disabled');
|
302
|
+
logger.info('\n' + 'found toc in page: disabled');
|
303
303
|
}
|
304
304
|
} else {
|
305
305
|
$('#' + item.id).show();
|
@@ -313,16 +313,16 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
313
313
|
});
|
314
314
|
});
|
315
315
|
} else {
|
316
|
-
logger.info('register custom eventhandler on id: #' + item.id);
|
316
|
+
logger.info('\n' + 'register custom eventhandler on id: #' + item.id);
|
317
317
|
}
|
318
318
|
} else {
|
319
319
|
// alert ('Creating Eventhandler failed on id: #' + item.id);
|
320
|
-
logger.error('
|
320
|
+
logger.error('\n' + 'creating Eventhandler failed on id: #' + item.id);
|
321
321
|
} // END if items (action buttons)
|
322
322
|
});
|
323
323
|
} else {
|
324
324
|
// single action, create FAB
|
325
|
-
logger.info('single action found for FAM, create: FAB');
|
325
|
+
logger.info('\n' + 'single action found for FAM, create: FAB');
|
326
326
|
|
327
327
|
// disable hover event (CSS)
|
328
328
|
// $actionButton.css({'pointer-events': 'none'})
|
@@ -331,7 +331,7 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
331
331
|
eventHandler = item.event_handler;
|
332
332
|
// check if eventhandler configured is a SINGLE word
|
333
333
|
if (eventHandler.split(' ').length == 1) {
|
334
|
-
logger.info('register pre-configured eventhandler ' +eventHandler+ ' on id: #' + actionButtonId);
|
334
|
+
logger.info('\n' + 'register pre-configured eventhandler ' +eventHandler+ ' on id: #' + actionButtonId);
|
335
335
|
|
336
336
|
if (eventHandler === 'scroll_to_top') {
|
337
337
|
// register click event
|
@@ -346,10 +346,10 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
346
346
|
if ( eventHandler === 'open_mmenu_toc' ) {
|
347
347
|
// check if toccer (toc_mgr) is available
|
348
348
|
if ($('#j1-toc-mgr').length) {
|
349
|
-
logger.info('found toc in page: enabled');
|
349
|
+
logger.info('\n' + 'found toc in page: enabled');
|
350
350
|
var dependencies_met_toccer_finished = setInterval (function () {
|
351
351
|
if ( j1.adapter.toccer.getState() == 'finished' ) {
|
352
|
-
logger.info('met dependencies for toccer: finished');
|
352
|
+
logger.info('\n' + 'met dependencies for toccer: finished');
|
353
353
|
// change the id of the $actionButton to the already
|
354
354
|
// registered id by mmenu adapter of ('open_mmenu_toc')
|
355
355
|
// to open the TOC sidebar
|
@@ -359,8 +359,8 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
359
359
|
}
|
360
360
|
}, 25); // END dependencies_met_toccer_finished
|
361
361
|
} else {
|
362
|
-
logger.info('found toc in page: disabled');
|
363
|
-
logger.info('eventhandler: disabled');
|
362
|
+
logger.info('\n' + 'found toc in page: disabled');
|
363
|
+
logger.info('\n' + 'eventhandler: disabled');
|
364
364
|
}
|
365
365
|
} // END if eventHandler == open_mmenu_toc
|
366
366
|
}
|
@@ -368,8 +368,8 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
368
368
|
} // END else
|
369
369
|
} else {
|
370
370
|
// alert ('Multiple FAM buttons found: ' + famButtons.length);
|
371
|
-
logger.error('
|
372
|
-
logger.info('FAM container set to hidden: ' + $famContainer);
|
371
|
+
logger.error('\n' + 'multiple FAM buttons found: ' + famButtons.length);
|
372
|
+
logger.info('\n' + 'FAM container set to hidden: ' + $famContainer);
|
373
373
|
$famContainer.hide();
|
374
374
|
} // END if famButton
|
375
375
|
}, // END buttonInitializer
|
@@ -573,7 +573,7 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
573
573
|
// var json_message = JSON.stringify(message, undefined, 2); // multiline
|
574
574
|
var json_message = JSON.stringify(message);
|
575
575
|
|
576
|
-
logText = 'received message from ' + sender + ': ' + json_message;
|
576
|
+
logText = '\n' + 'received message from ' + sender + ': ' + json_message;
|
577
577
|
logger.debug(logText);
|
578
578
|
|
579
579
|
// -----------------------------------------------------------------------
|
@@ -583,10 +583,10 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
583
583
|
//
|
584
584
|
// Place handling of command|action here
|
585
585
|
//
|
586
|
-
logger.info(message.text);
|
586
|
+
logger.info('\n' + message.text);
|
587
587
|
}
|
588
588
|
if (message.type === 'command' && message.action === 'status') {
|
589
|
-
logger.info('messageHandler: received - ' + message.action);
|
589
|
+
logger.info('\n' + 'messageHandler: received - ' + message.action);
|
590
590
|
}
|
591
591
|
|
592
592
|
//
|
@@ -645,8 +645,8 @@ j1.adapter['fam'] = (function (j1, window) {
|
|
645
645
|
? $famContainer.css('display','block')
|
646
646
|
: $famContainer.css('display','none');
|
647
647
|
|
648
|
-
// logger.debug('content pos detected as: ' + m + 'px');
|
649
|
-
// logger.debug('scroll pos detected as: ' + scrollPos + 'px');
|
648
|
+
// logger.debug('\n' + 'content pos detected as: ' + m + 'px');
|
649
|
+
// logger.debug('\n' + 'scroll pos detected as: ' + scrollPos + 'px');
|
650
650
|
}); // END setTop on scroll
|
651
651
|
|
652
652
|
}, // END scrollSpy
|
@@ -115,8 +115,8 @@ j1.adapter['framer'] = (function (j1, window) {
|
|
115
115
|
|
116
116
|
// initialize state flag
|
117
117
|
_this.setState('started');
|
118
|
-
logger.info('state: ' + _this.getState());
|
119
|
-
logger.info('module is being initialized');
|
118
|
+
logger.info('\n' + 'state: ' + _this.getState());
|
119
|
+
logger.info('\n' + 'module is being initialized');
|
120
120
|
|
121
121
|
// -----------------------------------------------------------------------
|
122
122
|
// Default module settings
|
@@ -160,8 +160,8 @@ j1.adapter['framer'] = (function (j1, window) {
|
|
160
160
|
});
|
161
161
|
|
162
162
|
_this.setState('finished');
|
163
|
-
logger.info('state: ' + _this.getState());
|
164
|
-
logger.info('initializing module finished');
|
163
|
+
logger.info('\n' + 'state: ' + _this.getState());
|
164
|
+
logger.info('\n' + 'initializing module finished');
|
165
165
|
|
166
166
|
clearInterval(dependencies_met_page_finished);
|
167
167
|
|
@@ -179,7 +179,7 @@ j1.adapter['framer'] = (function (j1, window) {
|
|
179
179
|
messageHandler: function (sender, message) {
|
180
180
|
var json_message = JSON.stringify(message, undefined, 2);
|
181
181
|
|
182
|
-
logText = 'received message from ' + sender + ': ' + json_message;
|
182
|
+
logText = '\n' + 'received message from ' + sender + ': ' + json_message;
|
183
183
|
logger.debug(logText);
|
184
184
|
|
185
185
|
// -----------------------------------------------------------------------
|
@@ -189,7 +189,7 @@ j1.adapter['framer'] = (function (j1, window) {
|
|
189
189
|
//
|
190
190
|
// Place handling of command|action here
|
191
191
|
//
|
192
|
-
logger.info(message.text);
|
192
|
+
logger.info('\n' + message.text);
|
193
193
|
}
|
194
194
|
|
195
195
|
//
|
@@ -75,6 +75,23 @@ regenerate: true
|
|
75
75
|
{% assign panel_data_path = panel_config_defaults.data_path %}
|
76
76
|
|
77
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 %}
|
78
95
|
|
79
96
|
{% assign production = false %}
|
80
97
|
{% if environment == 'prod' or environment == 'production' %}
|
@@ -124,11 +141,18 @@ var j1 = (function () {
|
|
124
141
|
var state = 'not_started';
|
125
142
|
var mode = 'not_detected';
|
126
143
|
|
127
|
-
//
|
144
|
+
// Default tracking provider information
|
128
145
|
var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
|
129
146
|
var tracking_id = '{{tracking_id}}';
|
130
147
|
var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
|
131
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
|
+
|
132
156
|
var current_user_data;
|
133
157
|
var current_page;
|
134
158
|
var previous_page;
|
@@ -136,9 +160,7 @@ var j1 = (function () {
|
|
136
160
|
var last_pager_url;
|
137
161
|
var app_detected;
|
138
162
|
var user_session_detected;
|
139
|
-
|
140
|
-
// Translatior settings (currently NOT supported)
|
141
|
-
// var translation_enabled = {{template_config.translation.enabled}};
|
163
|
+
var cookie_written;
|
142
164
|
|
143
165
|
// Theme information
|
144
166
|
var themeName;
|
@@ -164,7 +186,7 @@ var j1 = (function () {
|
|
164
186
|
var baseUrl;
|
165
187
|
var referrer;
|
166
188
|
|
167
|
-
// initial cookie
|
189
|
+
// initial cookie settings
|
168
190
|
var cookie_names = {
|
169
191
|
'app_session': '{{template_config.cookies.app_session}}',
|
170
192
|
'user_session': '{{template_config.cookies.user_session}}',
|
@@ -173,7 +195,7 @@ var j1 = (function () {
|
|
173
195
|
};
|
174
196
|
var user_session = {
|
175
197
|
'mode': 'web',
|
176
|
-
'writer': '
|
198
|
+
'writer': 'j1.adapter',
|
177
199
|
'locale': navigator.language || navigator.userLanguage,
|
178
200
|
'user_name': '{{template_config.user.user_name}}',
|
179
201
|
'provider': '{{template_config.user.provider}}',
|
@@ -189,10 +211,11 @@ var j1 = (function () {
|
|
189
211
|
'last_pager': '/pages/public/blog/navigator/'
|
190
212
|
};
|
191
213
|
var user_state = {
|
192
|
-
'
|
214
|
+
'writer': 'j1.adapter',
|
193
215
|
'theme_name': '',
|
216
|
+
'theme_css': '',
|
194
217
|
'theme_author': '',
|
195
|
-
'theme_version': '{{
|
218
|
+
'theme_version': '{{template_version}}',
|
196
219
|
'session_active': false,
|
197
220
|
'last_session_ts': ''
|
198
221
|
};
|
@@ -230,9 +253,14 @@ var j1 = (function () {
|
|
230
253
|
var logger = log4javascript.getLogger('j1.init');
|
231
254
|
var url = new liteURL(window.location.href);
|
232
255
|
var baseUrl = url.origin;
|
256
|
+
var hostname = url.hostname;
|
257
|
+
var domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
|
258
|
+
var secure = (url.protocol.includes('https')) ? true : false;
|
233
259
|
var date = new Date();
|
234
260
|
var timestamp_now = date.toISOString();
|
235
261
|
var curr_state = 'started';
|
262
|
+
var gaCookies = j1.findCookie('_ga');
|
263
|
+
var j1Cookies = j1.findCookie('j1');
|
236
264
|
|
237
265
|
// -----------------------------------------------------------------------
|
238
266
|
// options loader
|
@@ -266,30 +294,53 @@ var j1 = (function () {
|
|
266
294
|
var url;
|
267
295
|
var baseUrl;
|
268
296
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
297
|
+
// final update of the user state cookie before browser page|tab
|
298
|
+
// get closed
|
299
|
+
if (user_state) {
|
300
|
+
user_state.session_active = false;
|
301
|
+
user_state.last_session_ts = timestamp_now;
|
302
|
+
|
303
|
+
if (!user_consent.analyses || !user_consent.personalization) {
|
304
|
+
// rewrite consent|state cookies to session
|
305
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_consent);
|
306
|
+
cookie_written = j1.writeCookie({
|
307
|
+
name: cookie_names.user_consent,
|
308
|
+
data: user_consent,
|
309
|
+
samesite: 'Strict',
|
310
|
+
secure: secure,
|
311
|
+
expires: 0
|
312
|
+
});
|
313
|
+
if (!cookie_written) {
|
314
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
|
315
|
+
}
|
316
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
317
|
+
cookie_written = j1.writeCookie({
|
318
|
+
name: cookie_names.user_state,
|
319
|
+
data: user_state,
|
320
|
+
samesite: 'Strict',
|
321
|
+
secure: secure,
|
322
|
+
expires: 0
|
323
|
+
});
|
324
|
+
if (!cookie_written) {
|
325
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
|
326
|
+
}
|
327
|
+
} else {
|
328
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
329
|
+
cookie_written = j1.writeCookie({
|
330
|
+
name: cookie_names.user_state,
|
331
|
+
data: user_state,
|
332
|
+
samesite: 'Strict',
|
333
|
+
secure: secure,
|
334
|
+
expires: 365
|
335
|
+
});
|
336
|
+
if (!cookie_written) {
|
337
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
338
|
+
}
|
339
|
+
}
|
284
340
|
} else {
|
285
|
-
|
286
|
-
|
287
|
-
data: user_state,
|
288
|
-
samesite: 'Strict',
|
289
|
-
expires: 365
|
290
|
-
});
|
341
|
+
// jadams, 2021-07-11: on beforeunload, a user state cookie is expected
|
342
|
+
logger.error('\n' + 'missing cookie detected: ' + cookie_names.user_state);
|
291
343
|
}
|
292
|
-
|
293
344
|
}); // END beforeunload
|
294
345
|
|
295
346
|
// -----------------------------------------------------------------------
|
@@ -301,45 +352,69 @@ var j1 = (function () {
|
|
301
352
|
user_consent = j1.readCookie(cookie_names.user_consent);
|
302
353
|
user_session = j1.existsCookie(cookie_names.user_session)
|
303
354
|
? j1.readCookie(cookie_names.user_session)
|
304
|
-
: j1.writeCookie({
|
355
|
+
: cookie_written = j1.writeCookie({
|
305
356
|
name: cookie_names.user_session,
|
306
357
|
data: user_session,
|
307
|
-
samesite: 'Strict'
|
358
|
+
samesite: 'Strict',
|
359
|
+
secure: secure,
|
360
|
+
expires: 0
|
308
361
|
});
|
362
|
+
if (!cookie_written) {
|
363
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
364
|
+
}
|
309
365
|
|
310
366
|
user_state = j1.existsCookie(cookie_names.user_state)
|
311
367
|
? j1.readCookie(cookie_names.user_state)
|
312
|
-
: j1.writeCookie({
|
368
|
+
: cookie_written = j1.writeCookie({
|
313
369
|
name: cookie_names.user_state,
|
314
370
|
data: user_state,
|
315
371
|
samesite: 'Strict',
|
372
|
+
secure: secure,
|
316
373
|
expires: 365
|
317
374
|
});
|
375
|
+
if (!cookie_written) {
|
376
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
377
|
+
}
|
318
378
|
|
319
379
|
// jadams, 2021-07-11: Found situation that user_state NOT initialized
|
320
380
|
// correctly (user_state == false).
|
321
381
|
// TODO: Check if/why user state (cookie NOT created?) NOT initialized
|
322
382
|
// for what reason.
|
323
383
|
if (!user_state) {
|
324
|
-
logger.
|
384
|
+
logger.error('\n' + 'cookie not found: ' + cookie_names.user_state);
|
385
|
+
logger.debug('\n' + 'j1 cookies found:' + j1Cookies.length);
|
386
|
+
j1Cookies.forEach(item => console.log('j1.core.switcher: ' + item));
|
387
|
+
logger.debug('\n' + 'ga cookies found:' + gaCookies.length);
|
388
|
+
gaCookies.forEach(item => console.log('j1.core.switcher: ' + item));
|
325
389
|
user_state = j1.readCookie(cookie_names.user_state);
|
326
390
|
user_state.session_active = true;
|
327
391
|
}
|
328
392
|
|
329
393
|
if (!user_consent.analyses || !user_consent.personalization) {
|
330
|
-
//
|
331
|
-
|
394
|
+
// rewrite consent|state cookies to session
|
395
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
396
|
+
cookie_written = j1.writeCookie({
|
332
397
|
name: cookie_names.user_state,
|
333
398
|
data: user_state,
|
334
|
-
samesite: 'Strict'
|
399
|
+
samesite: 'Strict',
|
400
|
+
secure: secure,
|
401
|
+
expires: 0
|
335
402
|
});
|
403
|
+
if (!cookie_written) {
|
404
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
405
|
+
}
|
336
406
|
} else {
|
337
|
-
|
407
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
408
|
+
cookie_written = j1.writeCookie({
|
338
409
|
name: cookie_names.user_state,
|
339
410
|
data: user_state,
|
340
411
|
samesite: 'Strict',
|
412
|
+
secure: secure,
|
341
413
|
expires: 365
|
342
414
|
});
|
415
|
+
if (!cookie_written) {
|
416
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
417
|
+
}
|
343
418
|
}
|
344
419
|
|
345
420
|
// detect middleware (mode 'app') and update user session cookie
|
@@ -362,35 +437,43 @@ var j1 = (function () {
|
|
362
437
|
user_session.requested_page = window.location.pathname;
|
363
438
|
user_session.timestamp = timestamp_now;
|
364
439
|
user_session = j1.mergeData(user_session, data);
|
365
|
-
logText = 'mode detected: ' + user_session.mode;
|
440
|
+
logText = '\n' + 'mode detected: ' + user_session.mode;
|
366
441
|
|
367
442
|
logger.info(logText);
|
368
|
-
logger.info('update user session cookie');
|
369
|
-
|
443
|
+
logger.info('\n' + 'update user session cookie');
|
444
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
445
|
+
cookie_written = j1.writeCookie({
|
370
446
|
name: cookie_names.user_session,
|
371
447
|
data: user_session,
|
372
|
-
samesite: 'Strict'
|
448
|
+
samesite: 'Strict',
|
449
|
+
secure: secure,
|
450
|
+
expires: 0
|
373
451
|
});
|
452
|
+
|
453
|
+
if (!cookie_written) {
|
454
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
455
|
+
}
|
456
|
+
|
374
457
|
j1.setState(curr_state);
|
375
|
-
logger.info('state: ' + j1.getState());
|
458
|
+
logger.info('\n' + 'state: ' + j1.getState());
|
376
459
|
|
377
460
|
var dependencies_met_page_displayed = setInterval (function () {
|
378
461
|
if (j1.getState() == 'finished') {
|
379
462
|
if (j1.authEnabled()) {
|
380
463
|
if (user_session.authenticated === 'true') {
|
381
464
|
// set signout
|
382
|
-
logger.info('show signout icon');
|
465
|
+
logger.info('\n' + 'show signout icon');
|
383
466
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignOut');
|
384
467
|
$('#iconSignInOut').removeClass('mdi-login').addClass('mdi-logout');
|
385
468
|
} else {
|
386
469
|
// set signin
|
387
|
-
logger.info('show signin icon');
|
470
|
+
logger.info('\n' + 'show signin icon');
|
388
471
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignIn');
|
389
472
|
$('#iconSignInOut').removeClass('mdi-logout').addClass('mdi-login');
|
390
473
|
}
|
391
|
-
logger.info('authentication detected as: ' + user_session.authenticated);
|
474
|
+
logger.info('\n' + 'authentication detected as: ' + user_session.authenticated);
|
392
475
|
$('#quickLinksSignInOutButton').css('display', 'block');
|
393
|
-
logger.info('met dependencies for: j1');
|
476
|
+
logger.info('\n' + 'met dependencies for: j1');
|
394
477
|
clearInterval(dependencies_met_page_displayed);
|
395
478
|
}
|
396
479
|
}
|
@@ -404,34 +487,41 @@ var j1 = (function () {
|
|
404
487
|
user_session.mode = 'web';
|
405
488
|
user_session.requested_page = window.location.pathname;
|
406
489
|
user_session.timestamp = timestamp_now;
|
407
|
-
logText = 'mode detected: ' + user_session.mode;
|
490
|
+
logText = '\n' + 'mode detected: ' + user_session.mode;
|
408
491
|
|
409
492
|
logger.info(logText);
|
410
|
-
|
493
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
494
|
+
cookie_written = j1.writeCookie({
|
411
495
|
name: cookie_names.user_session,
|
412
496
|
data: user_session,
|
413
|
-
samesite: 'Strict'
|
497
|
+
samesite: 'Strict',
|
498
|
+
secure: secure,
|
499
|
+
expires: 0
|
414
500
|
});
|
501
|
+
if (!cookie_written) {
|
502
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
503
|
+
}
|
504
|
+
|
415
505
|
j1.setState(curr_state);
|
416
|
-
logger.info('state: ' + j1.getState());
|
506
|
+
logger.info('\n' + 'state: ' + j1.getState());
|
417
507
|
}, detectTimeout);
|
418
508
|
});
|
419
|
-
} else { //
|
509
|
+
} else { // web mode
|
420
510
|
state = 'started';
|
421
|
-
logger.info('state: ' + state);
|
422
|
-
logger.info('page is being initialized');
|
511
|
+
logger.info('\n' + 'state: ' + state);
|
512
|
+
logger.info('\n' + 'page is being initialized');
|
423
513
|
}
|
424
514
|
|
425
515
|
state = 'started';
|
426
|
-
logger.info('state: ' + state);
|
427
|
-
logger.info('page is being initialized');
|
516
|
+
logger.info('\n' + 'state: ' + state);
|
517
|
+
logger.info('\n' + 'page is being initialized');
|
428
518
|
|
429
519
|
if ( settings.scrollbar === 'false' ) {
|
430
520
|
$('body').addClass('hide-scrollbar');
|
431
521
|
$('html').addClass('hide-scrollbar-moz');
|
432
522
|
}
|
433
523
|
|
434
|
-
logger.info('read user state from cookie');
|
524
|
+
logger.info('\n' + 'read user state from cookie');
|
435
525
|
user_session = j1.readCookie(cookie_names.user_session);
|
436
526
|
|
437
527
|
// process|update user state cookie
|
@@ -461,13 +551,20 @@ var j1 = (function () {
|
|
461
551
|
last_pager = user_session.last_pager;
|
462
552
|
}
|
463
553
|
|
464
|
-
logger.info('update user session cookie');
|
465
|
-
|
554
|
+
logger.info('\n' + 'update user session cookie');
|
555
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
556
|
+
cookie_written = j1.writeCookie({
|
466
557
|
name: cookie_names.user_session,
|
467
558
|
data: user_session,
|
468
|
-
samesite: 'Strict'
|
559
|
+
samesite: 'Strict',
|
560
|
+
secure: secure,
|
561
|
+
expires: 0
|
469
562
|
});
|
470
563
|
|
564
|
+
if (!cookie_written) {
|
565
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
566
|
+
}
|
567
|
+
|
471
568
|
// NOTE: asynchronous calls should be rewitten to xhrData
|
472
569
|
// initialize page resources for blocks
|
473
570
|
j1.initBanner(settings);
|
@@ -475,15 +572,21 @@ var j1 = (function () {
|
|
475
572
|
j1.initFooter(settings);
|
476
573
|
|
477
574
|
state = 'running';
|
478
|
-
logger.info('state: ' + state);
|
479
|
-
logger.info(logText);
|
575
|
+
logger.info('\n' + 'state: ' + state);
|
576
|
+
// logger.info(logText);
|
480
577
|
|
481
578
|
user_session.timestamp = timestamp_now;
|
482
|
-
|
579
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
580
|
+
cookie_written = j1.writeCookie({
|
483
581
|
name: cookie_names.user_session,
|
484
582
|
data: user_session,
|
485
|
-
samesite: 'Strict'
|
583
|
+
samesite: 'Strict',
|
584
|
+
secure: secure,
|
585
|
+
expires: 0
|
486
586
|
});
|
587
|
+
if (!cookie_written) {
|
588
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
589
|
+
}
|
487
590
|
|
488
591
|
// -----------------------------------------------------------------------
|
489
592
|
// additional BS helpers from j1.core
|
@@ -514,20 +617,20 @@ var j1 = (function () {
|
|
514
617
|
return function ( responseTxt, statusTxt, xhr ) {
|
515
618
|
if ( statusTxt == 'success' ) {
|
516
619
|
var logger = log4javascript.getLogger('j1.adapter.xhrData');
|
517
|
-
logText = 'loading banner completed on id: ' +banner_id;
|
620
|
+
logText = '\n' + 'loading banner completed on id: ' +banner_id;
|
518
621
|
logger.info(logText);
|
519
622
|
j1.setXhrDataState(banner_id, statusTxt);
|
520
623
|
j1.setXhrDomState(banner_id, statusTxt);
|
521
|
-
logger.info('XHR data loaded in the DOM: ' + banner_id);
|
624
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + banner_id);
|
522
625
|
}
|
523
626
|
if ( statusTxt == 'error' ) {
|
524
|
-
logText = 'loading banner failed on id: ' +banner_id+ ', error: ' + xhr.status + ': ' + xhr.statusText;
|
627
|
+
logText = '\n' + 'loading banner failed on id: ' +banner_id+ ', error: ' + xhr.status + ': ' + xhr.statusText;
|
525
628
|
logger.error(logText);
|
526
629
|
j1.setXhrDataState(banner_id, statusTxt);
|
527
630
|
j1.setXhrDomState(banner_id, statusTxt);
|
528
631
|
// Set|Log status
|
529
632
|
state = 'failed';
|
530
|
-
logger.error('state: ' + state);
|
633
|
+
logger.error('\n' + 'state: ' + state);
|
531
634
|
}
|
532
635
|
};
|
533
636
|
};
|
@@ -588,15 +691,15 @@ var j1 = (function () {
|
|
588
691
|
var id = '#' + banner[i];
|
589
692
|
var selector = $(id);
|
590
693
|
if (selector.length) {
|
591
|
-
logText = 'loading banner on id: ' +banner[i];
|
694
|
+
logText = '\n' + 'loading banner on id: ' +banner[i];
|
592
695
|
logger.info(logText);
|
593
696
|
var banner_data_path = '{{banner_data_path}} ' + id;
|
594
697
|
selector.load(banner_data_path, cb_load_closure(id));
|
595
698
|
}
|
596
699
|
} // END for
|
597
700
|
} else {
|
598
|
-
logText = 'no banner found in site';
|
599
|
-
logger.
|
701
|
+
logText = '\n' + 'no banner found in site';
|
702
|
+
logger.warn(logText);
|
600
703
|
return false;
|
601
704
|
}
|
602
705
|
return true;
|
@@ -625,20 +728,20 @@ var j1 = (function () {
|
|
625
728
|
return function ( responseTxt, statusTxt, xhr ) {
|
626
729
|
var logger = log4javascript.getLogger('j1.adapter.xhrData');
|
627
730
|
if ( statusTxt == 'success' ) {
|
628
|
-
logText = 'loading panel completed on id: ' +panel_id;
|
731
|
+
logText = '\n' + 'loading panel completed on id: ' +panel_id;
|
629
732
|
logger.info(logText);
|
630
733
|
j1.setXhrDataState(panel_id, statusTxt);
|
631
734
|
j1.setXhrDomState(panel_id, statusTxt);
|
632
|
-
logger.info('XHR data loaded in the DOM: ' + panel_id);
|
735
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + panel_id);
|
633
736
|
}
|
634
737
|
if ( statusTxt == 'error' ) {
|
635
|
-
logText = 'loading panel failed on id: ' +panel_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
738
|
+
logText = '\n' + 'loading panel failed on id: ' +panel_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
636
739
|
logger.error(logText);
|
637
740
|
j1.setXhrDataState(panel_id, statusTxt);
|
638
741
|
j1.setXhrDomState(panel_id, statusTxt);
|
639
742
|
// Set|Log status
|
640
743
|
state = 'Error';
|
641
|
-
logger.error('state: ' + state);
|
744
|
+
logger.error('\n' + 'state: ' + state);
|
642
745
|
}
|
643
746
|
};
|
644
747
|
};
|
@@ -691,15 +794,15 @@ var j1 = (function () {
|
|
691
794
|
var id = '#' + panel[i];
|
692
795
|
var selector = $(id);
|
693
796
|
if ( selector.length ) {
|
694
|
-
logText = 'loading panel on id: ' +panel[i];
|
797
|
+
logText = '\n' + 'loading panel on id: ' +panel[i];
|
695
798
|
logger.info(logText);
|
696
799
|
var panel_data_path = '{{panel_data_path}} ' + id;
|
697
800
|
selector.load(panel_data_path, cb_load_closure(id));
|
698
801
|
}
|
699
802
|
} // END for
|
700
803
|
} else {
|
701
|
-
logText = 'no panel found in site';
|
702
|
-
logger.
|
804
|
+
logText = '\n' + 'no panel found in site';
|
805
|
+
logger.warn(logText);
|
703
806
|
return false;
|
704
807
|
}
|
705
808
|
return true;
|
@@ -714,31 +817,31 @@ var j1 = (function () {
|
|
714
817
|
var mod = 'j1';
|
715
818
|
var logText;
|
716
819
|
|
717
|
-
logText = 'loading footer started';
|
820
|
+
logText = '\n' + 'loading footer started';
|
718
821
|
logger.info(logText);
|
719
822
|
|
720
823
|
var cb_load_closure = function(footer_id) {
|
721
824
|
return function ( responseTxt, statusTxt, xhr ) {
|
722
825
|
var logger = log4javascript.getLogger('j1.adapter.xhrData');
|
723
826
|
if ( statusTxt == 'success' ) {
|
724
|
-
logText = 'footer loaded successfully on id: ' + footer_id;
|
827
|
+
logText = '\n' + 'footer loaded successfully on id: ' + footer_id;
|
725
828
|
logger.info(logText);
|
726
829
|
j1.setXhrDataState(footer_id, statusTxt);
|
727
830
|
j1.setXhrDomState(footer_id, statusTxt);
|
728
|
-
logger.info('XHR data loaded in the DOM: ' + footer_id);
|
729
|
-
logText = 'initialization finished';
|
831
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + footer_id);
|
832
|
+
logText = '\n' + 'initialization finished';
|
730
833
|
logger.info(logText);
|
731
834
|
}
|
732
835
|
if ( statusTxt == 'error' ) {
|
733
|
-
logText = 'loading footer failed on id: ' +footer_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
836
|
+
logText = '\n' + 'loading footer failed on id: ' +footer_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
734
837
|
logger.error(logText);
|
735
838
|
j1.setXhrDataState(footer_id, statusTxt);
|
736
839
|
j1.setXhrDomState(footer_id, statusTxt);
|
737
840
|
|
738
841
|
// Set|Log status
|
739
842
|
state = 'failed';
|
740
|
-
logger.error('state: ' + state);
|
741
|
-
logText = 'initialization finished';
|
843
|
+
logger.error('\n' + 'state: ' + state);
|
844
|
+
logText = '\n' + 'initialization finished';
|
742
845
|
logger.info(logText);
|
743
846
|
}
|
744
847
|
};
|
@@ -750,7 +853,7 @@ var j1 = (function () {
|
|
750
853
|
var footer_data_path = '{{footer_data_path}} ' + id;
|
751
854
|
selector.load(footer_data_path, cb_load_closure(id));
|
752
855
|
} else {
|
753
|
-
logText = 'data not loaded';
|
856
|
+
logText = '\n' + 'data not loaded';
|
754
857
|
logger.warn(logText);
|
755
858
|
j1.setXhrDataState(id, 'not loaded');
|
756
859
|
j1.setXhrDomState(id, 'pending');
|
@@ -774,9 +877,11 @@ var j1 = (function () {
|
|
774
877
|
var flickerTimeout = {{template_config.flicker_timeout}};
|
775
878
|
var url = new liteURL(window.location.href);
|
776
879
|
var baseUrl = url.origin;
|
880
|
+
var secure = (url.protocol.includes('https')) ? true : false;
|
777
881
|
var ep_status = baseUrl + '/status' + '?page=' + window.location.pathname;
|
778
882
|
var user_session = j1.readCookie(cookie_names.user_session);
|
779
883
|
var user_state = j1.readCookie(cookie_names.user_state);
|
884
|
+
var user_consent = j1.readCookie(cookie_names.user_consent);
|
780
885
|
var current_url = new liteURL(window.location.href);
|
781
886
|
var providerPermissions = {};
|
782
887
|
var provider;
|
@@ -784,14 +889,36 @@ var j1 = (function () {
|
|
784
889
|
var appDetected;
|
785
890
|
var categoryAllowed;
|
786
891
|
|
787
|
-
|
892
|
+
// provider APIs require user consent
|
893
|
+
var meta_analytics = $('meta[name=analytics]').attr('content');
|
894
|
+
var analytics = (meta_analytics === 'true') ? true: false;
|
895
|
+
var meta_comments = $('meta[name=comments]').attr('content');
|
896
|
+
var comments = (meta_comments === 'true') ? true: false;
|
897
|
+
var meta_advertising = $('meta[name=advertising]').attr('content');
|
898
|
+
var advertising = (meta_advertising === 'true') ? true: false;
|
899
|
+
var meta_youtube = $('meta[name=youtube]').attr('content');
|
900
|
+
var youtube = (meta_youtube === 'true') ? true: false;
|
901
|
+
var meta_vimeo = $('meta[name=vimeo]').attr('content');
|
902
|
+
var vimeo = (meta_vimeo === 'true') ? true: false;
|
903
|
+
|
904
|
+
// personalized content require user consent
|
905
|
+
var meta_personalization = $('meta[name=personalization]').attr('content');
|
906
|
+
var personalization = (meta_personalization === 'true') ? true: false;
|
907
|
+
|
908
|
+
// if personalized content detected, page requires user consent
|
909
|
+
if (personalization && !user_consent.personalization) {
|
910
|
+
// redirect to error paged (blocked content)
|
911
|
+
window.location.href = "/444.html";
|
912
|
+
}
|
913
|
+
|
914
|
+
logger.info('\n' + 'finalize page');
|
788
915
|
j1.setCss();
|
789
916
|
|
790
|
-
logText= 'loading page partials: started';
|
917
|
+
logText= '\n' + 'loading page partials: started';
|
791
918
|
logger.info(logText);
|
792
919
|
|
793
920
|
if (j1.appDetected()) { // app mode
|
794
|
-
logger.info('mode detected: app');
|
921
|
+
logger.info('\n' + 'mode detected: app');
|
795
922
|
|
796
923
|
$.when ($.ajax(ep_status))
|
797
924
|
.then(function(data) {
|
@@ -800,11 +927,17 @@ var j1 = (function () {
|
|
800
927
|
user_session = j1.mergeData(user_session, data);
|
801
928
|
|
802
929
|
user_session.current_page = current_url.pathname;
|
803
|
-
|
930
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
931
|
+
cookie_written = j1.writeCookie({
|
804
932
|
name: cookie_names.user_session,
|
805
933
|
data: user_session,
|
806
|
-
samesite: 'Strict'
|
934
|
+
samesite: 'Strict',
|
935
|
+
secure: secure,
|
936
|
+
expires: 0
|
807
937
|
});
|
938
|
+
if (!cookie_written) {
|
939
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
940
|
+
}
|
808
941
|
|
809
942
|
providerPermissions = user_session.provider_permissions;
|
810
943
|
categoryAllowed = providerPermissions.includes(user_session.page_permission);
|
@@ -830,26 +963,66 @@ var j1 = (function () {
|
|
830
963
|
|
831
964
|
// show the page delayed
|
832
965
|
setTimeout (function() {
|
966
|
+
|
967
|
+
// Manage providers for personalization OptIn/Out (Comments|Ads)
|
968
|
+
if (!user_consent.personalization) {
|
969
|
+
logger.warn('\n' + 'disable comment provider: ' + comment_provider);
|
970
|
+
$('#leave-a-comment').remove();
|
971
|
+
if (comment_provider === 'disqus') {
|
972
|
+
$('#dsq-count-scr').remove();
|
973
|
+
$('#disqus-thread').remove();
|
974
|
+
}
|
975
|
+
if (comment_provider === 'hyvor') {
|
976
|
+
$('#hyvor-embed').remove();
|
977
|
+
$('#hyvor-talk-view').remove();
|
978
|
+
}
|
979
|
+
} else {
|
980
|
+
if (comments) {
|
981
|
+
logger.warn('\n' + 'enable comment provider: ' + comment_provider);
|
982
|
+
$('#main-content').append('<h2 id="leave-a-comment" class="mt-4">Leave a comment</h2>');
|
983
|
+
if (comment_provider === 'disqus') {
|
984
|
+
logger.info('\n' + 'load comment provider code: ' + comment_provider);
|
985
|
+
$('#main-content').append('<div id="disqus_thread"></div>');
|
986
|
+
$('body').append('<script async id="dsq-count-scr" src="//' + site_id + '.disqus.com/count.js"></script>');
|
987
|
+
j1.loadJS({
|
988
|
+
xhr_data_path: '/assets/data/' + comment_provider + '.js',
|
989
|
+
xhr_data_element: comment_provider
|
990
|
+
});
|
991
|
+
}
|
992
|
+
if (comment_provider === 'hyvor') {
|
993
|
+
$('body').append('<script> var HYVOR_TALK_WEBSITE = ' + site_id + '; var HYVOR_TALK_CONFIG = { url: false, id: false };');
|
994
|
+
$('#main-content').append('<div id="hyvor-talk-view"></div>');
|
995
|
+
$('body').append('<script async id="hyvor-embed" type="text/javascript" src="//talk.hyvor.com/web-api/embed.js"></script>');
|
996
|
+
}
|
997
|
+
} // END comments
|
998
|
+
} // END personalization
|
999
|
+
|
833
1000
|
// display page
|
834
|
-
|
1001
|
+
$('#no_flicker').css('display', 'block');
|
835
1002
|
|
836
1003
|
// NOTE: Placed tracking warning/info here because page may reloaded
|
837
1004
|
// after cookie consent selection
|
838
|
-
|
839
|
-
|
840
|
-
|
1005
|
+
if (user_consent.analyses) {
|
1006
|
+
logger.info('\n' + 'tracking allowed, privacy settings for analysis: ' + user_consent.analyses);
|
1007
|
+
if (tracking_enabled && !tracking_id_valid) {
|
1008
|
+
logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
|
1009
|
+
} else if (tracking_enabled && tracking_id_valid) {
|
1010
|
+
logger.warn('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
|
1011
|
+
} else {
|
1012
|
+
logger.warn('\n' + 'tracking disabled, tracking id found: ' + tracking_id);
|
1013
|
+
}
|
841
1014
|
} else {
|
842
|
-
logger.warn('tracking
|
1015
|
+
logger.warn('\n' + 'tracking not allowed, privacy settings for analysis: ' + user_consent.analyses);
|
843
1016
|
}
|
844
1017
|
|
845
1018
|
// show|hide cookie icon (should MOVED to Cookiebar ???)
|
846
1019
|
if (j1.existsCookie(cookie_names.user_consent)) {
|
847
1020
|
// Display cookie icon
|
848
|
-
logText = 'show cookie icon';
|
1021
|
+
logText = '\n' + 'show cookie icon';
|
849
1022
|
logger.info(logText);
|
850
1023
|
$('#quickLinksCookieButton').css('display', 'block');
|
851
1024
|
} else {
|
852
|
-
logText = 'hide cookie icon';
|
1025
|
+
logText = '\n' + 'hide cookie icon';
|
853
1026
|
logger.info(logText);
|
854
1027
|
// Display cookie icon
|
855
1028
|
$('#quickLinksCookieButton').css('display', 'none');
|
@@ -857,8 +1030,8 @@ var j1 = (function () {
|
|
857
1030
|
|
858
1031
|
// show|hide translator icon (currently NOT supported)
|
859
1032
|
// if (translation_enabled) {
|
860
|
-
// logger.info('translator detected: google');
|
861
|
-
// logger.info('initialize language selector');
|
1033
|
+
// logger.info('\n' + 'translator detected: google');
|
1034
|
+
// logger.info('\n' + 'initialize language selector');
|
862
1035
|
// $('.goog-te-combo').addClass('form-control');
|
863
1036
|
// }
|
864
1037
|
|
@@ -868,16 +1041,16 @@ var j1 = (function () {
|
|
868
1041
|
if (j1.authEnabled()) {
|
869
1042
|
if (user_session.authenticated === 'true') {
|
870
1043
|
// set signout
|
871
|
-
logger.info('show signout icon');
|
1044
|
+
logger.info('\n' + 'show signout icon');
|
872
1045
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignOut');
|
873
1046
|
$('#iconSignInOut').removeClass('mdi-login').addClass('mdi-logout');
|
874
1047
|
} else {
|
875
1048
|
// set signin
|
876
|
-
logger.info('show signin icon');
|
1049
|
+
logger.info('\n' + 'show signin icon');
|
877
1050
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignIn');
|
878
1051
|
$('#iconSignInOut').removeClass('mdi-logout').addClass('mdi-login');
|
879
1052
|
}
|
880
|
-
logger.info('authentication detected as: ' + user_session.authenticated);
|
1053
|
+
logger.info('\n' + 'authentication detected as: ' + user_session.authenticated);
|
881
1054
|
$('#quickLinksSignInOutButton').css('display', 'block');
|
882
1055
|
}
|
883
1056
|
|
@@ -886,25 +1059,25 @@ var j1 = (function () {
|
|
886
1059
|
j1.scrollTo();
|
887
1060
|
|
888
1061
|
if (user_session.previous_page !== user_session.current_page) {
|
889
|
-
logText = 'page change detected';
|
1062
|
+
logText = '\n' + 'page change detected';
|
890
1063
|
logger.info(logText);
|
891
|
-
logText = 'previous page: ' + user_session.previous_page;
|
1064
|
+
logText = '\n' + 'previous page: ' + user_session.previous_page;
|
892
1065
|
logger.info(logText);
|
893
|
-
logText = 'current page: ' + user_session.current_page;
|
1066
|
+
logText = '\n' + 'current page: ' + user_session.current_page;
|
894
1067
|
logger.info(logText);
|
895
1068
|
}
|
896
1069
|
|
897
1070
|
// update sidebar for changed theme data
|
898
|
-
logger.info('update sidebar');
|
1071
|
+
logger.info('\n' + 'update sidebar');
|
899
1072
|
user_state = j1.readCookie(cookie_names.user_state);
|
900
1073
|
current_user_data = j1.mergeData(user_session, user_state);
|
901
1074
|
j1.core.navigator.updateSidebar(current_user_data);
|
902
1075
|
|
903
1076
|
// Set|Log status
|
904
1077
|
state = 'finished';
|
905
|
-
logText = 'state: ' + state;
|
1078
|
+
logText = '\n' + 'state: ' + state;
|
906
1079
|
logger.info(logText);
|
907
|
-
logText = 'page finalized successfully';
|
1080
|
+
logText = '\n' + 'page finalized successfully';
|
908
1081
|
logger.info(logText);
|
909
1082
|
|
910
1083
|
}, flickerTimeout);
|
@@ -913,36 +1086,81 @@ var j1 = (function () {
|
|
913
1086
|
// show the page delayed
|
914
1087
|
setTimeout (function() {
|
915
1088
|
j1.setState('finished');
|
916
|
-
logger.info('state: finished');
|
917
|
-
logger.info('page initialization: finished');
|
1089
|
+
logger.info('\n' + 'state: finished');
|
1090
|
+
logger.info('\n' + 'page initialization: finished');
|
1091
|
+
|
1092
|
+
// Manage providers for personalization OptIn/Out (Comments|Ads)
|
1093
|
+
if (!user_consent.personalization) {
|
1094
|
+
logger.warn('\n' + 'disable comment provider: ' + comment_provider);
|
1095
|
+
$('#leave-a-comment').remove();
|
1096
|
+
if (comment_provider === 'disqus') {
|
1097
|
+
$('#dsq-count-scr').remove();
|
1098
|
+
$('#disqus-thread').remove();
|
1099
|
+
}
|
1100
|
+
if (comment_provider === 'hyvor') {
|
1101
|
+
$('#hyvor-embed').remove();
|
1102
|
+
$('#hyvor-talk-view').remove();
|
1103
|
+
}
|
1104
|
+
} else {
|
1105
|
+
if (comments) {
|
1106
|
+
logger.warn('\n' + 'enable comment provider: ' + comment_provider);
|
1107
|
+
$('#main-content').append('<h2 id="leave-a-comment" class="mt-4">Leave a comment</h2>');
|
1108
|
+
if (comment_provider === 'disqus') {
|
1109
|
+
logger.info('\n' + 'load comment provider code: ' + comment_provider);
|
1110
|
+
$('#main-content').append('<div id="disqus_thread"></div>');
|
1111
|
+
$('body').append('<script async id="dsq-count-scr" src="//' + site_id + '.disqus.com/count.js"></script>');
|
1112
|
+
j1.loadJS({
|
1113
|
+
xhr_data_path: '/assets/data/' + comment_provider + '.js',
|
1114
|
+
xhr_data_element: comment_provider
|
1115
|
+
});
|
1116
|
+
}
|
1117
|
+
if (comment_provider === 'hyvor') {
|
1118
|
+
$('body').append('<script> var HYVOR_TALK_WEBSITE = ' + site_id + '; var HYVOR_TALK_CONFIG = { url: false, id: false };');
|
1119
|
+
$('#main-content').append('<div id="hyvor-talk-view"></div>');
|
1120
|
+
$('body').append('<script async id="hyvor-embed" type="text/javascript" src="//talk.hyvor.com/web-api/embed.js"></script>');
|
1121
|
+
}
|
1122
|
+
} // END comments
|
1123
|
+
} // END personalization
|
918
1124
|
|
919
1125
|
// display page
|
920
1126
|
$('#no_flicker').css('display', 'block');
|
921
1127
|
|
922
1128
|
// NOTE: Placed tracking warning/info here because page may reloaded
|
923
1129
|
// after cookie consent selection
|
924
|
-
|
925
|
-
|
926
|
-
|
1130
|
+
if (user_consent.analyses) {
|
1131
|
+
logger.info('\n' + 'tracking allowed, privacy settings for analysis: ' + user_consent.analyses);
|
1132
|
+
if (tracking_enabled && !tracking_id_valid) {
|
1133
|
+
logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
|
1134
|
+
} else if (tracking_enabled && tracking_id_valid) {
|
1135
|
+
logger.warn('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
|
1136
|
+
} else {
|
1137
|
+
logger.warn('\n' + 'tracking disabled, tracking id found: ' + tracking_id);
|
1138
|
+
}
|
927
1139
|
} else {
|
928
|
-
logger.warn('tracking
|
1140
|
+
logger.warn('\n' + 'tracking not allowed, privacy settings for analysis: ' + user_consent.analyses);
|
929
1141
|
}
|
930
1142
|
|
931
|
-
logger.info('mode detected: web');
|
932
|
-
logger.info('hide signin icon');
|
1143
|
+
logger.info('\n' + 'mode detected: web');
|
1144
|
+
logger.info('\n' + 'hide signin icon');
|
933
1145
|
$('#quickLinksSignInOutButton').css('display', 'none');
|
934
1146
|
|
935
1147
|
user_session.current_page = current_url.pathname;
|
936
|
-
|
1148
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
1149
|
+
cookie_written = j1.writeCookie({
|
937
1150
|
name: cookie_names.user_session,
|
938
1151
|
data: user_session,
|
939
|
-
samesite: 'Strict'
|
1152
|
+
samesite: 'Strict',
|
1153
|
+
secure: secure,
|
1154
|
+
expires: 0
|
940
1155
|
});
|
1156
|
+
if (!cookie_written) {
|
1157
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
1158
|
+
}
|
941
1159
|
|
942
1160
|
// show|hide translator icon (currently NOT supported)
|
943
1161
|
// if (translation_enabled) {
|
944
|
-
// logger.info('translator detected: google');
|
945
|
-
// logger.info('initialize language selector');
|
1162
|
+
// logger.info('\n' + 'translator detected: google');
|
1163
|
+
// logger.info('\n' + 'initialize language selector');
|
946
1164
|
// $('.goog-te-combo').addClass('form-control');
|
947
1165
|
// }
|
948
1166
|
|
@@ -952,11 +1170,11 @@ var j1 = (function () {
|
|
952
1170
|
// show|hide cookie icon
|
953
1171
|
if (j1.existsCookie(cookie_names.user_consent)) {
|
954
1172
|
// Display cookie icon
|
955
|
-
logText = 'show cookie icon';
|
1173
|
+
logText = '\n' + 'show cookie icon';
|
956
1174
|
logger.info(logText);
|
957
1175
|
$('#quickLinksCookieButton').css('display', 'block');
|
958
1176
|
} else {
|
959
|
-
logText = 'hide cookie icon';
|
1177
|
+
logText = '\n' + 'hide cookie icon';
|
960
1178
|
logger.info(logText);
|
961
1179
|
// Display cookie icon
|
962
1180
|
$('#quickLinksCookieButton').css('display', 'none');
|
@@ -967,25 +1185,25 @@ var j1 = (function () {
|
|
967
1185
|
j1.scrollTo();
|
968
1186
|
|
969
1187
|
if (user_session.previous_page !== user_session.current_page) {
|
970
|
-
logText = 'page change detected';
|
1188
|
+
logText = '\n' + 'page change detected';
|
971
1189
|
logger.info(logText);
|
972
|
-
logText = 'previous page: ' + user_session.previous_page;
|
1190
|
+
logText = '\n' + 'previous page: ' + user_session.previous_page;
|
973
1191
|
logger.info(logText);
|
974
|
-
logText = 'current page: ' + user_session.current_page;
|
1192
|
+
logText = '\n' + 'current page: ' + user_session.current_page;
|
975
1193
|
logger.info(logText);
|
976
1194
|
}
|
977
1195
|
|
978
1196
|
// update sidebar for changed theme data
|
979
|
-
logger.info('update sidebar');
|
1197
|
+
logger.info('\n' + 'update sidebar');
|
980
1198
|
user_state = j1.readCookie(cookie_names.user_state);
|
981
1199
|
current_user_data = j1.mergeData(user_session, user_state);
|
982
1200
|
j1.core.navigator.updateSidebar(current_user_data);
|
983
1201
|
|
984
1202
|
// set|log status
|
985
1203
|
state = 'finished';
|
986
|
-
logText = 'state: ' + state;
|
1204
|
+
logText = '\n' + 'state: ' + state;
|
987
1205
|
logger.info(logText);
|
988
|
-
logText = 'page finalized successfully';
|
1206
|
+
logText = '\n' + 'page finalized successfully';
|
989
1207
|
logger.info(logText);
|
990
1208
|
|
991
1209
|
}, flickerTimeout);
|
@@ -1093,7 +1311,7 @@ var j1 = (function () {
|
|
1093
1311
|
$(window).scrollTop($(window).scrollTop()-1);
|
1094
1312
|
} // END if anchor_id
|
1095
1313
|
} else if (anchor_id === '#') {
|
1096
|
-
logger.info('bound click event to "#", suppress default action');
|
1314
|
+
logger.info('\n' + 'bound click event to "#", suppress default action');
|
1097
1315
|
$(window).scrollTop($(window).scrollTop()+1);
|
1098
1316
|
$(window).scrollTop($(window).scrollTop()-1);
|
1099
1317
|
return false;
|
@@ -1131,12 +1349,12 @@ var j1 = (function () {
|
|
1131
1349
|
}, // END appDetected
|
1132
1350
|
|
1133
1351
|
// -------------------------------------------------------------------------
|
1134
|
-
//
|
1135
|
-
// Load data asychronously using XHR|jQuery on an
|
1352
|
+
// loadHTML()
|
1353
|
+
// Load HTML data asychronously using XHR|jQuery on an element (e.g. <div>)
|
1136
1354
|
// specified by xhr_container_id, xhr_data_path (options)
|
1137
1355
|
// -------------------------------------------------------------------------
|
1138
|
-
|
1139
|
-
var logger = log4javascript.getLogger('j1.adapter.
|
1356
|
+
loadHTML: function (options, mod, status) {
|
1357
|
+
var logger = log4javascript.getLogger('j1.adapter.loadHTML');
|
1140
1358
|
var selector = $('#' + options.xhr_container_id);
|
1141
1359
|
var state = status;
|
1142
1360
|
var observer_options = {
|
@@ -1150,12 +1368,12 @@ var j1 = (function () {
|
|
1150
1368
|
|
1151
1369
|
var cb_load_closure = function(mod, id) {
|
1152
1370
|
return function (responseTxt, statusTxt, xhr) {
|
1153
|
-
var logger = log4javascript.getLogger('j1.adapter.
|
1371
|
+
var logger = log4javascript.getLogger('j1.adapter.loadHTML');
|
1154
1372
|
if ( statusTxt === 'success' ) {
|
1155
1373
|
j1.setXhrDataState(id, statusTxt);
|
1156
1374
|
j1.setXhrDomState(id, 'pending');
|
1157
1375
|
|
1158
|
-
logText = 'data loaded successfully on id: ' +id;
|
1376
|
+
logText = '\n' + 'data loaded successfully on id: ' +id;
|
1159
1377
|
logger.info(logText);
|
1160
1378
|
state = true;
|
1161
1379
|
}
|
@@ -1163,12 +1381,12 @@ var j1 = (function () {
|
|
1163
1381
|
// jadams, 2020-07-21: to be checked why id could be UNDEFINED
|
1164
1382
|
if (typeof(id) != "undefined") {
|
1165
1383
|
state = 'failed';
|
1166
|
-
logger.info('set state for ' +mod+ ' to: ' + state);
|
1384
|
+
logger.info('\n' + 'set state for ' +mod+ ' to: ' + state);
|
1167
1385
|
// jadams, 2020-07-21: intermediate state should DISABLED
|
1168
1386
|
// executeFunctionByName(mod + '.setState', window, state);
|
1169
1387
|
j1.setXhrDataState(id, statusTxt);
|
1170
1388
|
j1.setXhrDomState(id, 'pending');
|
1171
|
-
logText = 'loading data failed on id: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
1389
|
+
logText = '\n' + 'loading data failed on id: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
1172
1390
|
logger.error(logText);
|
1173
1391
|
state = false;
|
1174
1392
|
}
|
@@ -1189,9 +1407,9 @@ var j1 = (function () {
|
|
1189
1407
|
|
1190
1408
|
// failsafe - prevent XHR load errors
|
1191
1409
|
if (options.xhr_data_element !== '') {
|
1192
|
-
logger.info('XHR data element found: ' + options.xhr_data_element);
|
1410
|
+
logger.info('\n' + 'XHR data element found: ' + options.xhr_data_element);
|
1193
1411
|
} else {
|
1194
|
-
logger.warn('no XHR data element found, loading data aborted');
|
1412
|
+
logger.warn('\n' + 'no XHR data element found, loading data aborted');
|
1195
1413
|
return;
|
1196
1414
|
}
|
1197
1415
|
|
@@ -1213,33 +1431,71 @@ var j1 = (function () {
|
|
1213
1431
|
function mutationHandler (mutationRecords) {
|
1214
1432
|
mutationRecords.forEach ( function (mutation) {
|
1215
1433
|
if (mutation.addedNodes.length) {
|
1216
|
-
logger.info('XHR data loaded in the DOM: ' + id);
|
1434
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + id);
|
1217
1435
|
j1.setXhrDomState(id, 'success');
|
1218
1436
|
}
|
1219
1437
|
});
|
1220
1438
|
}
|
1221
1439
|
} else {
|
1222
1440
|
// jadams, 2020-07-21: To be clarified why a id is "undefined"
|
1223
|
-
|
1224
1441
|
// failsafe - prevent XHR load errors
|
1225
1442
|
if (id != '#undefined') {
|
1226
|
-
logText = 'data not loaded on id:' + id;
|
1443
|
+
logText = '\n' + 'data not loaded on id:' + id;
|
1227
1444
|
logger.warn(logText);
|
1228
1445
|
j1.setXhrDataState(id, 'not loaded');
|
1229
1446
|
j1.setXhrDomState(id, 'not loaded');
|
1230
1447
|
// Set processing state to 'finished' to complete module load
|
1231
1448
|
state = 'finished';
|
1232
|
-
logger.info('state: ' + state);
|
1449
|
+
logger.info('\n' + 'state: ' + state);
|
1233
1450
|
// jadams, 2020-07-21: intermediate state should DISABLED
|
1234
1451
|
// executeFunctionByName(mod + '.setState', window, state);
|
1235
1452
|
state = false;
|
1236
1453
|
}
|
1237
1454
|
}
|
1238
1455
|
return state;
|
1239
|
-
}, // END
|
1456
|
+
}, // END loadHTML
|
1240
1457
|
|
1241
1458
|
// -------------------------------------------------------------------------
|
1242
|
-
//
|
1459
|
+
// loadJS()
|
1460
|
+
// Load JS data asychronously using jQuery (XHR)
|
1461
|
+
// -------------------------------------------------------------------------
|
1462
|
+
loadJS: function (options, mod, status) {
|
1463
|
+
var logger = log4javascript.getLogger('j1.adapter.loadJS');
|
1464
|
+
var state = status;
|
1465
|
+
var logText;
|
1466
|
+
|
1467
|
+
var cb_load_closure = function(mod, id) {
|
1468
|
+
return function (responseTxt, statusTxt, xhr) {
|
1469
|
+
var logger = log4javascript.getLogger('j1.adapter.loadJS');
|
1470
|
+
if ( statusTxt === 'success' ) {
|
1471
|
+
j1.setXhrDataState(id, statusTxt);
|
1472
|
+
|
1473
|
+
logText = '\n' + 'data loaded successfully for: ' +id;
|
1474
|
+
logger.info(logText);
|
1475
|
+
state = true;
|
1476
|
+
}
|
1477
|
+
if ( statusTxt === 'error' ) {
|
1478
|
+
state = 'failed';
|
1479
|
+
logger.info('\n' + 'set state for ' +mod+ ' to: ' + state);
|
1480
|
+
j1.setXhrDataState(id, statusTxt);
|
1481
|
+
logText = '\n' + 'loading data failed for: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
1482
|
+
logger.error(logText);
|
1483
|
+
state = false;
|
1484
|
+
}
|
1485
|
+
};
|
1486
|
+
};
|
1487
|
+
|
1488
|
+
$.ajax({
|
1489
|
+
url: options.xhr_data_path,
|
1490
|
+
dataType: 'script',
|
1491
|
+
success: cb_load_closure(mod, options.xhr_data_element)
|
1492
|
+
});
|
1493
|
+
|
1494
|
+
return state;
|
1495
|
+
}, // END loadJS
|
1496
|
+
|
1497
|
+
// -------------------------------------------------------------------------
|
1498
|
+
// readCookie (Vanilla JS)
|
1243
1499
|
// -------------------------------------------------------------------------
|
1244
1500
|
readCookie: function (name) {
|
1245
1501
|
var data;
|
@@ -1261,20 +1517,7 @@ var j1 = (function () {
|
|
1261
1517
|
}, // END readCookie
|
1262
1518
|
|
1263
1519
|
// -------------------------------------------------------------------------
|
1264
|
-
//
|
1265
|
-
// Search for cookies (names) in the page header that matches
|
1266
|
-
// a given regex string. Returns all names found as an array.
|
1267
|
-
// -------------------------------------------------------------------------
|
1268
|
-
// See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
|
1269
|
-
// -------------------------------------------------------------------------
|
1270
|
-
findCookie: function (regex) {
|
1271
|
-
var r=[];
|
1272
|
-
document.cookie.replace(new RegExp(regex + "[^= ]*", "g"), function(a){ r.push(a.trim()); });
|
1273
|
-
return r;
|
1274
|
-
}, // END findCookie
|
1275
|
-
|
1276
|
-
// -------------------------------------------------------------------------
|
1277
|
-
// writeCookie()
|
1520
|
+
// writeCookie (Cookie lib)
|
1278
1521
|
// Write 'data' to a cookie 'name'. If not exists, the cookie gets
|
1279
1522
|
// created. Returns 'true' if cookie was written, otherwise 'false'.
|
1280
1523
|
// -------------------------------------------------------------------------
|
@@ -1283,6 +1526,14 @@ var j1 = (function () {
|
|
1283
1526
|
// https://developer.mozilla.org/de/docs/Web/HTTP/Headers/Set-Cookie/SameSite
|
1284
1527
|
// https://www.smarketer.de/blog/chrome-update-80-cookies/
|
1285
1528
|
// -------------------------------------------------------------------------
|
1529
|
+
// SESSION Cookies:
|
1530
|
+
// NOT putting an EXPIRES part in will create a session cookie.
|
1531
|
+
// -------------------------------------------------------------------------
|
1532
|
+
// REMOVING Cookies: Cookies get removed immediately, if the expires
|
1533
|
+
// part points to a PAST date (e.g. 01 Jan 1970 00:00:00 UTC).
|
1534
|
+
// -------------------------------------------------------------------------
|
1535
|
+
// MAX-AGE Cookies: To leave cookies for a specific time, set the expires
|
1536
|
+
// part into a FUTUTE date. FOR GDPR compliance, MAX-AGE is 365 days.
|
1286
1537
|
// TODO:
|
1287
1538
|
// Change attribute "Secure" to true, if HTTPS is used.
|
1288
1539
|
// Checks and config changes are to be done.
|
@@ -1299,58 +1550,58 @@ var j1 = (function () {
|
|
1299
1550
|
// must now also specify the Secure attribute (they require a secure
|
1300
1551
|
// context/HTTPS).
|
1301
1552
|
// -------------------------------------------------------------------------
|
1302
|
-
|
1303
|
-
|
1553
|
+
writeCookie: function (options /*name, data, [path, expires, domain, samesite, http_only, secure]*/) {
|
1554
|
+
var date = new Date();
|
1555
|
+
var timestamp_now = date.toISOString();
|
1556
|
+
var cookie_data = {};
|
1557
|
+
var data_json;
|
1558
|
+
var data_encoded;
|
1559
|
+
var expires;
|
1560
|
+
var stringifiedAttributes = '';
|
1561
|
+
|
1304
1562
|
var defaults = {
|
1305
1563
|
data: {},
|
1306
1564
|
name: '',
|
1307
1565
|
path: '/',
|
1308
1566
|
expires: 0,
|
1309
|
-
|
1567
|
+
domain: 'localhost',
|
1568
|
+
samesite: 'Strict',
|
1310
1569
|
http_only: false,
|
1311
1570
|
secure: false
|
1312
1571
|
};
|
1572
|
+
|
1313
1573
|
var settings = $.extend(defaults, options);
|
1314
|
-
|
1315
|
-
|
1316
|
-
var cookie_data = {};
|
1317
|
-
var data_json;
|
1318
|
-
var data_encoded;
|
1574
|
+
|
1575
|
+
cookie_data.timestamp = timestamp_now;
|
1319
1576
|
|
1320
1577
|
if (j1.existsCookie(settings.name)) {
|
1321
|
-
cookie_data
|
1322
|
-
cookie_data.
|
1323
|
-
|
1324
|
-
|
1325
|
-
data_encoded = window.btoa(data_json);
|
1326
|
-
|
1327
|
-
if (settings.expires > 0) {
|
1328
|
-
Cookies.set(settings.name, data_encoded, {
|
1329
|
-
expires: settings.expires,
|
1330
|
-
SameSite: settings.samesite
|
1331
|
-
});
|
1332
|
-
} else {
|
1333
|
-
Cookies.set(settings.name, data_encoded, {
|
1334
|
-
SameSite: settings.samesite
|
1335
|
-
});
|
1336
|
-
}
|
1578
|
+
cookie_data = j1.readCookie(settings.name);
|
1579
|
+
cookie_data = j1.mergeData(cookie_data, settings.data);
|
1580
|
+
data_json = JSON.stringify( cookie_data );
|
1581
|
+
data_encoded = window.btoa(data_json);
|
1337
1582
|
} else {
|
1338
1583
|
cookie_data = settings.data;
|
1339
1584
|
data_json = JSON.stringify(settings.data);
|
1340
1585
|
data_encoded = window.btoa(data_json);
|
1586
|
+
}
|
1341
1587
|
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
} else {
|
1348
|
-
Cookies.set(settings.name, data_encoded, {
|
1349
|
-
SameSite: settings.samesite
|
1350
|
-
});
|
1351
|
-
}
|
1588
|
+
stringifiedAttributes += '; ' + 'path=' + settings.path;
|
1589
|
+
|
1590
|
+
if (settings.expires > 0) {
|
1591
|
+
date.setTime(date.getTime() + (settings.expires * 24 * 60 * 60 * 1000));
|
1592
|
+
stringifiedAttributes += '; ' + 'expires=' + date.toUTCString();
|
1352
1593
|
}
|
1353
1594
|
|
1595
|
+
stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
|
1596
|
+
|
1597
|
+
if (settings.secure) {
|
1598
|
+
stringifiedAttributes += '; ' + 'secure=' + settings.secure;
|
1599
|
+
}
|
1600
|
+
|
1601
|
+
// write the cookie
|
1602
|
+
// document.cookie = settings.name + '=' + content + '; path=' + settings.path + '; domain=' + settings.domain + '; ' + 'SameSite=' + settings.samesite + '; secure';
|
1603
|
+
document.cookie = settings.name + '=' + data_encoded + stringifiedAttributes;
|
1604
|
+
|
1354
1605
|
if (j1.existsCookie(settings.name)) {
|
1355
1606
|
return cookie_data;
|
1356
1607
|
} else {
|
@@ -1360,63 +1611,112 @@ var j1 = (function () {
|
|
1360
1611
|
}, // END writeCookie
|
1361
1612
|
|
1362
1613
|
// -------------------------------------------------------------------------
|
1363
|
-
//
|
1364
|
-
//
|
1365
|
-
//
|
1366
|
-
//
|
1367
|
-
//
|
1614
|
+
// findCookie (Vanilla JS)
|
1615
|
+
// Search for cookies (names) in the page header that matches a given
|
1616
|
+
// name. Cookie name can be give as full name, like 'j1.user.state', or
|
1617
|
+
// as a partial like 'j1'
|
1618
|
+
// Returns all names found as an array.
|
1619
|
+
// -------------------------------------------------------------------------
|
1620
|
+
// See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
|
1368
1621
|
// -------------------------------------------------------------------------
|
1369
|
-
|
1622
|
+
findCookie: function (name) {
|
1623
|
+
var rCookie=[];
|
1624
|
+
document.cookie.replace(new RegExp(name + '[^= ]*', 'g'), function(a){ rCookie.push(a.trim()); });
|
1625
|
+
|
1626
|
+
return rCookie;
|
1627
|
+
}, // END findCookie
|
1628
|
+
|
1629
|
+
// -------------------------------------------------------------------------
|
1630
|
+
// removeCookie (Vanilla JS)
|
1631
|
+
// -------------------------------------------------------------------------
|
1632
|
+
removeCookie: function (options /*name, [path, domain]*/) {
|
1370
1633
|
var cookieExists;
|
1371
1634
|
var defaults = {
|
1372
|
-
|
1635
|
+
domain: 'localhost',
|
1373
1636
|
path: '/'
|
1374
1637
|
};
|
1375
1638
|
var settings = $.extend(defaults, options);
|
1376
1639
|
|
1377
|
-
|
1378
|
-
|
1640
|
+
if (j1.findCookie(settings.name)) {
|
1641
|
+
// clear cookie CONTENT and set expiry date in the PAST
|
1642
|
+
document.cookie = settings.name + '=; domain=' + settings.domain + '; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
|
1643
|
+
return true;
|
1644
|
+
} else {
|
1645
|
+
return false;
|
1646
|
+
}
|
1379
1647
|
}, // END removeCookie
|
1380
1648
|
|
1381
1649
|
// -------------------------------------------------------------------------
|
1382
|
-
//
|
1383
|
-
//
|
1384
|
-
//
|
1385
|
-
//
|
1650
|
+
// expireCookie (Vanilla JS)
|
1651
|
+
// Expires given cookies by name except cookies set to httpOnly. For all
|
1652
|
+
// cookies the expiry date is REMOVED. This results in cookies are set
|
1653
|
+
// to 'session' for the expiry date. All session cookies are deleted
|
1654
|
+
// automatically by the browser if the last session (browser tab|window)
|
1655
|
+
// is closed.
|
1656
|
+
// -------------------------------------------------------------------------
|
1657
|
+
// expireCookie() returns 'true' if cookie is set successfully,
|
1658
|
+
// otherwise 'false' (e.g NOT found)
|
1659
|
+
// -------------------------------------------------------------------------
|
1660
|
+
// NOTE:
|
1386
1661
|
// See: https://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript
|
1662
|
+
// NOTE:
|
1663
|
+
// There is NO way you could get a trace of Path, Domain and other
|
1664
|
+
// attributes of cookies as they are only read by browsers and NOT shown
|
1665
|
+
// to JavaScript. For that reason, attributes needs to be set explicitly.
|
1387
1666
|
// -------------------------------------------------------------------------
|
1388
|
-
|
1389
|
-
var
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1667
|
+
expireCookie: function (options /*name [,path, samesite, secure]*/) {
|
1668
|
+
var defaults = {
|
1669
|
+
path: '/',
|
1670
|
+
samesite: 'Strict',
|
1671
|
+
secure: false
|
1672
|
+
};
|
1673
|
+
var settings = $.extend(defaults, options);
|
1674
|
+
|
1675
|
+
var dc = document.cookie; // all cookies in page
|
1676
|
+
var end = dc.length; // default to end of the string
|
1677
|
+
var prefix = settings.name + '='; // search string for the cookie name given
|
1678
|
+
var begin = dc.indexOf('; ' + prefix);
|
1679
|
+
var content = '';
|
1680
|
+
|
1681
|
+
// collect the cookie content
|
1682
|
+
//
|
1683
|
+
// found, and not in the first position
|
1684
|
+
if (begin !== -1) {
|
1685
|
+
// exclude the "; "
|
1686
|
+
begin += 2;
|
1687
|
+
} else {
|
1688
|
+
// see if cookie is in first position
|
1689
|
+
begin = dc.indexOf(prefix);
|
1690
|
+
// not found at all or found as a portion of another cookie name
|
1691
|
+
if (begin === -1 || begin !== 0 ) return false;
|
1692
|
+
}
|
1693
|
+
|
1694
|
+
// if ";" is found somewhere after the prefix position then "end" is
|
1695
|
+
// that position, otherwise it defaults to the end of the string
|
1696
|
+
if (dc.indexOf(';', begin) !== -1) {
|
1697
|
+
end = dc.indexOf(';', begin);
|
1698
|
+
}
|
1699
|
+
|
1700
|
+
// expire cookie to session
|
1701
|
+
content = decodeURI(dc.substring(begin + prefix.length, end) ).replace(/"/g, '');
|
1702
|
+
if (settings.secure) {
|
1703
|
+
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; secure';
|
1405
1704
|
} else {
|
1406
|
-
document.cookie = name + '
|
1705
|
+
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite;
|
1407
1706
|
}
|
1408
1707
|
|
1409
1708
|
return true;
|
1410
|
-
}, // END
|
1709
|
+
}, // END expireCookie
|
1411
1710
|
|
1412
1711
|
// -------------------------------------------------------------------------
|
1413
|
-
//
|
1712
|
+
// existsCookie (Vanilla JS)
|
1713
|
+
// returns true if a given cookie exists
|
1414
1714
|
// -------------------------------------------------------------------------
|
1415
1715
|
existsCookie: function (name) {
|
1416
1716
|
var dc = document.cookie;
|
1417
1717
|
var prefix = name + '=';
|
1418
1718
|
var begin = dc.indexOf('; ' + prefix);
|
1419
|
-
var end = dc.length;
|
1719
|
+
var end = dc.length; // default to end of the string
|
1420
1720
|
var cookieExists = false;
|
1421
1721
|
var cookieContent = '';
|
1422
1722
|
|
@@ -1509,11 +1809,11 @@ var j1 = (function () {
|
|
1509
1809
|
});
|
1510
1810
|
|
1511
1811
|
});
|
1512
|
-
logger.info('met dependencies for: sidebarLoaded');
|
1812
|
+
logger.info('\n' + 'met dependencies for: sidebarLoaded');
|
1513
1813
|
clearInterval(sidebarLoaded);
|
1514
1814
|
return true;
|
1515
1815
|
} else {
|
1516
|
-
logger.error('no user data provided');
|
1816
|
+
logger.error('\n' + 'no user data provided');
|
1517
1817
|
clearInterval(sidebarLoaded);
|
1518
1818
|
return false;
|
1519
1819
|
}
|
@@ -1567,11 +1867,11 @@ var j1 = (function () {
|
|
1567
1867
|
});
|
1568
1868
|
|
1569
1869
|
});
|
1570
|
-
logger.info('met dependencies for: sidebarLoaded');
|
1870
|
+
logger.info('\n' + 'met dependencies for: sidebarLoaded');
|
1571
1871
|
clearInterval(sidebarLoaded);
|
1572
1872
|
return true;
|
1573
1873
|
} else {
|
1574
|
-
logger.error('no user data provided');
|
1874
|
+
logger.error('\n' + 'no user data provided');
|
1575
1875
|
clearInterval(sidebarLoaded);
|
1576
1876
|
return false;
|
1577
1877
|
}
|
@@ -1610,11 +1910,11 @@ var j1 = (function () {
|
|
1610
1910
|
var json_message = JSON.stringify(message);
|
1611
1911
|
|
1612
1912
|
if ( receiver === 'j1' ) {
|
1613
|
-
logText = 'send message from ' + sender + ' to' + receiver + ': ' + json_message;
|
1913
|
+
logText = '\n' + 'send message from ' + sender + ' to' + receiver + ': ' + json_message;
|
1614
1914
|
logger.debug(logText);
|
1615
1915
|
executeFunctionByName('j1' + '.messageHandler', window, sender, message);
|
1616
1916
|
} else {
|
1617
|
-
logText = 'send message from ' + sender + ' to ' + receiver + ': ' + json_message;
|
1917
|
+
logText = '\n' + 'send message from ' + sender + ' to ' + receiver + ': ' + json_message;
|
1618
1918
|
logger.debug(logText);
|
1619
1919
|
//executeFunctionByName('j1.' + receiver + '.messageHandler', window, sender, message)
|
1620
1920
|
executeFunctionByName(receiver + '.messageHandler', window, sender, message);
|
@@ -1630,7 +1930,7 @@ var j1 = (function () {
|
|
1630
1930
|
// var json_message = JSON.stringify(message, undefined, 2); // multiline
|
1631
1931
|
var json_message = JSON.stringify(message);
|
1632
1932
|
|
1633
|
-
logText = 'received message from ' + sender + ': ' + json_message;
|
1933
|
+
logText = '\n' + 'received message from ' + sender + ': ' + json_message;
|
1634
1934
|
logger.debug(logText);
|
1635
1935
|
|
1636
1936
|
// -----------------------------------------------------------------------
|
@@ -1638,7 +1938,7 @@ var j1 = (function () {
|
|
1638
1938
|
// -----------------------------------------------------------------------
|
1639
1939
|
if ( message.type === 'command' && message.action === 'module_initialized' ) {
|
1640
1940
|
_this.setState('finished');
|
1641
|
-
logger.info(message.text);
|
1941
|
+
logger.info('\n' + message.text);
|
1642
1942
|
}
|
1643
1943
|
|
1644
1944
|
//
|
@@ -1701,7 +2001,7 @@ var j1 = (function () {
|
|
1701
2001
|
var bg_primary = j1.getStyleValue('bg-primary', 'background-color');
|
1702
2002
|
var bg_secondary = j1.getStyleValue('bg-secondary', 'background-color');
|
1703
2003
|
|
1704
|
-
logger.info('set color scheme for selected theme');
|
2004
|
+
logger.info('\n' + 'set color scheme for selected theme');
|
1705
2005
|
|
1706
2006
|
// globals
|
1707
2007
|
// -----------------------------------------------------------------------
|