j1-template 2021.1.11 → 2021.1.16
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/blocks/footer/boxes/issue.proc +28 -5
- data/_includes/themes/j1/blocks/footer/boxes/legal_statements.proc +66 -23
- data/_includes/themes/j1/blocks/footer/boxes/links_box.proc +0 -1
- data/_includes/themes/j1/blocks/footer/boxes/news_box.proc +16 -1
- data/_includes/themes/j1/layouts/content_generator_app.html +1 -1
- data/_includes/themes/j1/layouts/content_generator_blog_archive.html +197 -219
- data/_includes/themes/j1/layouts/content_generator_collection.html +4 -2
- data/_includes/themes/j1/layouts/content_generator_page.html +4 -1
- data/_includes/themes/j1/layouts/content_generator_post.html +31 -23
- 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/_includes/themes/j1/procedures/posts/collate_timeline.proc +27 -5
- data/_includes/themes/j1/procedures/posts/pager.proc +123 -0
- data/_layouts/default.html +52 -1
- data/assets/data/cookieconsent.html +0 -2
- data/assets/data/disqus.js +81 -0
- data/assets/data/hyvor.js +72 -0
- data/assets/data/menu.html +1 -1
- data/assets/data/mmenu_toc.html +20 -1
- data/assets/data/panel.html +28 -7
- data/assets/error_pages/HTTP204.html +2 -1
- data/assets/error_pages/HTTP400.html +2 -1
- data/assets/error_pages/HTTP401.html +2 -1
- data/assets/error_pages/HTTP403.html +2 -1
- data/assets/error_pages/HTTP404.html +2 -1
- data/assets/error_pages/HTTP444.html +93 -0
- data/assets/error_pages/HTTP500.html +2 -1
- data/assets/error_pages/HTTP501.html +2 -1
- data/assets/error_pages/HTTP502.html +2 -1
- data/assets/error_pages/HTTP503.html +2 -1
- 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 +58 -47
- 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 +520 -252
- 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 +55 -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 +43 -47
- data/assets/themes/j1/adapter/js/toccer.js +9 -9
- 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 +3 -3
- data/lib/starter_web/Gemfile +4 -5
- data/lib/starter_web/_config.yml +42 -24
- data/lib/starter_web/_data/blocks/footer.yml +52 -20
- data/lib/starter_web/_data/blocks/panel.yml +4 -4
- data/lib/starter_web/_data/builder/blog_navigator.yml +9 -192
- data/lib/starter_web/_data/builder/defaults/blog_navigator.yml +389 -0
- data/lib/starter_web/_data/j1_config.yml +24 -10
- data/lib/starter_web/_data/locales/be.yml +269 -0
- data/lib/starter_web/_data/locales/cs.yml +218 -0
- data/lib/starter_web/_data/locales/da.yml +213 -0
- data/lib/starter_web/_data/locales/de.yml +222 -0
- data/lib/starter_web/_data/locales/el.yml +215 -0
- data/lib/starter_web/_data/locales/en.yml +215 -0
- data/lib/starter_web/_data/locales/es.yml +219 -0
- data/lib/starter_web/_data/locales/et.yml +207 -0
- data/lib/starter_web/_data/locales/fi.yml +211 -0
- data/lib/starter_web/_data/locales/fr.yml +219 -0
- data/lib/starter_web/_data/locales/hr.yml +240 -0
- data/lib/starter_web/_data/locales/hu.yml +196 -0
- data/lib/starter_web/_data/locales/it.yml +215 -0
- data/lib/starter_web/_data/locales/lv.yml +233 -0
- data/lib/starter_web/_data/locales/nl.yml +213 -0
- data/lib/starter_web/_data/locales/pl.yml +241 -0
- data/lib/starter_web/_data/locales/pt.yml +217 -0
- data/lib/starter_web/_data/locales/readme +4 -0
- data/lib/starter_web/_data/locales/ro.yml +209 -0
- data/lib/starter_web/_data/locales/ru.yml +269 -0
- data/lib/starter_web/_data/locales/sk.yml +211 -0
- data/lib/starter_web/_data/locales/sl.yml +209 -0
- data/lib/starter_web/_data/locales/sv.yml +207 -0
- data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +11 -10
- data/lib/starter_web/_data/modules/defaults/themer.yml +1 -0
- data/lib/starter_web/_data/modules/themer.yml +1 -0
- data/lib/starter_web/_data/plugins/defaults/paginator.yml +7 -6
- data/lib/starter_web/_data/plugins/paginator.yml +3 -0
- data/lib/starter_web/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/_plugins/date-i18n.rb +67 -0
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/assets/images/modules/attics/markus-spiske-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/attics/matthew-dockery-1920x1280.jpg +0 -0
- data/lib/starter_web/collections/posts/public/featured/_posts/2020-01-01-about-cookies.adoc +1 -1
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-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-test-series.adoc +2 -2
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-test-series.adoc +2 -2
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-test-series.adoc +2 -2
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-04-post-test-series.adoc +2 -2
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-20-minneapolis.adoc +1 -1
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-24-narcisse-snake-dens.adoc +1 -1
- data/lib/starter_web/index.html +3 -3
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/asciidoc_skeletons/book/book.adoc +3 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +3 -0
- data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +3 -0
- data/lib/starter_web/pages/public/blog/navigator/archive.html +80 -12
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +94 -26
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +81 -12
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +95 -37
- 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/de/100_copyright.adoc +116 -0
- data/lib/starter_web/pages/public/legal/de/100_impress.adoc +94 -0
- data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +320 -0
- data/lib/starter_web/pages/public/legal/de/400_comment_policy.adoc +123 -0
- 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 +41 -4
- data/_includes/themes/j1/procedures/global/pager.proc +0 -79
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.org.asciidoc +0 -244
@@ -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
|
//
|
@@ -41,46 +41,84 @@ regenerate: true
|
|
41
41
|
|
42
42
|
{% comment %} Set config files
|
43
43
|
-------------------------------------------------------------------------------- {% endcomment %}
|
44
|
-
{% assign blocks
|
45
|
-
{% assign modules
|
46
|
-
{% assign template_config
|
44
|
+
{% assign blocks = site.data.blocks %}
|
45
|
+
{% assign modules = site.data.modules %}
|
46
|
+
{% assign template_config = site.data.j1_config %}
|
47
47
|
|
48
48
|
{% comment %} Set config data
|
49
49
|
-------------------------------------------------------------------------------- {% endcomment %}
|
50
|
-
{% assign banner_config_defaults
|
51
|
-
{% assign banner_config_settings
|
52
|
-
{% assign panel_config_defaults
|
53
|
-
{% assign panel_config_settings
|
54
|
-
{% assign footer_config_defaults
|
55
|
-
{% assign toccer_defaults
|
56
|
-
|
57
|
-
{% assign themer_defaults
|
58
|
-
{% assign themer_settings
|
59
|
-
|
60
|
-
{% assign
|
61
|
-
|
62
|
-
|
63
|
-
{% assign
|
50
|
+
{% assign banner_config_defaults = blocks.defaults.banner.defaults %}
|
51
|
+
{% assign banner_config_settings = blocks.banner.settings %}
|
52
|
+
{% assign panel_config_defaults = blocks.defaults.panel.defaults %}
|
53
|
+
{% assign panel_config_settings = blocks.panel.settings %}
|
54
|
+
{% assign footer_config_defaults = blocks.defaults.footer.defaults %}
|
55
|
+
{% assign toccer_defaults = modules.defaults.toccer.defaults %}
|
56
|
+
|
57
|
+
{% assign themer_defaults = modules.defaults.themer.defaults %}
|
58
|
+
{% assign themer_settings = modules.themer.settings %}
|
59
|
+
|
60
|
+
{% assign tracking_enabled = template_config.analytics.enabled %}
|
61
|
+
{% assign tracking_id = template_config.analytics.google.tracking_id %}
|
62
|
+
|
63
|
+
{% assign authentication_defaults = modules.defaults.authentication.defaults %}
|
64
|
+
{% assign authentication_settings = modules.authentication.settings %}
|
64
65
|
|
65
66
|
{% comment %} Set config options
|
66
67
|
-------------------------------------------------------------------------------- {% endcomment %}
|
67
|
-
{% assign toccer_options
|
68
|
-
{% assign themer_options
|
68
|
+
{% assign toccer_options = toccer_defaults | merge: toccer_settings %}
|
69
|
+
{% assign themer_options = themer_defaults| merge: themer_settings %}
|
69
70
|
|
70
|
-
{% assign authentication_options
|
71
|
+
{% assign authentication_options = authentication_defaults | merge: authentication_settings %}
|
71
72
|
|
72
|
-
{% assign footer_id
|
73
|
-
{% assign footer_data_path
|
74
|
-
{% assign banner_data_path
|
75
|
-
{% assign panel_data_path
|
73
|
+
{% assign footer_id = footer_config_defaults.container-id %}
|
74
|
+
{% assign footer_data_path = footer_config_defaults.data_path %}
|
75
|
+
{% assign banner_data_path = banner_config_defaults.data_path %}
|
76
|
+
{% assign panel_data_path = panel_config_defaults.data_path %}
|
76
77
|
|
77
|
-
{% assign
|
78
|
+
{% assign themer_enabled = modules.themer_options.enabled %}
|
79
|
+
{% assign themer_reloadPageOnChange = modules.themer_options.reloadPageOnChange %}
|
80
|
+
{% assign themer_hideOnReload = modules.themer_options.hideOnReload %}
|
81
|
+
{% assign comment_provider = template_config.comments.provider %}
|
82
|
+
|
83
|
+
{% comment %} Set variables
|
84
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
85
|
+
{% if comment_provider == 'disqus' %}
|
86
|
+
{% assign site_id = template_config.comments.disqus.site_id %}
|
87
|
+
{% elsif comment_provider == 'hyvor' %}
|
88
|
+
{% assign site_id = template_config.comments.hyvor.site_id %}
|
89
|
+
{% elsif comment_provider == 'commento' %}
|
90
|
+
{% assign site_id = template_config.comments.commento.site_id %}
|
91
|
+
{% elsif comment_provider == 'just-comments' %}
|
92
|
+
{% assign site_id = template_config.comments.just-comments.site_id %}
|
93
|
+
{% elsif comment_provider == 'facebook' %}
|
94
|
+
{% assign site_id = template_config.comments.facebook.site_id %}
|
95
|
+
{% else %}
|
96
|
+
{% assign site_id = false %}
|
97
|
+
{% endif %}
|
78
98
|
|
79
99
|
{% assign production = false %}
|
80
100
|
{% if environment == 'prod' or environment == 'production' %}
|
81
101
|
{% assign production = true %}
|
82
102
|
{% endif %}
|
83
103
|
|
104
|
+
{% comment %} language detection
|
105
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
106
|
+
{% if site.language == "en" %}
|
107
|
+
{% assign language = "en" %}
|
108
|
+
{% elsif site.language == "de"%}
|
109
|
+
{% assign language = "de" %}
|
110
|
+
{% else %}
|
111
|
+
{% assign language = "en" %}
|
112
|
+
{% endif %}
|
113
|
+
|
114
|
+
{% if language == "en" %}
|
115
|
+
{% assign comments_headline = template_config.comments.comments_headline.en %}
|
116
|
+
{% endif %}
|
117
|
+
|
118
|
+
{% if language == "de" %}
|
119
|
+
{% assign comments_headline = template_config.comments.comments_headline.de %}
|
120
|
+
{% endif %}
|
121
|
+
|
84
122
|
/*
|
85
123
|
# -----------------------------------------------------------------------------
|
86
124
|
# ~/assets/themes/j1/adapter/js/j1_template.js
|
@@ -124,11 +162,18 @@ var j1 = (function () {
|
|
124
162
|
var state = 'not_started';
|
125
163
|
var mode = 'not_detected';
|
126
164
|
|
127
|
-
//
|
165
|
+
// Default tracking provider information
|
128
166
|
var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
|
129
167
|
var tracking_id = '{{tracking_id}}';
|
130
168
|
var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
|
131
169
|
|
170
|
+
// Default comment provider information
|
171
|
+
var comment_provider = '{{comment_provider}}';
|
172
|
+
var site_id = '{{site_id}}';
|
173
|
+
|
174
|
+
// Default translator settings (currently NOT supported)
|
175
|
+
// var translation_enabled = {{template_config.translation.enabled}};
|
176
|
+
|
132
177
|
var current_user_data;
|
133
178
|
var current_page;
|
134
179
|
var previous_page;
|
@@ -138,15 +183,12 @@ var j1 = (function () {
|
|
138
183
|
var user_session_detected;
|
139
184
|
var cookie_written;
|
140
185
|
|
141
|
-
// Translatior settings (currently NOT supported)
|
142
|
-
// var translation_enabled = {{template_config.translation.enabled}};
|
143
|
-
|
144
186
|
// Theme information
|
145
187
|
var themeName;
|
146
188
|
var themeCss;
|
147
189
|
var cssExtension = (environment === 'production')
|
148
190
|
? '.min.css'
|
149
|
-
: '.css'
|
191
|
+
: '.css'
|
150
192
|
|
151
193
|
// Pathes of J1 data files
|
152
194
|
var colors_data_path = '{{template_config.colors_data_path}}';
|
@@ -165,7 +207,7 @@ var j1 = (function () {
|
|
165
207
|
var baseUrl;
|
166
208
|
var referrer;
|
167
209
|
|
168
|
-
// initial cookie
|
210
|
+
// initial cookie settings
|
169
211
|
var cookie_names = {
|
170
212
|
'app_session': '{{template_config.cookies.app_session}}',
|
171
213
|
'user_session': '{{template_config.cookies.user_session}}',
|
@@ -191,9 +233,8 @@ var j1 = (function () {
|
|
191
233
|
};
|
192
234
|
var user_state = {
|
193
235
|
'writer': 'j1.adapter',
|
194
|
-
'theme_css': '',
|
195
|
-
'theme_css': '',
|
196
236
|
'theme_name': '',
|
237
|
+
'theme_css': '',
|
197
238
|
'theme_author': '',
|
198
239
|
'theme_version': '{{template_version}}',
|
199
240
|
'session_active': false,
|
@@ -233,9 +274,15 @@ var j1 = (function () {
|
|
233
274
|
var logger = log4javascript.getLogger('j1.init');
|
234
275
|
var url = new liteURL(window.location.href);
|
235
276
|
var baseUrl = url.origin;
|
277
|
+
var hostname = url.hostname;
|
278
|
+
var domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
|
279
|
+
var secure = (url.protocol.includes('https')) ? true : false;
|
236
280
|
var date = new Date();
|
237
281
|
var timestamp_now = date.toISOString();
|
238
282
|
var curr_state = 'started';
|
283
|
+
var gaCookies = j1.findCookie('_ga');
|
284
|
+
var j1Cookies = j1.findCookie('j1');
|
285
|
+
var themerOptions = $.extend({}, {{themer_options | replace: '=>', ':' | replace: 'nil', '""' }});
|
239
286
|
|
240
287
|
// -----------------------------------------------------------------------
|
241
288
|
// options loader
|
@@ -269,43 +316,52 @@ var j1 = (function () {
|
|
269
316
|
var url;
|
270
317
|
var baseUrl;
|
271
318
|
|
319
|
+
// final update of the user state cookie before browser page|tab
|
320
|
+
// get closed
|
272
321
|
if (user_state) {
|
273
322
|
user_state.session_active = false;
|
274
323
|
user_state.last_session_ts = timestamp_now;
|
275
324
|
|
276
325
|
if (!user_consent.analyses || !user_consent.personalization) {
|
277
|
-
//
|
326
|
+
// rewrite consent|state cookies to session
|
327
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_consent);
|
278
328
|
cookie_written = j1.writeCookie({
|
279
329
|
name: cookie_names.user_consent,
|
280
|
-
data:
|
281
|
-
samesite: 'Strict'
|
330
|
+
data: user_consent,
|
331
|
+
samesite: 'Strict',
|
332
|
+
secure: secure,
|
333
|
+
expires: 0
|
282
334
|
});
|
283
335
|
if (!cookie_written) {
|
284
|
-
logger.error('failed to write cookie: ' + cookie_names.user_consent);
|
336
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
|
285
337
|
}
|
338
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
286
339
|
cookie_written = j1.writeCookie({
|
287
340
|
name: cookie_names.user_state,
|
288
341
|
data: user_state,
|
289
|
-
samesite: 'Strict'
|
342
|
+
samesite: 'Strict',
|
343
|
+
secure: secure,
|
344
|
+
expires: 0
|
290
345
|
});
|
291
346
|
if (!cookie_written) {
|
292
|
-
logger.error('failed to write cookie: ' + cookie_names.user_consent);
|
347
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
|
293
348
|
}
|
294
349
|
} else {
|
350
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
295
351
|
cookie_written = j1.writeCookie({
|
296
352
|
name: cookie_names.user_state,
|
297
353
|
data: user_state,
|
298
354
|
samesite: 'Strict',
|
355
|
+
secure: secure,
|
299
356
|
expires: 365
|
300
357
|
});
|
301
358
|
if (!cookie_written) {
|
302
|
-
logger.error('failed to write cookie: ' + cookie_names.user_state);
|
359
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
303
360
|
}
|
304
361
|
}
|
305
362
|
} else {
|
306
|
-
// jadams, 2021-07-11: on beforeunload, a
|
307
|
-
|
308
|
-
logger.fatal('missing cookie detected for: ' + cookie_names.user_state);
|
363
|
+
// jadams, 2021-07-11: on beforeunload, a user state cookie is expected
|
364
|
+
logger.error('\n' + 'missing cookie detected: ' + cookie_names.user_state);
|
309
365
|
}
|
310
366
|
}); // END beforeunload
|
311
367
|
|
@@ -321,10 +377,12 @@ var j1 = (function () {
|
|
321
377
|
: cookie_written = j1.writeCookie({
|
322
378
|
name: cookie_names.user_session,
|
323
379
|
data: user_session,
|
324
|
-
samesite: 'Strict'
|
380
|
+
samesite: 'Strict',
|
381
|
+
secure: secure,
|
382
|
+
expires: 0
|
325
383
|
});
|
326
384
|
if (!cookie_written) {
|
327
|
-
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
385
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
328
386
|
}
|
329
387
|
|
330
388
|
user_state = j1.existsCookie(cookie_names.user_state)
|
@@ -333,10 +391,11 @@ var j1 = (function () {
|
|
333
391
|
name: cookie_names.user_state,
|
334
392
|
data: user_state,
|
335
393
|
samesite: 'Strict',
|
394
|
+
secure: secure,
|
336
395
|
expires: 365
|
337
396
|
});
|
338
397
|
if (!cookie_written) {
|
339
|
-
logger.error('failed to write cookie: ' + cookie_names.user_state);
|
398
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
340
399
|
}
|
341
400
|
|
342
401
|
// jadams, 2021-07-11: Found situation that user_state NOT initialized
|
@@ -344,30 +403,39 @@ var j1 = (function () {
|
|
344
403
|
// TODO: Check if/why user state (cookie NOT created?) NOT initialized
|
345
404
|
// for what reason.
|
346
405
|
if (!user_state) {
|
347
|
-
logger.
|
406
|
+
logger.error('\n' + 'cookie not found: ' + cookie_names.user_state);
|
407
|
+
logger.debug('\n' + 'j1 cookies found:' + j1Cookies.length);
|
408
|
+
j1Cookies.forEach(item => console.log('j1.core.switcher: ' + item));
|
409
|
+
logger.debug('\n' + 'ga cookies found:' + gaCookies.length);
|
410
|
+
gaCookies.forEach(item => console.log('j1.core.switcher: ' + item));
|
348
411
|
user_state = j1.readCookie(cookie_names.user_state);
|
349
412
|
user_state.session_active = true;
|
350
413
|
}
|
351
414
|
|
352
415
|
if (!user_consent.analyses || !user_consent.personalization) {
|
353
|
-
//
|
416
|
+
// rewrite consent|state cookies to session
|
417
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
354
418
|
cookie_written = j1.writeCookie({
|
355
419
|
name: cookie_names.user_state,
|
356
420
|
data: user_state,
|
357
|
-
samesite: 'Strict'
|
421
|
+
samesite: 'Strict',
|
422
|
+
secure: secure,
|
423
|
+
expires: 0
|
358
424
|
});
|
359
425
|
if (!cookie_written) {
|
360
|
-
logger.error('failed to write cookie: ' + cookie_names.user_state);
|
426
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
361
427
|
}
|
362
428
|
} else {
|
429
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
|
363
430
|
cookie_written = j1.writeCookie({
|
364
431
|
name: cookie_names.user_state,
|
365
432
|
data: user_state,
|
366
433
|
samesite: 'Strict',
|
434
|
+
secure: secure,
|
367
435
|
expires: 365
|
368
436
|
});
|
369
437
|
if (!cookie_written) {
|
370
|
-
logger.error('failed to write cookie: ' + cookie_names.user_state);
|
438
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
|
371
439
|
}
|
372
440
|
}
|
373
441
|
|
@@ -391,40 +459,43 @@ var j1 = (function () {
|
|
391
459
|
user_session.requested_page = window.location.pathname;
|
392
460
|
user_session.timestamp = timestamp_now;
|
393
461
|
user_session = j1.mergeData(user_session, data);
|
394
|
-
logText = 'mode detected: ' + user_session.mode;
|
462
|
+
logText = '\n' + 'mode detected: ' + user_session.mode;
|
395
463
|
|
396
464
|
logger.info(logText);
|
397
|
-
logger.info('update user session cookie');
|
465
|
+
logger.info('\n' + 'update user session cookie');
|
466
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
398
467
|
cookie_written = j1.writeCookie({
|
399
468
|
name: cookie_names.user_session,
|
400
469
|
data: user_session,
|
401
|
-
samesite: 'Strict'
|
470
|
+
samesite: 'Strict',
|
471
|
+
secure: secure,
|
472
|
+
expires: 0
|
402
473
|
});
|
403
474
|
|
404
475
|
if (!cookie_written) {
|
405
|
-
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
476
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
406
477
|
}
|
407
478
|
|
408
479
|
j1.setState(curr_state);
|
409
|
-
logger.info('state: ' + j1.getState());
|
480
|
+
logger.info('\n' + 'state: ' + j1.getState());
|
410
481
|
|
411
482
|
var dependencies_met_page_displayed = setInterval (function () {
|
412
483
|
if (j1.getState() == 'finished') {
|
413
484
|
if (j1.authEnabled()) {
|
414
485
|
if (user_session.authenticated === 'true') {
|
415
486
|
// set signout
|
416
|
-
logger.info('show signout icon');
|
487
|
+
logger.info('\n' + 'show signout icon');
|
417
488
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignOut');
|
418
489
|
$('#iconSignInOut').removeClass('mdi-login').addClass('mdi-logout');
|
419
490
|
} else {
|
420
491
|
// set signin
|
421
|
-
logger.info('show signin icon');
|
492
|
+
logger.info('\n' + 'show signin icon');
|
422
493
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignIn');
|
423
494
|
$('#iconSignInOut').removeClass('mdi-logout').addClass('mdi-login');
|
424
495
|
}
|
425
|
-
logger.info('authentication detected as: ' + user_session.authenticated);
|
496
|
+
logger.info('\n' + 'authentication detected as: ' + user_session.authenticated);
|
426
497
|
$('#quickLinksSignInOutButton').css('display', 'block');
|
427
|
-
logger.info('met dependencies for: j1');
|
498
|
+
logger.info('\n' + 'met dependencies for: j1');
|
428
499
|
clearInterval(dependencies_met_page_displayed);
|
429
500
|
}
|
430
501
|
}
|
@@ -438,38 +509,41 @@ var j1 = (function () {
|
|
438
509
|
user_session.mode = 'web';
|
439
510
|
user_session.requested_page = window.location.pathname;
|
440
511
|
user_session.timestamp = timestamp_now;
|
441
|
-
logText = 'mode detected: ' + user_session.mode;
|
512
|
+
logText = '\n' + 'mode detected: ' + user_session.mode;
|
442
513
|
|
443
514
|
logger.info(logText);
|
515
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
444
516
|
cookie_written = j1.writeCookie({
|
445
517
|
name: cookie_names.user_session,
|
446
518
|
data: user_session,
|
447
|
-
samesite: 'Strict'
|
519
|
+
samesite: 'Strict',
|
520
|
+
secure: secure,
|
521
|
+
expires: 0
|
448
522
|
});
|
449
523
|
if (!cookie_written) {
|
450
|
-
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
524
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
451
525
|
}
|
452
526
|
|
453
527
|
j1.setState(curr_state);
|
454
|
-
logger.info('state: ' + j1.getState());
|
528
|
+
logger.info('\n' + 'state: ' + j1.getState());
|
455
529
|
}, detectTimeout);
|
456
530
|
});
|
457
531
|
} else { // web mode
|
458
532
|
state = 'started';
|
459
|
-
logger.info('state: ' + state);
|
460
|
-
logger.info('page is being initialized');
|
533
|
+
logger.info('\n' + 'state: ' + state);
|
534
|
+
logger.info('\n' + 'page is being initialized');
|
461
535
|
}
|
462
536
|
|
463
537
|
state = 'started';
|
464
|
-
logger.info('state: ' + state);
|
465
|
-
logger.info('page is being initialized');
|
538
|
+
logger.info('\n' + 'state: ' + state);
|
539
|
+
logger.info('\n' + 'page is being initialized');
|
466
540
|
|
467
541
|
if ( settings.scrollbar === 'false' ) {
|
468
542
|
$('body').addClass('hide-scrollbar');
|
469
543
|
$('html').addClass('hide-scrollbar-moz');
|
470
544
|
}
|
471
545
|
|
472
|
-
logger.info('read user state from cookie');
|
546
|
+
logger.info('\n' + 'read user state from cookie');
|
473
547
|
user_session = j1.readCookie(cookie_names.user_session);
|
474
548
|
|
475
549
|
// process|update user state cookie
|
@@ -499,15 +573,18 @@ var j1 = (function () {
|
|
499
573
|
last_pager = user_session.last_pager;
|
500
574
|
}
|
501
575
|
|
502
|
-
logger.info('update user session cookie');
|
576
|
+
logger.info('\n' + 'update user session cookie');
|
577
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
503
578
|
cookie_written = j1.writeCookie({
|
504
579
|
name: cookie_names.user_session,
|
505
580
|
data: user_session,
|
506
|
-
samesite: 'Strict'
|
581
|
+
samesite: 'Strict',
|
582
|
+
secure: secure,
|
583
|
+
expires: 0
|
507
584
|
});
|
508
585
|
|
509
586
|
if (!cookie_written) {
|
510
|
-
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
587
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
511
588
|
}
|
512
589
|
|
513
590
|
// NOTE: asynchronous calls should be rewitten to xhrData
|
@@ -517,17 +594,20 @@ var j1 = (function () {
|
|
517
594
|
j1.initFooter(settings);
|
518
595
|
|
519
596
|
state = 'running';
|
520
|
-
logger.info('state: ' + state);
|
521
|
-
logger.info(logText);
|
597
|
+
logger.info('\n' + 'state: ' + state);
|
598
|
+
// logger.info(logText);
|
522
599
|
|
523
600
|
user_session.timestamp = timestamp_now;
|
601
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
524
602
|
cookie_written = j1.writeCookie({
|
525
603
|
name: cookie_names.user_session,
|
526
604
|
data: user_session,
|
527
|
-
samesite: 'Strict'
|
605
|
+
samesite: 'Strict',
|
606
|
+
secure: secure,
|
607
|
+
expires: 0
|
528
608
|
});
|
529
609
|
if (!cookie_written) {
|
530
|
-
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
610
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
531
611
|
}
|
532
612
|
|
533
613
|
// -----------------------------------------------------------------------
|
@@ -559,20 +639,20 @@ var j1 = (function () {
|
|
559
639
|
return function ( responseTxt, statusTxt, xhr ) {
|
560
640
|
if ( statusTxt == 'success' ) {
|
561
641
|
var logger = log4javascript.getLogger('j1.adapter.xhrData');
|
562
|
-
logText = 'loading banner completed on id: ' +banner_id;
|
642
|
+
logText = '\n' + 'loading banner completed on id: ' +banner_id;
|
563
643
|
logger.info(logText);
|
564
644
|
j1.setXhrDataState(banner_id, statusTxt);
|
565
645
|
j1.setXhrDomState(banner_id, statusTxt);
|
566
|
-
logger.info('XHR data loaded in the DOM: ' + banner_id);
|
646
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + banner_id);
|
567
647
|
}
|
568
648
|
if ( statusTxt == 'error' ) {
|
569
|
-
logText = 'loading banner failed on id: ' +banner_id+ ', error: ' + xhr.status + ': ' + xhr.statusText;
|
649
|
+
logText = '\n' + 'loading banner failed on id: ' +banner_id+ ', error: ' + xhr.status + ': ' + xhr.statusText;
|
570
650
|
logger.error(logText);
|
571
651
|
j1.setXhrDataState(banner_id, statusTxt);
|
572
652
|
j1.setXhrDomState(banner_id, statusTxt);
|
573
653
|
// Set|Log status
|
574
654
|
state = 'failed';
|
575
|
-
logger.error('state: ' + state);
|
655
|
+
logger.error('\n' + 'state: ' + state);
|
576
656
|
}
|
577
657
|
};
|
578
658
|
};
|
@@ -633,15 +713,15 @@ var j1 = (function () {
|
|
633
713
|
var id = '#' + banner[i];
|
634
714
|
var selector = $(id);
|
635
715
|
if (selector.length) {
|
636
|
-
logText = 'loading banner on id: ' +banner[i];
|
716
|
+
logText = '\n' + 'loading banner on id: ' +banner[i];
|
637
717
|
logger.info(logText);
|
638
718
|
var banner_data_path = '{{banner_data_path}} ' + id;
|
639
719
|
selector.load(banner_data_path, cb_load_closure(id));
|
640
720
|
}
|
641
721
|
} // END for
|
642
722
|
} else {
|
643
|
-
logText = 'no banner found in site';
|
644
|
-
logger.
|
723
|
+
logText = '\n' + 'no banner found in site';
|
724
|
+
logger.warn(logText);
|
645
725
|
return false;
|
646
726
|
}
|
647
727
|
return true;
|
@@ -670,20 +750,20 @@ var j1 = (function () {
|
|
670
750
|
return function ( responseTxt, statusTxt, xhr ) {
|
671
751
|
var logger = log4javascript.getLogger('j1.adapter.xhrData');
|
672
752
|
if ( statusTxt == 'success' ) {
|
673
|
-
logText = 'loading panel completed on id: ' +panel_id;
|
753
|
+
logText = '\n' + 'loading panel completed on id: ' +panel_id;
|
674
754
|
logger.info(logText);
|
675
755
|
j1.setXhrDataState(panel_id, statusTxt);
|
676
756
|
j1.setXhrDomState(panel_id, statusTxt);
|
677
|
-
logger.info('XHR data loaded in the DOM: ' + panel_id);
|
757
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + panel_id);
|
678
758
|
}
|
679
759
|
if ( statusTxt == 'error' ) {
|
680
|
-
logText = 'loading panel failed on id: ' +panel_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
760
|
+
logText = '\n' + 'loading panel failed on id: ' +panel_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
681
761
|
logger.error(logText);
|
682
762
|
j1.setXhrDataState(panel_id, statusTxt);
|
683
763
|
j1.setXhrDomState(panel_id, statusTxt);
|
684
764
|
// Set|Log status
|
685
765
|
state = 'Error';
|
686
|
-
logger.error('state: ' + state);
|
766
|
+
logger.error('\n' + 'state: ' + state);
|
687
767
|
}
|
688
768
|
};
|
689
769
|
};
|
@@ -736,15 +816,15 @@ var j1 = (function () {
|
|
736
816
|
var id = '#' + panel[i];
|
737
817
|
var selector = $(id);
|
738
818
|
if ( selector.length ) {
|
739
|
-
logText = 'loading panel on id: ' +panel[i];
|
819
|
+
logText = '\n' + 'loading panel on id: ' +panel[i];
|
740
820
|
logger.info(logText);
|
741
821
|
var panel_data_path = '{{panel_data_path}} ' + id;
|
742
822
|
selector.load(panel_data_path, cb_load_closure(id));
|
743
823
|
}
|
744
824
|
} // END for
|
745
825
|
} else {
|
746
|
-
logText = 'no panel found in site';
|
747
|
-
logger.
|
826
|
+
logText = '\n' + 'no panel found in site';
|
827
|
+
logger.warn(logText);
|
748
828
|
return false;
|
749
829
|
}
|
750
830
|
return true;
|
@@ -759,31 +839,31 @@ var j1 = (function () {
|
|
759
839
|
var mod = 'j1';
|
760
840
|
var logText;
|
761
841
|
|
762
|
-
logText = 'loading footer started';
|
842
|
+
logText = '\n' + 'loading footer started';
|
763
843
|
logger.info(logText);
|
764
844
|
|
765
845
|
var cb_load_closure = function(footer_id) {
|
766
846
|
return function ( responseTxt, statusTxt, xhr ) {
|
767
847
|
var logger = log4javascript.getLogger('j1.adapter.xhrData');
|
768
848
|
if ( statusTxt == 'success' ) {
|
769
|
-
logText = 'footer loaded successfully on id: ' + footer_id;
|
849
|
+
logText = '\n' + 'footer loaded successfully on id: ' + footer_id;
|
770
850
|
logger.info(logText);
|
771
851
|
j1.setXhrDataState(footer_id, statusTxt);
|
772
852
|
j1.setXhrDomState(footer_id, statusTxt);
|
773
|
-
logger.info('XHR data loaded in the DOM: ' + footer_id);
|
774
|
-
logText = 'initialization finished';
|
853
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + footer_id);
|
854
|
+
logText = '\n' + 'initialization finished';
|
775
855
|
logger.info(logText);
|
776
856
|
}
|
777
857
|
if ( statusTxt == 'error' ) {
|
778
|
-
logText = 'loading footer failed on id: ' +footer_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
858
|
+
logText = '\n' + 'loading footer failed on id: ' +footer_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
779
859
|
logger.error(logText);
|
780
860
|
j1.setXhrDataState(footer_id, statusTxt);
|
781
861
|
j1.setXhrDomState(footer_id, statusTxt);
|
782
862
|
|
783
863
|
// Set|Log status
|
784
864
|
state = 'failed';
|
785
|
-
logger.error('state: ' + state);
|
786
|
-
logText = 'initialization finished';
|
865
|
+
logger.error('\n' + 'state: ' + state);
|
866
|
+
logText = '\n' + 'initialization finished';
|
787
867
|
logger.info(logText);
|
788
868
|
}
|
789
869
|
};
|
@@ -795,7 +875,7 @@ var j1 = (function () {
|
|
795
875
|
var footer_data_path = '{{footer_data_path}} ' + id;
|
796
876
|
selector.load(footer_data_path, cb_load_closure(id));
|
797
877
|
} else {
|
798
|
-
logText = 'data not loaded';
|
878
|
+
logText = '\n' + 'data not loaded';
|
799
879
|
logger.warn(logText);
|
800
880
|
j1.setXhrDataState(id, 'not loaded');
|
801
881
|
j1.setXhrDomState(id, 'pending');
|
@@ -819,9 +899,11 @@ var j1 = (function () {
|
|
819
899
|
var flickerTimeout = {{template_config.flicker_timeout}};
|
820
900
|
var url = new liteURL(window.location.href);
|
821
901
|
var baseUrl = url.origin;
|
902
|
+
var secure = (url.protocol.includes('https')) ? true : false;
|
822
903
|
var ep_status = baseUrl + '/status' + '?page=' + window.location.pathname;
|
823
904
|
var user_session = j1.readCookie(cookie_names.user_session);
|
824
905
|
var user_state = j1.readCookie(cookie_names.user_state);
|
906
|
+
var user_consent = j1.readCookie(cookie_names.user_consent);
|
825
907
|
var current_url = new liteURL(window.location.href);
|
826
908
|
var providerPermissions = {};
|
827
909
|
var provider;
|
@@ -829,14 +911,36 @@ var j1 = (function () {
|
|
829
911
|
var appDetected;
|
830
912
|
var categoryAllowed;
|
831
913
|
|
832
|
-
|
914
|
+
// provider APIs require user consent
|
915
|
+
var meta_analytics = $('meta[name=analytics]').attr('content');
|
916
|
+
var analytics = (meta_analytics === 'true') ? true: false;
|
917
|
+
var meta_comments = $('meta[name=comments]').attr('content');
|
918
|
+
var comments = (meta_comments === 'true') ? true: false;
|
919
|
+
var meta_advertising = $('meta[name=advertising]').attr('content');
|
920
|
+
var advertising = (meta_advertising === 'true') ? true: false;
|
921
|
+
var meta_youtube = $('meta[name=youtube]').attr('content');
|
922
|
+
var youtube = (meta_youtube === 'true') ? true: false;
|
923
|
+
var meta_vimeo = $('meta[name=vimeo]').attr('content');
|
924
|
+
var vimeo = (meta_vimeo === 'true') ? true: false;
|
925
|
+
|
926
|
+
// personalized content require user consent
|
927
|
+
var meta_personalization = $('meta[name=personalization]').attr('content');
|
928
|
+
var personalization = (meta_personalization === 'true') ? true: false;
|
929
|
+
|
930
|
+
// if personalized content detected, page requires user consent
|
931
|
+
if (personalization && !user_consent.personalization) {
|
932
|
+
// redirect to error paged (blocked content)
|
933
|
+
window.location.href = "/444.html";
|
934
|
+
}
|
935
|
+
|
936
|
+
logger.info('\n' + 'finalize page');
|
833
937
|
j1.setCss();
|
834
938
|
|
835
|
-
logText= 'loading page partials: started';
|
939
|
+
logText= '\n' + 'loading page partials: started';
|
836
940
|
logger.info(logText);
|
837
941
|
|
838
942
|
if (j1.appDetected()) { // app mode
|
839
|
-
logger.info('mode detected: app');
|
943
|
+
logger.info('\n' + 'mode detected: app');
|
840
944
|
|
841
945
|
$.when ($.ajax(ep_status))
|
842
946
|
.then(function(data) {
|
@@ -845,13 +949,16 @@ var j1 = (function () {
|
|
845
949
|
user_session = j1.mergeData(user_session, data);
|
846
950
|
|
847
951
|
user_session.current_page = current_url.pathname;
|
952
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
848
953
|
cookie_written = j1.writeCookie({
|
849
954
|
name: cookie_names.user_session,
|
850
955
|
data: user_session,
|
851
|
-
samesite: 'Strict'
|
956
|
+
samesite: 'Strict',
|
957
|
+
secure: secure,
|
958
|
+
expires: 0
|
852
959
|
});
|
853
960
|
if (!cookie_written) {
|
854
|
-
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
961
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
855
962
|
}
|
856
963
|
|
857
964
|
providerPermissions = user_session.provider_permissions;
|
@@ -878,26 +985,66 @@ var j1 = (function () {
|
|
878
985
|
|
879
986
|
// show the page delayed
|
880
987
|
setTimeout (function() {
|
988
|
+
|
989
|
+
// Manage providers for personalization OptIn/Out (Comments|Ads)
|
990
|
+
if (!user_consent.personalization) {
|
991
|
+
logger.warn('\n' + 'disable comment provider: ' + comment_provider);
|
992
|
+
$('#leave-a-comment').remove();
|
993
|
+
if (comment_provider === 'disqus') {
|
994
|
+
$('#dsq-count-scr').remove();
|
995
|
+
$('#disqus-thread').remove();
|
996
|
+
}
|
997
|
+
if (comment_provider === 'hyvor') {
|
998
|
+
$('#hyvor-embed').remove();
|
999
|
+
$('#hyvor-talk-view').remove();
|
1000
|
+
}
|
1001
|
+
} else {
|
1002
|
+
if (comments) {
|
1003
|
+
logger.warn('\n' + 'enable comment provider: ' + comment_provider);
|
1004
|
+
$('#main-content').append('<h2 id="leave-a-comment" class="mt-4">{{comments_headline}}</h2>');
|
1005
|
+
if (comment_provider === 'disqus') {
|
1006
|
+
logger.info('\n' + 'load comment provider code: ' + comment_provider);
|
1007
|
+
$('#main-content').append('<div id="disqus_thread"></div>');
|
1008
|
+
$('body').append('<script async id="dsq-count-scr" src="//' + site_id + '.disqus.com/count.js"></script>');
|
1009
|
+
j1.loadJS({
|
1010
|
+
xhr_data_path: '/assets/data/' + comment_provider + '.js',
|
1011
|
+
xhr_data_element: comment_provider
|
1012
|
+
});
|
1013
|
+
}
|
1014
|
+
if (comment_provider === 'hyvor') {
|
1015
|
+
$('body').append('<script> var HYVOR_TALK_WEBSITE = ' + site_id + '; var HYVOR_TALK_CONFIG = { url: false, id: false };');
|
1016
|
+
$('#main-content').append('<div id="hyvor-talk-view"></div>');
|
1017
|
+
$('body').append('<script async id="hyvor-embed" type="text/javascript" src="//talk.hyvor.com/web-api/embed.js"></script>');
|
1018
|
+
}
|
1019
|
+
} // END comments
|
1020
|
+
} // END personalization
|
1021
|
+
|
881
1022
|
// display page
|
882
|
-
|
1023
|
+
$('#no_flicker').css('display', 'block');
|
883
1024
|
|
884
1025
|
// NOTE: Placed tracking warning/info here because page may reloaded
|
885
1026
|
// after cookie consent selection
|
886
|
-
|
887
|
-
|
888
|
-
|
1027
|
+
if (user_consent.analyses) {
|
1028
|
+
logger.info('\n' + 'tracking allowed, privacy settings for analysis: ' + user_consent.analyses);
|
1029
|
+
if (tracking_enabled && !tracking_id_valid) {
|
1030
|
+
logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
|
1031
|
+
} else if (tracking_enabled && tracking_id_valid) {
|
1032
|
+
logger.warn('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
|
1033
|
+
} else {
|
1034
|
+
logger.warn('\n' + 'tracking disabled, tracking id found: ' + tracking_id);
|
1035
|
+
}
|
889
1036
|
} else {
|
890
|
-
logger.warn('tracking
|
1037
|
+
logger.warn('\n' + 'tracking not allowed, privacy settings for analysis: ' + user_consent.analyses);
|
891
1038
|
}
|
892
1039
|
|
893
1040
|
// show|hide cookie icon (should MOVED to Cookiebar ???)
|
894
1041
|
if (j1.existsCookie(cookie_names.user_consent)) {
|
895
1042
|
// Display cookie icon
|
896
|
-
logText = 'show cookie icon';
|
1043
|
+
logText = '\n' + 'show cookie icon';
|
897
1044
|
logger.info(logText);
|
898
1045
|
$('#quickLinksCookieButton').css('display', 'block');
|
899
1046
|
} else {
|
900
|
-
logText = 'hide cookie icon';
|
1047
|
+
logText = '\n' + 'hide cookie icon';
|
901
1048
|
logger.info(logText);
|
902
1049
|
// Display cookie icon
|
903
1050
|
$('#quickLinksCookieButton').css('display', 'none');
|
@@ -905,8 +1052,8 @@ var j1 = (function () {
|
|
905
1052
|
|
906
1053
|
// show|hide translator icon (currently NOT supported)
|
907
1054
|
// if (translation_enabled) {
|
908
|
-
// logger.info('translator detected: google');
|
909
|
-
// logger.info('initialize language selector');
|
1055
|
+
// logger.info('\n' + 'translator detected: google');
|
1056
|
+
// logger.info('\n' + 'initialize language selector');
|
910
1057
|
// $('.goog-te-combo').addClass('form-control');
|
911
1058
|
// }
|
912
1059
|
|
@@ -916,16 +1063,16 @@ var j1 = (function () {
|
|
916
1063
|
if (j1.authEnabled()) {
|
917
1064
|
if (user_session.authenticated === 'true') {
|
918
1065
|
// set signout
|
919
|
-
logger.info('show signout icon');
|
1066
|
+
logger.info('\n' + 'show signout icon');
|
920
1067
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignOut');
|
921
1068
|
$('#iconSignInOut').removeClass('mdi-login').addClass('mdi-logout');
|
922
1069
|
} else {
|
923
1070
|
// set signin
|
924
|
-
logger.info('show signin icon');
|
1071
|
+
logger.info('\n' + 'show signin icon');
|
925
1072
|
$('#navLinkSignInOut').attr('data-target','#modalOmniSignIn');
|
926
1073
|
$('#iconSignInOut').removeClass('mdi-logout').addClass('mdi-login');
|
927
1074
|
}
|
928
|
-
logger.info('authentication detected as: ' + user_session.authenticated);
|
1075
|
+
logger.info('\n' + 'authentication detected as: ' + user_session.authenticated);
|
929
1076
|
$('#quickLinksSignInOutButton').css('display', 'block');
|
930
1077
|
}
|
931
1078
|
|
@@ -934,25 +1081,25 @@ var j1 = (function () {
|
|
934
1081
|
j1.scrollTo();
|
935
1082
|
|
936
1083
|
if (user_session.previous_page !== user_session.current_page) {
|
937
|
-
logText = 'page change detected';
|
1084
|
+
logText = '\n' + 'page change detected';
|
938
1085
|
logger.info(logText);
|
939
|
-
logText = 'previous page: ' + user_session.previous_page;
|
1086
|
+
logText = '\n' + 'previous page: ' + user_session.previous_page;
|
940
1087
|
logger.info(logText);
|
941
|
-
logText = 'current page: ' + user_session.current_page;
|
1088
|
+
logText = '\n' + 'current page: ' + user_session.current_page;
|
942
1089
|
logger.info(logText);
|
943
1090
|
}
|
944
1091
|
|
945
1092
|
// update sidebar for changed theme data
|
946
|
-
logger.info('update sidebar');
|
1093
|
+
logger.info('\n' + 'update sidebar');
|
947
1094
|
user_state = j1.readCookie(cookie_names.user_state);
|
948
1095
|
current_user_data = j1.mergeData(user_session, user_state);
|
949
1096
|
j1.core.navigator.updateSidebar(current_user_data);
|
950
1097
|
|
951
1098
|
// Set|Log status
|
952
1099
|
state = 'finished';
|
953
|
-
logText = 'state: ' + state;
|
1100
|
+
logText = '\n' + 'state: ' + state;
|
954
1101
|
logger.info(logText);
|
955
|
-
logText = 'page finalized successfully';
|
1102
|
+
logText = '\n' + 'page finalized successfully';
|
956
1103
|
logger.info(logText);
|
957
1104
|
|
958
1105
|
}, flickerTimeout);
|
@@ -961,39 +1108,81 @@ var j1 = (function () {
|
|
961
1108
|
// show the page delayed
|
962
1109
|
setTimeout (function() {
|
963
1110
|
j1.setState('finished');
|
964
|
-
logger.info('state: finished');
|
965
|
-
logger.info('page initialization: finished');
|
1111
|
+
logger.info('\n' + 'state: finished');
|
1112
|
+
logger.info('\n' + 'page initialization: finished');
|
1113
|
+
|
1114
|
+
// Manage providers for personalization OptIn/Out (Comments|Ads)
|
1115
|
+
if (!user_consent.personalization) {
|
1116
|
+
logger.warn('\n' + 'disable comment provider: ' + comment_provider);
|
1117
|
+
$('#leave-a-comment').remove();
|
1118
|
+
if (comment_provider === 'disqus') {
|
1119
|
+
$('#dsq-count-scr').remove();
|
1120
|
+
$('#disqus-thread').remove();
|
1121
|
+
}
|
1122
|
+
if (comment_provider === 'hyvor') {
|
1123
|
+
$('#hyvor-embed').remove();
|
1124
|
+
$('#hyvor-talk-view').remove();
|
1125
|
+
}
|
1126
|
+
} else {
|
1127
|
+
if (comments) {
|
1128
|
+
logger.warn('\n' + 'enable comment provider: ' + comment_provider);
|
1129
|
+
$('#main-content').append('<h2 id="leave-a-comment" class="mt-4">{{comments_headline}}</h2>');
|
1130
|
+
if (comment_provider === 'disqus') {
|
1131
|
+
logger.info('\n' + 'load comment provider code: ' + comment_provider);
|
1132
|
+
$('#main-content').append('<div id="disqus_thread"></div>');
|
1133
|
+
$('body').append('<script async id="dsq-count-scr" src="//' + site_id + '.disqus.com/count.js"></script>');
|
1134
|
+
j1.loadJS({
|
1135
|
+
xhr_data_path: '/assets/data/' + comment_provider + '.js',
|
1136
|
+
xhr_data_element: comment_provider
|
1137
|
+
});
|
1138
|
+
}
|
1139
|
+
if (comment_provider === 'hyvor') {
|
1140
|
+
$('body').append('<script> var HYVOR_TALK_WEBSITE = ' + site_id + '; var HYVOR_TALK_CONFIG = { url: false, id: false };');
|
1141
|
+
$('#main-content').append('<div id="hyvor-talk-view"></div>');
|
1142
|
+
$('body').append('<script async id="hyvor-embed" type="text/javascript" src="//talk.hyvor.com/web-api/embed.js"></script>');
|
1143
|
+
}
|
1144
|
+
} // END comments
|
1145
|
+
} // END personalization
|
966
1146
|
|
967
1147
|
// display page
|
968
1148
|
$('#no_flicker').css('display', 'block');
|
969
1149
|
|
970
1150
|
// NOTE: Placed tracking warning/info here because page may reloaded
|
971
1151
|
// after cookie consent selection
|
972
|
-
|
973
|
-
|
974
|
-
|
1152
|
+
if (user_consent.analyses) {
|
1153
|
+
logger.info('\n' + 'tracking allowed, privacy settings for analysis: ' + user_consent.analyses);
|
1154
|
+
if (tracking_enabled && !tracking_id_valid) {
|
1155
|
+
logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
|
1156
|
+
} else if (tracking_enabled && tracking_id_valid) {
|
1157
|
+
logger.warn('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
|
1158
|
+
} else {
|
1159
|
+
logger.warn('\n' + 'tracking disabled, tracking id found: ' + tracking_id);
|
1160
|
+
}
|
975
1161
|
} else {
|
976
|
-
logger.warn('tracking
|
1162
|
+
logger.warn('\n' + 'tracking not allowed, privacy settings for analysis: ' + user_consent.analyses);
|
977
1163
|
}
|
978
1164
|
|
979
|
-
logger.info('mode detected: web');
|
980
|
-
logger.info('hide signin icon');
|
1165
|
+
logger.info('\n' + 'mode detected: web');
|
1166
|
+
logger.info('\n' + 'hide signin icon');
|
981
1167
|
$('#quickLinksSignInOutButton').css('display', 'none');
|
982
1168
|
|
983
1169
|
user_session.current_page = current_url.pathname;
|
1170
|
+
logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
|
984
1171
|
cookie_written = j1.writeCookie({
|
985
1172
|
name: cookie_names.user_session,
|
986
1173
|
data: user_session,
|
987
|
-
samesite: 'Strict'
|
1174
|
+
samesite: 'Strict',
|
1175
|
+
secure: secure,
|
1176
|
+
expires: 0
|
988
1177
|
});
|
989
1178
|
if (!cookie_written) {
|
990
|
-
logger.error('failed to write cookie: ' + cookie_names.user_session);
|
1179
|
+
logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
|
991
1180
|
}
|
992
1181
|
|
993
1182
|
// show|hide translator icon (currently NOT supported)
|
994
1183
|
// if (translation_enabled) {
|
995
|
-
// logger.info('translator detected: google');
|
996
|
-
// logger.info('initialize language selector');
|
1184
|
+
// logger.info('\n' + 'translator detected: google');
|
1185
|
+
// logger.info('\n' + 'initialize language selector');
|
997
1186
|
// $('.goog-te-combo').addClass('form-control');
|
998
1187
|
// }
|
999
1188
|
|
@@ -1003,11 +1192,11 @@ var j1 = (function () {
|
|
1003
1192
|
// show|hide cookie icon
|
1004
1193
|
if (j1.existsCookie(cookie_names.user_consent)) {
|
1005
1194
|
// Display cookie icon
|
1006
|
-
logText = 'show cookie icon';
|
1195
|
+
logText = '\n' + 'show cookie icon';
|
1007
1196
|
logger.info(logText);
|
1008
1197
|
$('#quickLinksCookieButton').css('display', 'block');
|
1009
1198
|
} else {
|
1010
|
-
logText = 'hide cookie icon';
|
1199
|
+
logText = '\n' + 'hide cookie icon';
|
1011
1200
|
logger.info(logText);
|
1012
1201
|
// Display cookie icon
|
1013
1202
|
$('#quickLinksCookieButton').css('display', 'none');
|
@@ -1018,25 +1207,25 @@ var j1 = (function () {
|
|
1018
1207
|
j1.scrollTo();
|
1019
1208
|
|
1020
1209
|
if (user_session.previous_page !== user_session.current_page) {
|
1021
|
-
logText = 'page change detected';
|
1210
|
+
logText = '\n' + 'page change detected';
|
1022
1211
|
logger.info(logText);
|
1023
|
-
logText = 'previous page: ' + user_session.previous_page;
|
1212
|
+
logText = '\n' + 'previous page: ' + user_session.previous_page;
|
1024
1213
|
logger.info(logText);
|
1025
|
-
logText = 'current page: ' + user_session.current_page;
|
1214
|
+
logText = '\n' + 'current page: ' + user_session.current_page;
|
1026
1215
|
logger.info(logText);
|
1027
1216
|
}
|
1028
1217
|
|
1029
1218
|
// update sidebar for changed theme data
|
1030
|
-
logger.info('update sidebar');
|
1219
|
+
logger.info('\n' + 'update sidebar');
|
1031
1220
|
user_state = j1.readCookie(cookie_names.user_state);
|
1032
1221
|
current_user_data = j1.mergeData(user_session, user_state);
|
1033
1222
|
j1.core.navigator.updateSidebar(current_user_data);
|
1034
1223
|
|
1035
1224
|
// set|log status
|
1036
1225
|
state = 'finished';
|
1037
|
-
logText = 'state: ' + state;
|
1226
|
+
logText = '\n' + 'state: ' + state;
|
1038
1227
|
logger.info(logText);
|
1039
|
-
logText = 'page finalized successfully';
|
1228
|
+
logText = '\n' + 'page finalized successfully';
|
1040
1229
|
logger.info(logText);
|
1041
1230
|
|
1042
1231
|
}, flickerTimeout);
|
@@ -1144,7 +1333,7 @@ var j1 = (function () {
|
|
1144
1333
|
$(window).scrollTop($(window).scrollTop()-1);
|
1145
1334
|
} // END if anchor_id
|
1146
1335
|
} else if (anchor_id === '#') {
|
1147
|
-
logger.info('bound click event to "#", suppress default action');
|
1336
|
+
logger.info('\n' + 'bound click event to "#", suppress default action');
|
1148
1337
|
$(window).scrollTop($(window).scrollTop()+1);
|
1149
1338
|
$(window).scrollTop($(window).scrollTop()-1);
|
1150
1339
|
return false;
|
@@ -1182,12 +1371,12 @@ var j1 = (function () {
|
|
1182
1371
|
}, // END appDetected
|
1183
1372
|
|
1184
1373
|
// -------------------------------------------------------------------------
|
1185
|
-
//
|
1186
|
-
// Load data asychronously using XHR|jQuery on an
|
1374
|
+
// loadHTML()
|
1375
|
+
// Load HTML data asychronously using XHR|jQuery on an element (e.g. <div>)
|
1187
1376
|
// specified by xhr_container_id, xhr_data_path (options)
|
1188
1377
|
// -------------------------------------------------------------------------
|
1189
|
-
|
1190
|
-
var logger = log4javascript.getLogger('j1.adapter.
|
1378
|
+
loadHTML: function (options, mod, status) {
|
1379
|
+
var logger = log4javascript.getLogger('j1.adapter.loadHTML');
|
1191
1380
|
var selector = $('#' + options.xhr_container_id);
|
1192
1381
|
var state = status;
|
1193
1382
|
var observer_options = {
|
@@ -1201,12 +1390,12 @@ var j1 = (function () {
|
|
1201
1390
|
|
1202
1391
|
var cb_load_closure = function(mod, id) {
|
1203
1392
|
return function (responseTxt, statusTxt, xhr) {
|
1204
|
-
var logger = log4javascript.getLogger('j1.adapter.
|
1393
|
+
var logger = log4javascript.getLogger('j1.adapter.loadHTML');
|
1205
1394
|
if ( statusTxt === 'success' ) {
|
1206
1395
|
j1.setXhrDataState(id, statusTxt);
|
1207
1396
|
j1.setXhrDomState(id, 'pending');
|
1208
1397
|
|
1209
|
-
logText = 'data loaded successfully on id: ' +id;
|
1398
|
+
logText = '\n' + 'data loaded successfully on id: ' +id;
|
1210
1399
|
logger.info(logText);
|
1211
1400
|
state = true;
|
1212
1401
|
}
|
@@ -1214,12 +1403,12 @@ var j1 = (function () {
|
|
1214
1403
|
// jadams, 2020-07-21: to be checked why id could be UNDEFINED
|
1215
1404
|
if (typeof(id) != "undefined") {
|
1216
1405
|
state = 'failed';
|
1217
|
-
logger.info('set state for ' +mod+ ' to: ' + state);
|
1406
|
+
logger.info('\n' + 'set state for ' +mod+ ' to: ' + state);
|
1218
1407
|
// jadams, 2020-07-21: intermediate state should DISABLED
|
1219
1408
|
// executeFunctionByName(mod + '.setState', window, state);
|
1220
1409
|
j1.setXhrDataState(id, statusTxt);
|
1221
1410
|
j1.setXhrDomState(id, 'pending');
|
1222
|
-
logText = 'loading data failed on id: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
1411
|
+
logText = '\n' + 'loading data failed on id: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
1223
1412
|
logger.error(logText);
|
1224
1413
|
state = false;
|
1225
1414
|
}
|
@@ -1240,9 +1429,9 @@ var j1 = (function () {
|
|
1240
1429
|
|
1241
1430
|
// failsafe - prevent XHR load errors
|
1242
1431
|
if (options.xhr_data_element !== '') {
|
1243
|
-
logger.info('XHR data element found: ' + options.xhr_data_element);
|
1432
|
+
logger.info('\n' + 'XHR data element found: ' + options.xhr_data_element);
|
1244
1433
|
} else {
|
1245
|
-
logger.warn('no XHR data element found, loading data aborted');
|
1434
|
+
logger.warn('\n' + 'no XHR data element found, loading data aborted');
|
1246
1435
|
return;
|
1247
1436
|
}
|
1248
1437
|
|
@@ -1264,33 +1453,71 @@ var j1 = (function () {
|
|
1264
1453
|
function mutationHandler (mutationRecords) {
|
1265
1454
|
mutationRecords.forEach ( function (mutation) {
|
1266
1455
|
if (mutation.addedNodes.length) {
|
1267
|
-
logger.info('XHR data loaded in the DOM: ' + id);
|
1456
|
+
logger.info('\n' + 'XHR data loaded in the DOM: ' + id);
|
1268
1457
|
j1.setXhrDomState(id, 'success');
|
1269
1458
|
}
|
1270
1459
|
});
|
1271
1460
|
}
|
1272
1461
|
} else {
|
1273
1462
|
// jadams, 2020-07-21: To be clarified why a id is "undefined"
|
1274
|
-
|
1275
1463
|
// failsafe - prevent XHR load errors
|
1276
1464
|
if (id != '#undefined') {
|
1277
|
-
logText = 'data not loaded on id:' + id;
|
1465
|
+
logText = '\n' + 'data not loaded on id:' + id;
|
1278
1466
|
logger.warn(logText);
|
1279
1467
|
j1.setXhrDataState(id, 'not loaded');
|
1280
1468
|
j1.setXhrDomState(id, 'not loaded');
|
1281
1469
|
// Set processing state to 'finished' to complete module load
|
1282
1470
|
state = 'finished';
|
1283
|
-
logger.info('state: ' + state);
|
1471
|
+
logger.info('\n' + 'state: ' + state);
|
1284
1472
|
// jadams, 2020-07-21: intermediate state should DISABLED
|
1285
1473
|
// executeFunctionByName(mod + '.setState', window, state);
|
1286
1474
|
state = false;
|
1287
1475
|
}
|
1288
1476
|
}
|
1289
1477
|
return state;
|
1290
|
-
}, // END
|
1478
|
+
}, // END loadHTML
|
1479
|
+
|
1480
|
+
// -------------------------------------------------------------------------
|
1481
|
+
// loadJS()
|
1482
|
+
// Load JS data asychronously using jQuery (XHR)
|
1483
|
+
// -------------------------------------------------------------------------
|
1484
|
+
loadJS: function (options, mod, status) {
|
1485
|
+
var logger = log4javascript.getLogger('j1.adapter.loadJS');
|
1486
|
+
var state = status;
|
1487
|
+
var logText;
|
1488
|
+
|
1489
|
+
var cb_load_closure = function(mod, id) {
|
1490
|
+
return function (responseTxt, statusTxt, xhr) {
|
1491
|
+
var logger = log4javascript.getLogger('j1.adapter.loadJS');
|
1492
|
+
if ( statusTxt === 'success' ) {
|
1493
|
+
j1.setXhrDataState(id, statusTxt);
|
1494
|
+
|
1495
|
+
logText = '\n' + 'data loaded successfully for: ' +id;
|
1496
|
+
logger.info(logText);
|
1497
|
+
state = true;
|
1498
|
+
}
|
1499
|
+
if ( statusTxt === 'error' ) {
|
1500
|
+
state = 'failed';
|
1501
|
+
logger.info('\n' + 'set state for ' +mod+ ' to: ' + state);
|
1502
|
+
j1.setXhrDataState(id, statusTxt);
|
1503
|
+
logText = '\n' + 'loading data failed for: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
|
1504
|
+
logger.error(logText);
|
1505
|
+
state = false;
|
1506
|
+
}
|
1507
|
+
};
|
1508
|
+
};
|
1509
|
+
|
1510
|
+
$.ajax({
|
1511
|
+
url: options.xhr_data_path,
|
1512
|
+
dataType: 'script',
|
1513
|
+
success: cb_load_closure(mod, options.xhr_data_element)
|
1514
|
+
});
|
1515
|
+
|
1516
|
+
return state;
|
1517
|
+
}, // END loadJS
|
1291
1518
|
|
1292
1519
|
// -------------------------------------------------------------------------
|
1293
|
-
// readCookie()
|
1520
|
+
// readCookie (Vanilla JS)
|
1294
1521
|
// -------------------------------------------------------------------------
|
1295
1522
|
readCookie: function (name) {
|
1296
1523
|
var data;
|
@@ -1312,23 +1539,7 @@ var j1 = (function () {
|
|
1312
1539
|
}, // END readCookie
|
1313
1540
|
|
1314
1541
|
// -------------------------------------------------------------------------
|
1315
|
-
//
|
1316
|
-
// Search for cookies (names) in the page header that matches a given
|
1317
|
-
// name. Cookie name can be give as full name, like 'j1.user.state', or
|
1318
|
-
// as partials like 'j1'
|
1319
|
-
// Returns all names found as an array.
|
1320
|
-
// -------------------------------------------------------------------------
|
1321
|
-
// See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
|
1322
|
-
// -------------------------------------------------------------------------
|
1323
|
-
findCookie: function (name) {
|
1324
|
-
var r=[];
|
1325
|
-
|
1326
|
-
document.cookie.replace(new RegExp(name + '[^= ]*', 'g'), function(a){ r.push(a.trim()); });
|
1327
|
-
return r;
|
1328
|
-
}, // END findCookie
|
1329
|
-
|
1330
|
-
// -------------------------------------------------------------------------
|
1331
|
-
// writeCookie()
|
1542
|
+
// writeCookie (Cookie lib)
|
1332
1543
|
// Write 'data' to a cookie 'name'. If not exists, the cookie gets
|
1333
1544
|
// created. Returns 'true' if cookie was written, otherwise 'false'.
|
1334
1545
|
// -------------------------------------------------------------------------
|
@@ -1337,6 +1548,14 @@ var j1 = (function () {
|
|
1337
1548
|
// https://developer.mozilla.org/de/docs/Web/HTTP/Headers/Set-Cookie/SameSite
|
1338
1549
|
// https://www.smarketer.de/blog/chrome-update-80-cookies/
|
1339
1550
|
// -------------------------------------------------------------------------
|
1551
|
+
// SESSION Cookies:
|
1552
|
+
// NOT putting an EXPIRES part in will create a session cookie.
|
1553
|
+
// -------------------------------------------------------------------------
|
1554
|
+
// REMOVING Cookies: Cookies get removed immediately, if the expires
|
1555
|
+
// part points to a PAST date (e.g. 01 Jan 1970 00:00:00 UTC).
|
1556
|
+
// -------------------------------------------------------------------------
|
1557
|
+
// MAX-AGE Cookies: To leave cookies for a specific time, set the expires
|
1558
|
+
// part into a FUTUTE date. FOR GDPR compliance, MAX-AGE is 365 days.
|
1340
1559
|
// TODO:
|
1341
1560
|
// Change attribute "Secure" to true, if HTTPS is used.
|
1342
1561
|
// Checks and config changes are to be done.
|
@@ -1353,58 +1572,58 @@ var j1 = (function () {
|
|
1353
1572
|
// must now also specify the Secure attribute (they require a secure
|
1354
1573
|
// context/HTTPS).
|
1355
1574
|
// -------------------------------------------------------------------------
|
1356
|
-
|
1357
|
-
|
1575
|
+
writeCookie: function (options /*name, data, [path, expires, domain, samesite, http_only, secure]*/) {
|
1576
|
+
var date = new Date();
|
1577
|
+
var timestamp_now = date.toISOString();
|
1578
|
+
var cookie_data = {};
|
1579
|
+
var data_json;
|
1580
|
+
var data_encoded;
|
1581
|
+
var expires;
|
1582
|
+
var stringifiedAttributes = '';
|
1583
|
+
|
1358
1584
|
var defaults = {
|
1359
1585
|
data: {},
|
1360
1586
|
name: '',
|
1361
1587
|
path: '/',
|
1362
1588
|
expires: 0,
|
1363
|
-
|
1589
|
+
domain: 'localhost',
|
1590
|
+
samesite: 'Strict',
|
1364
1591
|
http_only: false,
|
1365
1592
|
secure: false
|
1366
1593
|
};
|
1594
|
+
|
1367
1595
|
var settings = $.extend(defaults, options);
|
1368
|
-
|
1369
|
-
|
1370
|
-
var cookie_data = {};
|
1371
|
-
var data_json;
|
1372
|
-
var data_encoded;
|
1596
|
+
|
1597
|
+
cookie_data.timestamp = timestamp_now;
|
1373
1598
|
|
1374
1599
|
if (j1.existsCookie(settings.name)) {
|
1375
|
-
cookie_data
|
1376
|
-
cookie_data.
|
1377
|
-
|
1378
|
-
|
1379
|
-
data_encoded = window.btoa(data_json);
|
1380
|
-
|
1381
|
-
if (settings.expires > 0) {
|
1382
|
-
Cookies.set(settings.name, data_encoded, {
|
1383
|
-
expires: settings.expires,
|
1384
|
-
SameSite: settings.samesite
|
1385
|
-
});
|
1386
|
-
} else {
|
1387
|
-
Cookies.set(settings.name, data_encoded, {
|
1388
|
-
SameSite: settings.samesite
|
1389
|
-
});
|
1390
|
-
}
|
1600
|
+
cookie_data = j1.readCookie(settings.name);
|
1601
|
+
cookie_data = j1.mergeData(cookie_data, settings.data);
|
1602
|
+
data_json = JSON.stringify( cookie_data );
|
1603
|
+
data_encoded = window.btoa(data_json);
|
1391
1604
|
} else {
|
1392
1605
|
cookie_data = settings.data;
|
1393
1606
|
data_json = JSON.stringify(settings.data);
|
1394
1607
|
data_encoded = window.btoa(data_json);
|
1608
|
+
}
|
1395
1609
|
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
} else {
|
1402
|
-
Cookies.set(settings.name, data_encoded, {
|
1403
|
-
SameSite: settings.samesite
|
1404
|
-
});
|
1405
|
-
}
|
1610
|
+
stringifiedAttributes += '; ' + 'path=' + settings.path;
|
1611
|
+
|
1612
|
+
if (settings.expires > 0) {
|
1613
|
+
date.setTime(date.getTime() + (settings.expires * 24 * 60 * 60 * 1000));
|
1614
|
+
stringifiedAttributes += '; ' + 'expires=' + date.toUTCString();
|
1406
1615
|
}
|
1407
1616
|
|
1617
|
+
stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
|
1618
|
+
|
1619
|
+
if (settings.secure) {
|
1620
|
+
stringifiedAttributes += '; ' + 'secure=' + settings.secure;
|
1621
|
+
}
|
1622
|
+
|
1623
|
+
// write the cookie
|
1624
|
+
// document.cookie = settings.name + '=' + content + '; path=' + settings.path + '; domain=' + settings.domain + '; ' + 'SameSite=' + settings.samesite + '; secure';
|
1625
|
+
document.cookie = settings.name + '=' + data_encoded + stringifiedAttributes;
|
1626
|
+
|
1408
1627
|
if (j1.existsCookie(settings.name)) {
|
1409
1628
|
return cookie_data;
|
1410
1629
|
} else {
|
@@ -1414,63 +1633,112 @@ var j1 = (function () {
|
|
1414
1633
|
}, // END writeCookie
|
1415
1634
|
|
1416
1635
|
// -------------------------------------------------------------------------
|
1417
|
-
//
|
1418
|
-
//
|
1419
|
-
//
|
1420
|
-
//
|
1421
|
-
//
|
1636
|
+
// findCookie (Vanilla JS)
|
1637
|
+
// Search for cookies (names) in the page header that matches a given
|
1638
|
+
// name. Cookie name can be give as full name, like 'j1.user.state', or
|
1639
|
+
// as a partial like 'j1'
|
1640
|
+
// Returns all names found as an array.
|
1422
1641
|
// -------------------------------------------------------------------------
|
1423
|
-
|
1642
|
+
// See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
|
1643
|
+
// -------------------------------------------------------------------------
|
1644
|
+
findCookie: function (name) {
|
1645
|
+
var rCookie=[];
|
1646
|
+
document.cookie.replace(new RegExp(name + '[^= ]*', 'g'), function(a){ rCookie.push(a.trim()); });
|
1647
|
+
|
1648
|
+
return rCookie;
|
1649
|
+
}, // END findCookie
|
1650
|
+
|
1651
|
+
// -------------------------------------------------------------------------
|
1652
|
+
// removeCookie (Vanilla JS)
|
1653
|
+
// -------------------------------------------------------------------------
|
1654
|
+
removeCookie: function (options /*name, [path, domain]*/) {
|
1424
1655
|
var cookieExists;
|
1425
1656
|
var defaults = {
|
1426
|
-
|
1657
|
+
domain: 'localhost',
|
1427
1658
|
path: '/'
|
1428
1659
|
};
|
1429
1660
|
var settings = $.extend(defaults, options);
|
1430
1661
|
|
1431
|
-
|
1432
|
-
|
1662
|
+
if (j1.findCookie(settings.name)) {
|
1663
|
+
// clear cookie CONTENT and set expiry date in the PAST
|
1664
|
+
document.cookie = settings.name + '=; domain=' + settings.domain + '; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
|
1665
|
+
return true;
|
1666
|
+
} else {
|
1667
|
+
return false;
|
1668
|
+
}
|
1433
1669
|
}, // END removeCookie
|
1434
1670
|
|
1435
1671
|
// -------------------------------------------------------------------------
|
1436
|
-
//
|
1437
|
-
//
|
1438
|
-
//
|
1439
|
-
//
|
1672
|
+
// expireCookie (Vanilla JS)
|
1673
|
+
// Expires given cookies by name except cookies set to httpOnly. For all
|
1674
|
+
// cookies the expiry date is REMOVED. This results in cookies are set
|
1675
|
+
// to 'session' for the expiry date. All session cookies are deleted
|
1676
|
+
// automatically by the browser if the last session (browser tab|window)
|
1677
|
+
// is closed.
|
1678
|
+
// -------------------------------------------------------------------------
|
1679
|
+
// expireCookie() returns 'true' if cookie is set successfully,
|
1680
|
+
// otherwise 'false' (e.g NOT found)
|
1681
|
+
// -------------------------------------------------------------------------
|
1682
|
+
// NOTE:
|
1440
1683
|
// See: https://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript
|
1684
|
+
// NOTE:
|
1685
|
+
// There is NO way you could get a trace of Path, Domain and other
|
1686
|
+
// attributes of cookies as they are only read by browsers and NOT shown
|
1687
|
+
// to JavaScript. For that reason, attributes needs to be set explicitly.
|
1441
1688
|
// -------------------------------------------------------------------------
|
1442
|
-
|
1443
|
-
var
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1689
|
+
expireCookie: function (options /*name [,path, samesite, secure]*/) {
|
1690
|
+
var defaults = {
|
1691
|
+
path: '/',
|
1692
|
+
samesite: 'Strict',
|
1693
|
+
secure: false
|
1694
|
+
};
|
1695
|
+
var settings = $.extend(defaults, options);
|
1696
|
+
|
1697
|
+
var dc = document.cookie; // all cookies in page
|
1698
|
+
var end = dc.length; // default to end of the string
|
1699
|
+
var prefix = settings.name + '='; // search string for the cookie name given
|
1700
|
+
var begin = dc.indexOf('; ' + prefix);
|
1701
|
+
var content = '';
|
1702
|
+
|
1703
|
+
// collect the cookie content
|
1704
|
+
//
|
1705
|
+
// found, and not in the first position
|
1706
|
+
if (begin !== -1) {
|
1707
|
+
// exclude the "; "
|
1708
|
+
begin += 2;
|
1709
|
+
} else {
|
1710
|
+
// see if cookie is in first position
|
1711
|
+
begin = dc.indexOf(prefix);
|
1712
|
+
// not found at all or found as a portion of another cookie name
|
1713
|
+
if (begin === -1 || begin !== 0 ) return false;
|
1714
|
+
}
|
1715
|
+
|
1716
|
+
// if ";" is found somewhere after the prefix position then "end" is
|
1717
|
+
// that position, otherwise it defaults to the end of the string
|
1718
|
+
if (dc.indexOf(';', begin) !== -1) {
|
1719
|
+
end = dc.indexOf(';', begin);
|
1720
|
+
}
|
1721
|
+
|
1722
|
+
// expire cookie to session
|
1723
|
+
content = decodeURI(dc.substring(begin + prefix.length, end) ).replace(/"/g, '');
|
1724
|
+
if (settings.secure) {
|
1725
|
+
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; secure';
|
1459
1726
|
} else {
|
1460
|
-
document.cookie = name + '
|
1727
|
+
document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite;
|
1461
1728
|
}
|
1462
1729
|
|
1463
1730
|
return true;
|
1464
|
-
}, // END
|
1731
|
+
}, // END expireCookie
|
1465
1732
|
|
1466
1733
|
// -------------------------------------------------------------------------
|
1467
|
-
//
|
1734
|
+
// existsCookie (Vanilla JS)
|
1735
|
+
// returns true if a given cookie exists
|
1468
1736
|
// -------------------------------------------------------------------------
|
1469
1737
|
existsCookie: function (name) {
|
1470
1738
|
var dc = document.cookie;
|
1471
1739
|
var prefix = name + '=';
|
1472
1740
|
var begin = dc.indexOf('; ' + prefix);
|
1473
|
-
var end = dc.length;
|
1741
|
+
var end = dc.length; // default to end of the string
|
1474
1742
|
var cookieExists = false;
|
1475
1743
|
var cookieContent = '';
|
1476
1744
|
|
@@ -1563,11 +1831,11 @@ var j1 = (function () {
|
|
1563
1831
|
});
|
1564
1832
|
|
1565
1833
|
});
|
1566
|
-
logger.info('met dependencies for: sidebarLoaded');
|
1834
|
+
logger.info('\n' + 'met dependencies for: sidebarLoaded');
|
1567
1835
|
clearInterval(sidebarLoaded);
|
1568
1836
|
return true;
|
1569
1837
|
} else {
|
1570
|
-
logger.error('no user data provided');
|
1838
|
+
logger.error('\n' + 'no user data provided');
|
1571
1839
|
clearInterval(sidebarLoaded);
|
1572
1840
|
return false;
|
1573
1841
|
}
|
@@ -1621,11 +1889,11 @@ var j1 = (function () {
|
|
1621
1889
|
});
|
1622
1890
|
|
1623
1891
|
});
|
1624
|
-
logger.info('met dependencies for: sidebarLoaded');
|
1892
|
+
logger.info('\n' + 'met dependencies for: sidebarLoaded');
|
1625
1893
|
clearInterval(sidebarLoaded);
|
1626
1894
|
return true;
|
1627
1895
|
} else {
|
1628
|
-
logger.error('no user data provided');
|
1896
|
+
logger.error('\n' + 'no user data provided');
|
1629
1897
|
clearInterval(sidebarLoaded);
|
1630
1898
|
return false;
|
1631
1899
|
}
|
@@ -1664,11 +1932,11 @@ var j1 = (function () {
|
|
1664
1932
|
var json_message = JSON.stringify(message);
|
1665
1933
|
|
1666
1934
|
if ( receiver === 'j1' ) {
|
1667
|
-
logText = 'send message from ' + sender + ' to' + receiver + ': ' + json_message;
|
1935
|
+
logText = '\n' + 'send message from ' + sender + ' to' + receiver + ': ' + json_message;
|
1668
1936
|
logger.debug(logText);
|
1669
1937
|
executeFunctionByName('j1' + '.messageHandler', window, sender, message);
|
1670
1938
|
} else {
|
1671
|
-
logText = 'send message from ' + sender + ' to ' + receiver + ': ' + json_message;
|
1939
|
+
logText = '\n' + 'send message from ' + sender + ' to ' + receiver + ': ' + json_message;
|
1672
1940
|
logger.debug(logText);
|
1673
1941
|
//executeFunctionByName('j1.' + receiver + '.messageHandler', window, sender, message)
|
1674
1942
|
executeFunctionByName(receiver + '.messageHandler', window, sender, message);
|
@@ -1684,7 +1952,7 @@ var j1 = (function () {
|
|
1684
1952
|
// var json_message = JSON.stringify(message, undefined, 2); // multiline
|
1685
1953
|
var json_message = JSON.stringify(message);
|
1686
1954
|
|
1687
|
-
logText = 'received message from ' + sender + ': ' + json_message;
|
1955
|
+
logText = '\n' + 'received message from ' + sender + ': ' + json_message;
|
1688
1956
|
logger.debug(logText);
|
1689
1957
|
|
1690
1958
|
// -----------------------------------------------------------------------
|
@@ -1692,7 +1960,7 @@ var j1 = (function () {
|
|
1692
1960
|
// -----------------------------------------------------------------------
|
1693
1961
|
if ( message.type === 'command' && message.action === 'module_initialized' ) {
|
1694
1962
|
_this.setState('finished');
|
1695
|
-
logger.info(message.text);
|
1963
|
+
logger.info('\n' + message.text);
|
1696
1964
|
}
|
1697
1965
|
|
1698
1966
|
//
|
@@ -1755,7 +2023,7 @@ var j1 = (function () {
|
|
1755
2023
|
var bg_primary = j1.getStyleValue('bg-primary', 'background-color');
|
1756
2024
|
var bg_secondary = j1.getStyleValue('bg-secondary', 'background-color');
|
1757
2025
|
|
1758
|
-
logger.info('set color scheme for selected theme');
|
2026
|
+
logger.info('\n' + 'set color scheme for selected theme');
|
1759
2027
|
|
1760
2028
|
// globals
|
1761
2029
|
// -----------------------------------------------------------------------
|