j1-template 2021.1.2 → 2021.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/layout_metadata_generator.html +23 -9
  3. data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +7 -15
  4. data/_includes/themes/j1/modules/connectors/analytic/google-analytics.html +9 -5
  5. data/_includes/themes/j1/modules/navigator/generator.html +2 -2
  6. data/_includes/themes/j1/modules/navigator/procedures/topsearch.proc +2 -2
  7. data/_includes/themes/j1/procedures/posts/collate_timeline.proc +8 -7
  8. data/_layouts/default.html +4 -7
  9. data/assets/data/authclient.html +231 -229
  10. data/assets/data/banner.html +30 -32
  11. data/assets/data/cookieconsent.html +249 -0
  12. data/assets/data/fam.html +1 -1
  13. data/assets/data/footer.html +1 -1
  14. data/assets/data/gallery_customizer.html +10 -5
  15. data/assets/data/menu.html +3 -3
  16. data/assets/data/mmenu.html +4 -3
  17. data/assets/data/mmenu_sidebar.html +1 -1
  18. data/assets/data/mmenu_toc.html +1 -1
  19. data/assets/data/panel.html +11 -10
  20. data/assets/data/quicklinks.html +20 -18
  21. data/assets/data/themes.json +6 -6
  22. data/assets/themes/j1/adapter/js/{cookiebar.js → cookieConsent.js} +129 -55
  23. data/assets/themes/j1/adapter/js/j1.js +160 -151
  24. data/assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js +3 -2
  25. data/assets/themes/j1/adapter/js/mmenu.js +8 -4
  26. data/assets/themes/j1/adapter/js/navigator.1.js +896 -0
  27. data/assets/themes/j1/adapter/js/navigator.2.js +928 -0
  28. data/assets/themes/j1/adapter/js/navigator.js +176 -209
  29. data/assets/themes/j1/adapter/js/themer.1.js +326 -0
  30. data/assets/themes/j1/adapter/js/themer.js +41 -57
  31. data/assets/themes/j1/adapter/js/toccer.js +4 -45
  32. data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.css +17 -14
  33. data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.min.css +1 -1
  34. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +3859 -187
  35. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +1 -1
  36. data/assets/themes/j1/core/js/template.js +3 -9
  37. data/assets/themes/j1/core/js/template.js.map +1 -1
  38. data/assets/themes/j1/core/js/template.min.js +3 -9
  39. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  40. data/assets/themes/j1/modules/cookieConsent/LICENSE +21 -0
  41. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +286 -0
  42. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +28 -0
  43. data/assets/themes/j1/modules/fam/css/{uno → theme/uno}/fam.css +0 -0
  44. data/assets/themes/j1/modules/fam/css/theme/uno/fam.min.css +15 -0
  45. data/assets/themes/j1/modules/fam/js/fam.js +1 -6
  46. data/assets/themes/j1/modules/iframeResizer/examples/frame.absolute.html +4 -2
  47. data/assets/themes/j1/modules/iframeResizer/examples/frame.content.html +4 -3
  48. data/assets/themes/j1/modules/iframeResizer/examples/frame.hover.html +4 -2
  49. data/assets/themes/j1/modules/iframeResizer/examples/frame.nested.html +4 -2
  50. data/assets/themes/j1/modules/iframeResizer/examples/frame.textarea.html +4 -2
  51. data/assets/themes/j1/modules/iframeResizer/examples/frame.tolerance.html +4 -2
  52. data/assets/themes/j1/modules/iframeResizer/examples/index.html +2 -0
  53. data/assets/themes/j1/modules/iframeResizer/examples/two.html +4 -2
  54. data/assets/themes/j1/modules/mmenuLight/css/{mmenu.css → mmenu-light.css} +0 -0
  55. data/assets/themes/j1/modules/mmenuLight/css/{mmenu.min.css → mmenu-light.min.css} +0 -0
  56. data/assets/themes/j1/modules/mmenuLight/css/theme/{uno.css → uno/mmenu.css} +0 -0
  57. data/assets/themes/j1/modules/mmenuLight/css/theme/{uno.min.css → uno/mmenu.min.css} +0 -0
  58. data/assets/themes/j1/modules/rtable/css/theme/{uno.css → uno/rtable.css} +0 -0
  59. data/assets/themes/j1/modules/rtable/css/theme/{uno.min.css → uno/rtable.min.css} +0 -0
  60. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +33 -47
  61. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +410 -2
  62. data/assets/themes/j1/modules/util/js/domready.js +146 -0
  63. data/assets/themes/j1/modules/util/js/gtag-opt-in.js +1 -0
  64. data/lib/j1/version.rb +1 -1
  65. data/lib/j1_app/j1_auth_manager/auth_manager.rb +2 -3
  66. data/lib/starter_web/Gemfile +1 -1
  67. data/lib/starter_web/_config.yml +6 -5
  68. data/lib/starter_web/_data/_defaults/resources.yml +11 -8
  69. data/lib/starter_web/_data/apps/defaults/justifiedGalleryCustomizer.yml +1 -0
  70. data/lib/starter_web/_data/blocks/banner.yml +5 -3
  71. data/lib/starter_web/_data/blocks/panel.yml +9 -7
  72. data/lib/starter_web/_data/builder/blog_navigator.yml +1 -0
  73. data/lib/starter_web/_data/j1_config.yml +20 -17
  74. data/lib/starter_web/_data/layouts/default.yml +1 -1
  75. data/lib/starter_web/_data/layouts/home.yml +6 -5
  76. data/lib/starter_web/_data/layouts/page.yml +1 -1
  77. data/lib/starter_web/_data/modules/{cookiebar.yml → cookieconsent.yml} +4 -4
  78. data/lib/starter_web/_data/modules/defaults/authentication.yml +1 -0
  79. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +135 -0
  80. data/lib/starter_web/_data/modules/defaults/navigator.yml +5 -2
  81. data/lib/starter_web/_data/modules/defaults/themer.yml +2 -1
  82. data/lib/starter_web/_data/modules/navigator.yml +24 -21
  83. data/lib/starter_web/_data/pages/builder.yml +7 -7
  84. data/lib/starter_web/_data/private.default.yml +119 -0
  85. data/lib/starter_web/_data/private.yml +6 -6
  86. data/lib/starter_web/_data/resources.yml +15 -14
  87. data/lib/starter_web/_includes/attributes.asciidoc +10 -1
  88. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  89. data/lib/starter_web/assets/images/modules/attics/{cookies-1920x1200-bw.jpg → cookies-1920x1200.jpg} +0 -0
  90. data/lib/starter_web/assets/images/modules/attics/lianhao-1920x1280.jpg +0 -0
  91. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +3 -3
  92. data/lib/starter_web/collections/posts/public/featured/_posts/2020-01-01-about-cookies.adoc +4 -4
  93. data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-01-site-generators.adoc +1 -7
  94. data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-03-about-j1.adoc +2 -7
  95. data/lib/starter_web/dot.gitignore +1 -1
  96. data/lib/starter_web/index.html +1 -1
  97. data/lib/starter_web/package.json +1 -1
  98. data/lib/starter_web/pages/public/blog/navigator/archive.html +4 -3
  99. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +14 -8
  100. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +11 -8
  101. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +6 -5
  102. data/lib/starter_web/pages/public/cookieConsent.adoc +93 -0
  103. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +2 -1
  104. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +104 -209
  105. data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +6 -1
  106. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  107. data/lib/starter_web/utilsrv/package.json +1 -1
  108. metadata +26 -15
  109. data/_includes/themes/j1/modules/navigator/generator.org.html +0 -232
  110. data/assets/data/cookiebar.html +0 -285
  111. data/lib/starter_web/_data/modules/defaults/cookiebar.yml +0 -132
@@ -0,0 +1,326 @@
1
+ ---
2
+ regenerate: true
3
+ ---
4
+
5
+ {% capture cache %}
6
+
7
+ {% comment %}
8
+ # -----------------------------------------------------------------------------
9
+ # ~/assets/themes/j1/adapter/js/themer.js
10
+ # Liquid template to adapt theme functions
11
+ #
12
+ # Product/Info:
13
+ # https://jekyll.one
14
+ #
15
+ # Copyright (C) 2021 Juergen Adams
16
+ #
17
+ # J1 Template is licensed under the MIT License.
18
+ # For details, see https://jekyll.one
19
+ #
20
+ # -----------------------------------------------------------------------------
21
+ # Test data:
22
+ # {{config| debug }}
23
+ # -----------------------------------------------------------------------------
24
+ {% endcomment %}
25
+
26
+ {% comment %} Liquid procedures
27
+ -------------------------------------------------------------------------------- {% endcomment %}
28
+
29
+ {% comment %} Set global settings
30
+ -------------------------------------------------------------------------------- {% endcomment %}
31
+ {% assign environment = site.environment %}
32
+ {% assign template_version = site.version %}
33
+ {% assign asset_path = "/assets/themes/j1" %}
34
+
35
+ {% comment %} Process YML config data
36
+ ================================================================================ {% endcomment %}
37
+
38
+ {% comment %} Set config files
39
+ -------------------------------------------------------------------------------- {% endcomment %}
40
+ {% assign template_config = site.data.j1_config %}
41
+ {% assign blocks = site.data.blocks %}
42
+ {% assign modules = site.data.modules %}
43
+
44
+ {% comment %} Set config data
45
+ -------------------------------------------------------------------------------- {% endcomment %}
46
+ {% assign themer_defaults = modules.defaults.themer.defaults %}
47
+ {% assign themer_settings = modules.themer.settings %}
48
+
49
+ {% comment %} Set config options
50
+ -------------------------------------------------------------------------------- {% endcomment %}
51
+ {% assign themer_options = themer_defaults| merge: themer_settings %}
52
+ {% assign default_theme = template_config.theme %}
53
+ {% assign theme_base = "core/css/themes" %}
54
+
55
+ {% if environment == "development" or environment == "test" %}
56
+ {% assign theme_ext = "css" %}
57
+ {% else %}
58
+ {% assign theme_ext = "min.css" %}
59
+ {% endif %}
60
+
61
+ {% assign production = false %}
62
+ {% if environment == 'prod' or environment == 'production' %}
63
+ {% assign production = true %}
64
+ {% endif %}
65
+
66
+ /*
67
+ # -----------------------------------------------------------------------------
68
+ # ~/assets/themes/j1/adapter/js/themer.js
69
+ # JS Adapter for J1 themer (bootstrapThemeSwitcher)
70
+ #
71
+ # Product/Info:
72
+ # https://jekyll.one
73
+ # https://github.com/jguadagno/bootstrapThemeSwitcher
74
+ #
75
+ # Copyright (C) 2021 Juergen Adams
76
+ # Copyright (C) 2014 Joseph Guadagno
77
+ #
78
+ # J1 Template is licensed under the MIT License.
79
+ # For details, see https://jekyll.one
80
+ # bootstrapThemeSwitcher is licensed under the MIT License.
81
+ # For details, see https://github.com/jguadagno/bootstrapThemeSwitcher/blob/master/LICENSE
82
+ # -----------------------------------------------------------------------------
83
+ # NOTE:
84
+ # Setup of theme loaders for local_themes|remote_themes moved
85
+ # to adapter navigator.js
86
+ # -----------------------------------------------------------------------------
87
+ # Adapter generated: {{site.time}}
88
+ # -----------------------------------------------------------------------------
89
+ */
90
+
91
+ // -----------------------------------------------------------------------------
92
+ // ESLint shimming
93
+ // -----------------------------------------------------------------------------
94
+ /* eslint indent: "off" */
95
+ /* eslint quotes: "off" */
96
+ // -----------------------------------------------------------------------------
97
+
98
+ 'use strict';
99
+
100
+ j1.adapter['themer'] = (function (j1, window) {
101
+ // ---------------------------------------------------------------------------
102
+ // globals
103
+ // ---------------------------------------------------------------------------
104
+ var environment = '{{environment}}';
105
+ var themerOptions = $.extend({}, {{themer_options | replace: '=>', ':' | replace: 'nil', '""' }});
106
+ var user_state = {};
107
+ var user_consent = {};
108
+ var cookie_names = j1.getCookieNames();
109
+ var user_state_detected = false;
110
+ var styleLoaded = false;
111
+ var id = 'default';
112
+ var user_state_cookie;
113
+ var theme_css_html;
114
+ var _this;
115
+ var logger;
116
+ var logText;
117
+
118
+ var cssExtension = (environment === 'production')
119
+ ? '.min.css'
120
+ : '.css';
121
+
122
+ var default_theme_name = '{{default_theme.name}}';
123
+ var default_theme_author = '{{default_theme.author}}';
124
+ var default_theme_author_url = '{{default_theme.author_url}}';
125
+ var default_theme_css_name = default_theme_name.toLowerCase().replace(' ', '-');
126
+ var default_theme_css = '{{asset_path}}/{{theme_base}}/' + default_theme_css_name + '/bootstrap' + cssExtension;
127
+
128
+ // ---------------------------------------------------------------------------
129
+ // helper functions
130
+ // ---------------------------------------------------------------------------
131
+
132
+ function styleSheetLoaded(styleSheet) {
133
+ var sheets = document.styleSheets, stylesheet = sheets[(sheets.length - 1)];
134
+
135
+ // find CSS file 'styleSheetName' in document
136
+ for(var i in document.styleSheets) {
137
+ if(sheets[i].href && sheets[i].href.indexOf(styleSheet) > -1) {
138
+ return true;
139
+ }
140
+ }
141
+ return false;
142
+ }
143
+
144
+ // ---------------------------------------------------------------------------
145
+ // Main object
146
+ // ---------------------------------------------------------------------------
147
+ return {
148
+ // -------------------------------------------------------------------------
149
+ // initializer
150
+ // -------------------------------------------------------------------------
151
+ init: function () {
152
+ // -----------------------------------------------------------------------
153
+ // globals
154
+ // -----------------------------------------------------------------------
155
+ _this = j1.adapter.themer;
156
+ logger = log4javascript.getLogger('j1.adapter.themer');
157
+
158
+ // initialize state flag
159
+ _this.state = 'started';
160
+ logger.info('state: ' + _this.getState());
161
+
162
+ // detect|set user state cookie
163
+ user_state_detected = j1.existsCookie(cookie_names.user_state);
164
+ if (user_state_detected) {
165
+ user_state = j1.readCookie(cookie_names.user_state);
166
+ user_consent = j1.readCookie(cookie_names.user_consent);
167
+ }
168
+
169
+ // initial theme data
170
+ if (user_state.theme_css === '') {
171
+ user_state.theme_name = default_theme_name;
172
+ user_state.theme_css = default_theme_css;
173
+ user_state.theme_author = default_theme_author;
174
+ user_state.theme_author_url = default_theme_author_url;
175
+ }
176
+
177
+ styleLoaded = styleSheetLoaded(user_state.theme_css);
178
+ theme_css_html = '<link rel="stylesheet" id="' + id + '" href="' + user_state.theme_css + '" type="text/css" />';
179
+
180
+ // skip loading theme UNO css file except NOT loaded
181
+ if (!user_state.theme_name.includes('Uno') || !styleLoaded) {
182
+ $('head').append(theme_css_html);
183
+ }
184
+
185
+ // store if theme_switcher is enabled
186
+ user_state.theme_switcher = themerOptions.enabled;
187
+
188
+ if (!user_consent.analyses || !user_consent.personalization) {
189
+ // expire state cookie to session
190
+ j1.writeCookie({
191
+ name: cookie_names.user_state,
192
+ data: user_state,
193
+ samesite: 'Strict'
194
+ });
195
+ } else {
196
+ j1.writeCookie({
197
+ name: cookie_names.user_state,
198
+ data: user_state,
199
+ samesite: 'Strict',
200
+ expires: 365
201
+ });
202
+ }
203
+
204
+ // jadams, 2021-01-03: dependency has to be checked in more detail
205
+ var dependencies_met_j1_finished = setInterval (function () {
206
+ if (j1.getState() == 'finished') {
207
+ if (themerOptions.enabled) {
208
+ // enable BS ThemeSwitcher
209
+ logger.info('themes detected as: enabled');
210
+ logger.info('theme is being initialized: ' + user_state.theme_name);
211
+
212
+ // jadams, 2021-02-22: make sure that remote themes are loaded
213
+ // max retries = max_count
214
+
215
+ // load list of remote themes
216
+ //
217
+ if ( $('#remote_themes').length ) {
218
+ var themes_count;
219
+ var interval_count = 0;
220
+ var max_count = themerOptions.retries;
221
+
222
+ /* eslint-disable */
223
+ // initialize Bootswatch Theme Switcher
224
+ $('#remote_themes').bootstrapThemeSwitcher.defaults = {
225
+ debug: themerOptions.debug,
226
+ saveToCookie: themerOptions.saveToCookie,
227
+ cssThemeLink: themerOptions.cssThemeLink,
228
+ cookieThemeName: themerOptions.cookieThemeName,
229
+ cookieDefaultThemeName: themerOptions.cookieDefaultThemeName,
230
+ cookieThemeCss: themerOptions.cookieThemeCss,
231
+ cookieThemeExtensionCss: themerOptions.cookieThemeExtensionCss,
232
+ cookieExpiration: themerOptions.cookieExpiration,
233
+ cookiePath: themerOptions.cookiePath,
234
+ defaultCssFile: themerOptions.defaultCssFile,
235
+ bootswatchApiUrl: themerOptions.bootswatchApiUrl,
236
+ bootswatchApiVersion: themerOptions.bootswatchApiVersion,
237
+ loadFromBootswatch: themerOptions.loadFromBootswatch,
238
+ localFeed: themerOptions.localThemes,
239
+ excludeBootswatch: themerOptions.excludeBootswatch,
240
+ includeBootswatch: themerOptions.includeBootswatch,
241
+ skipIncludeBootswatch: themerOptions.skipIncludeBootswatch
242
+ }
243
+ /* eslint-enable */
244
+
245
+ // var dependencies_met_remote_themes_loaded = setInterval(function() {
246
+ // interval_count += 1;
247
+ // themes_count = document.getElementById("remote_themes").getElementsByTagName("li").length;
248
+ // if ( themes_count > 0 ) {
249
+ // logger.info('remote themes loaded: successfully');
250
+ // logger.info('remote themes loaded: successfully after: ' + interval_count * 25 + ' ms');
251
+ //
252
+ // clearInterval(dependencies_met_remote_themes_loaded);
253
+ // } else {
254
+ // logger.debug('wait for theme to be loaded: ' + user_state.theme_name);
255
+ // }
256
+ // if (interval_count > max_count) {
257
+ // logger.warn('remote themes loading: failed');
258
+ // logger.warn('continue processing');
259
+ // clearInterval(dependencies_met_remote_themes_loaded);
260
+ // }
261
+ // }, 25);
262
+
263
+ logger.info('theme loaded: ' + user_state.theme_name);
264
+ logger.info('theme css file: ' + user_state.theme_css);
265
+ _this.setState('finished');
266
+ logger.info('state: ' + _this.getState());
267
+ logger.info('module initialized successfully');
268
+ logger.info('met dependencies for: j1.adapter');
269
+ }
270
+ } else {
271
+ _this.setState('finished');
272
+ logger.info('state: ' + _this.getState());
273
+ logger.info('themes detected as: disabled');
274
+ }
275
+ clearInterval(dependencies_met_j1_finished);
276
+ }
277
+ }, 25); // END 'dependencies_met_j1_finished'
278
+ }, // END init
279
+
280
+ // -------------------------------------------------------------------------
281
+ // messageHandler
282
+ // Manage messages send from other J1 modules
283
+ // -------------------------------------------------------------------------
284
+ messageHandler: function (sender, message) {
285
+ var json_message = JSON.stringify(message, undefined, 2);
286
+
287
+ logText = 'received message from ' + sender + ': ' + json_message;
288
+ logger.info(logText);
289
+
290
+ // -----------------------------------------------------------------------
291
+ // Process commands|actions
292
+ // -----------------------------------------------------------------------
293
+ if (message.type === 'command' && message.action === 'module_initialized') {
294
+ logger.info(message.text);
295
+ //
296
+ // Place handling of other command|action here
297
+ //
298
+ }
299
+ }, // END messageHandler
300
+
301
+ // -------------------------------------------------------------------------
302
+ // setState()
303
+ // Sets the current (processing) state of the module
304
+ // -------------------------------------------------------------------------
305
+ setState: function (stat) {
306
+ _this.state = stat;
307
+ }, // END setState
308
+
309
+ // -------------------------------------------------------------------------
310
+ // getState()
311
+ // Returns the current (processing) state of the module
312
+ // -------------------------------------------------------------------------
313
+ getState: function () {
314
+ return _this.state;
315
+ } // END getState
316
+
317
+ }; // END return
318
+ })(j1, window);
319
+
320
+ {% endcapture %}
321
+ {% if production %}
322
+ {{cache| minifyJS }}
323
+ {% else %}
324
+ {{cache| strip_empty_lines }}
325
+ {% endif %}
326
+ {% assign cache = nil %}
@@ -101,32 +101,34 @@ j1.adapter['themer'] = (function (j1, window) {
101
101
  // ---------------------------------------------------------------------------
102
102
  // globals
103
103
  // ---------------------------------------------------------------------------
104
- var environment = '{{environment}}';
105
- var themerOptions = $.extend({}, {{themer_options | replace: '=>', ':' | replace: 'nil', '""' }});
106
- var user_state = {};
107
- var cookie_names = j1.getCookieNames();
108
- var cookie_user_state_name = cookie_names.user_state;
109
- var user_state_detected = false;
110
- var styleLoaded = false;
111
- var id = 'default';
104
+ var environment = '{{environment}}';
105
+ var themerOptions = $.extend({}, {{themer_options | replace: '=>', ':' | replace: 'nil', '""' }});
106
+ var user_state = {};
107
+ var user_consent = {};
108
+ var cookie_names = j1.getCookieNames();
109
+ var user_state_detected = false;
110
+ var styleLoaded = false;
111
+ var id = 'default';
112
112
  var user_state_cookie;
113
113
  var theme_css_html;
114
114
  var _this;
115
115
  var logger;
116
116
  var logText;
117
117
 
118
+ var cssExtension = (environment === 'production')
119
+ ? '.min.css'
120
+ : '.css';
121
+
118
122
  var default_theme_name = '{{default_theme.name}}';
119
123
  var default_theme_author = '{{default_theme.author}}';
120
- var default_theme_author_url = '{{default_theme.theme_author_url}}';
124
+ var default_theme_author_url = '{{default_theme.author_url}}';
121
125
  var default_theme_css_name = default_theme_name.toLowerCase().replace(' ', '-');
122
- var default_theme_css = (environment == 'production')
123
- ? '{{asset_path}}/{{theme_base}}/' +default_theme_css_name+ '/bootstrap.min.css'
124
- : '{{asset_path}}/{{theme_base}}/' +default_theme_css_name+ '/bootstrap.css';
126
+ var default_theme_css = '{{asset_path}}/{{theme_base}}/' + default_theme_css_name + '/bootstrap' + cssExtension;
125
127
 
126
128
  // ---------------------------------------------------------------------------
127
129
  // helper functions
128
130
  // ---------------------------------------------------------------------------
129
- // Example: var styleLoaded = styleSheetLoaded('');
131
+
130
132
  function styleSheetLoaded(styleSheet) {
131
133
  var sheets = document.styleSheets, stylesheet = sheets[(sheets.length - 1)];
132
134
 
@@ -157,15 +159,15 @@ j1.adapter['themer'] = (function (j1, window) {
157
159
  _this.state = 'started';
158
160
  logger.info('state: ' + _this.getState());
159
161
 
160
- // Detect|Set J1 UserState
161
- user_state_detected = j1.existsCookie(cookie_user_state_name);
162
+ // detect|set user state cookie
163
+ user_state_detected = j1.existsCookie(cookie_names.user_state);
162
164
  if (user_state_detected) {
163
- user_state = j1.readCookie(cookie_user_state_name);
165
+ user_state = j1.readCookie(cookie_names.user_state);
166
+ user_consent = j1.readCookie(cookie_names.user_consent);
164
167
  }
165
168
 
166
- // initial user_state cookie
167
- //
168
- if ( user_state.theme_name == '') {
169
+ // initial theme data
170
+ if (user_state.theme_css === '') {
169
171
  user_state.theme_name = default_theme_name;
170
172
  user_state.theme_css = default_theme_css;
171
173
  user_state.theme_author = default_theme_author;
@@ -175,42 +177,42 @@ j1.adapter['themer'] = (function (j1, window) {
175
177
  styleLoaded = styleSheetLoaded(user_state.theme_css);
176
178
  theme_css_html = '<link rel="stylesheet" id="' + id + '" href="' + user_state.theme_css + '" type="text/css" />';
177
179
 
178
- // skip loading UNO CSS file except it is NOT loaded
179
- //
180
+ // skip loading theme UNO css file except NOT loaded
180
181
  if (!user_state.theme_name.includes('Uno') || !styleLoaded) {
181
182
  $('head').append(theme_css_html);
182
183
  }
183
184
 
184
185
  // store if theme_switcher is enabled
185
- //
186
186
  user_state.theme_switcher = themerOptions.enabled;
187
187
 
188
- j1.writeCookie({
189
- name: cookie_user_state_name,
190
- data: user_state,
191
- expires: 365 // was missing
192
- });
188
+ if (!user_consent.analyses || !user_consent.personalization) {
189
+ // expire state cookie to session
190
+ j1.writeCookie({
191
+ name: cookie_names.user_state,
192
+ data: user_state,
193
+ samesite: 'Strict'
194
+ });
195
+ } else {
196
+ j1.writeCookie({
197
+ name: cookie_names.user_state,
198
+ data: user_state,
199
+ samesite: 'Strict',
200
+ expires: 365
201
+ });
202
+ }
193
203
 
194
- // jadams, 2021-01-03: dependency has to be checked in more detail
195
- //
196
204
  var dependencies_met_j1_finished = setInterval (function () {
197
- if (j1.getState() == 'finished') {
205
+ // jadams, 2021-01-03: dependency has to be checked in more detail
206
+ // if (j1.getState() == 'finished') {
207
+ if (true) {
198
208
  if (themerOptions.enabled) {
199
209
  // enable BS ThemeSwitcher
200
- //
201
210
  logger.info('themes detected as: enabled');
202
211
  logger.info('theme is being initialized: ' + user_state.theme_name);
203
212
 
204
- // jadams, 2021-02-22: make sure that remote themes are loaded
205
- // max retries = max_count
206
-
207
213
  // load list of remote themes
208
214
  //
209
- if ( $('#remote_themes').length ) {
210
- var themes_count;
211
- var interval_count = 0;
212
- var max_count = themerOptions.retries;
213
-
215
+ if ($('#remote_themes').length) {
214
216
  /* eslint-disable */
215
217
  // initialize Bootswatch Theme Switcher
216
218
  $('#remote_themes').bootstrapThemeSwitcher.defaults = {
@@ -234,24 +236,6 @@ j1.adapter['themer'] = (function (j1, window) {
234
236
  }
235
237
  /* eslint-enable */
236
238
 
237
- var dependencies_met_remote_themes_loaded = setInterval(function() {
238
- interval_count += 1;
239
- themes_count = document.getElementById("remote_themes").getElementsByTagName("li").length;
240
- if ( themes_count > 0 ) {
241
- logger.info('remote themes loaded: successfully');
242
- logger.info('remote themes loaded: successfully after: ' + interval_count * 25 + ' ms');
243
-
244
- clearInterval(dependencies_met_remote_themes_loaded);
245
- } else {
246
- logger.debug('wait for theme to be loaded: ' + user_state.theme_name);
247
- }
248
- if (interval_count > max_count) {
249
- logger.warn('remote themes loading: failed');
250
- logger.warn('continue processing');
251
- clearInterval(dependencies_met_remote_themes_loaded);
252
- }
253
- }, 25);
254
-
255
239
  logger.info('theme loaded: ' + user_state.theme_name);
256
240
  logger.info('theme css file: ' + user_state.theme_css);
257
241
  _this.setState('finished');