j1-template 2021.1.5 → 2021.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/themes/j1/layouts/layout_metadata_generator.html +4 -4
- data/_includes/themes/j1/modules/connectors/ads +18 -7
- data/_includes/themes/j1/modules/connectors/analytic/google-analytics.html +6 -6
- data/_includes/themes/j1/modules/connectors/analytics +17 -3
- data/_includes/themes/j1/modules/connectors/comments +22 -8
- data/_includes/themes/j1/modules/connectors/translator +20 -6
- data/_includes/themes/j1/procedures/global/select_location.proc +3 -3
- data/assets/data/themes.json +6 -6
- data/assets/error_pages/HTTP204.html +30 -10
- data/assets/error_pages/HTTP400.html +29 -8
- data/assets/error_pages/HTTP401.html +29 -9
- data/assets/error_pages/HTTP403.html +29 -8
- data/assets/error_pages/HTTP404.html +29 -8
- data/assets/error_pages/HTTP500.html +29 -8
- data/assets/error_pages/HTTP501.html +29 -8
- data/assets/error_pages/HTTP502.html +29 -8
- data/assets/error_pages/HTTP503.html +30 -8
- data/assets/themes/j1/adapter/js/cookieConsent.js +93 -56
- data/assets/themes/j1/adapter/js/fam.js +2 -1
- data/assets/themes/j1/adapter/js/j1.js +176 -170
- data/assets/themes/j1/adapter/js/navigator.js +157 -200
- data/assets/themes/j1/adapter/js/themer.1.js +326 -0
- data/assets/themes/j1/adapter/js/themer.js +41 -57
- data/assets/themes/j1/adapter/js/toccer.js +4 -45
- data/assets/themes/j1/core/js/template.js +1 -1
- data/assets/themes/j1/core/js/template.js.map +1 -1
- data/assets/themes/j1/core/js/template.min.js +1 -1
- data/assets/themes/j1/core/js/template.min.js.map +1 -1
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +25 -10
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +5 -6
- data/assets/themes/j1/modules/fam/css/{uno → theme/uno}/fam.css +0 -0
- data/assets/themes/j1/modules/fam/css/theme/uno/fam.min.css +15 -0
- data/assets/themes/j1/modules/fam/js/fam.js +1 -6
- data/assets/themes/j1/modules/mmenuLight/css/{mmenu.css → mmenu-light.css} +0 -0
- data/assets/themes/j1/modules/mmenuLight/css/{mmenu.min.css → mmenu-light.min.css} +0 -0
- data/assets/themes/j1/modules/mmenuLight/css/theme/{uno.css → uno/mmenu.css} +0 -0
- data/assets/themes/j1/modules/mmenuLight/css/theme/{uno.min.css → uno/mmenu.min.css} +0 -0
- data/assets/themes/j1/modules/rtable/css/theme/{uno.css → uno/rtable.css} +0 -0
- data/assets/themes/j1/modules/rtable/css/theme/{uno.min.css → uno/rtable.min.css} +0 -0
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +34 -49
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +410 -2
- data/lib/j1/version.rb +1 -1
- data/lib/j1_app/j1_auth_manager/auth_manager.rb +2 -3
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +18 -10
- data/lib/starter_web/_data/_defaults/private.default.yml +119 -0
- data/lib/starter_web/_data/j1_config.yml +21 -18
- data/lib/starter_web/_data/modules/cookieconsent.yml +1 -0
- data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +10 -9
- data/lib/starter_web/_data/modules/defaults/themer.yml +2 -1
- data/lib/starter_web/_data/private.default.yml +119 -0
- data/lib/starter_web/_data/resources.yml +6 -7
- data/lib/starter_web/_includes/attributes.asciidoc +1 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/dot.gitignore +2 -2
- data/lib/starter_web/index.html +3 -3
- data/lib/starter_web/package.json +2 -2
- data/lib/starter_web/pages/public/blog/navigator/archive.html +5 -3
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +3 -2
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +6 -4
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +23 -5
- data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +9 -6
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +13 -65
- data/assets/error_pages/HTTP520.html +0 -68
- data/assets/error_pages/HTTP521.html +0 -68
- data/assets/error_pages/HTTP533.html +0 -68
- data/assets/themes/j1/modules/_lightGallery/css/core/lg-fb-comment-box.css +0 -58
- data/assets/themes/j1/modules/_lightGallery/css/core/lg-fb-comment-box.min.css +0 -5
- data/assets/themes/j1/modules/_lightGallery/css/core/lg-transitions.css +0 -778
- data/assets/themes/j1/modules/_lightGallery/css/core/lg-transitions.min.css +0 -5
- data/assets/themes/j1/modules/_lightGallery/css/core/lightgallery.css +0 -981
- data/assets/themes/j1/modules/_lightGallery/css/core/lightgallery.min.css +0 -5
- data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.eot +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.svg +0 -47
- data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.ttf +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/fonts/lg.woff +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/img/loading.gif +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/img/video-play.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/img/vimeo-play.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/img/youtube-play.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/animation-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/customize-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/dynamic-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/facebook-icon.svg +0 -10
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/googleplus-icon.svg +0 -30
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/html5-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/linked-in.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/module-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/play-button.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/responsive-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/thumb-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/touch-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/twitter-icon.svg +0 -15
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/twitter.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/video1-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/zoom-w.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/icons/zoom.png +0 -0
- data/assets/themes/j1/modules/_lightGallery/css/themes/uno.css +0 -262
- data/assets/themes/j1/modules/_lightGallery/css/themes/uno.min.css +0 -15
- data/assets/themes/j1/modules/_lightGallery/js/core/lightgallery.js +0 -1362
- data/assets/themes/j1/modules/_lightGallery/js/core/lightgallery.min.js +0 -4
- data/assets/themes/j1/modules/_lightGallery/js/modules/j1/j1-video.js +0 -402
- data/assets/themes/j1/modules/_lightGallery/js/modules/j1/j1-video.min.js +0 -8
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-autoplay.js +0 -206
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-autoplay.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-fullscreen.js +0 -126
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-fullscreen.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-hash.js +0 -101
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-hash.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-pager.js +0 -105
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-pager.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-share.js +0 -107
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-share.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-thumbnail.js +0 -478
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-thumbnail.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-video.js +0 -342
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-video.min.js +0 -5
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-zoom.js +0 -527
- data/assets/themes/j1/modules/_lightGallery/js/modules/lg-zoom.min.js +0 -5
@@ -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
|
105
|
-
var themerOptions
|
106
|
-
var user_state
|
107
|
-
var
|
108
|
-
var
|
109
|
-
var user_state_detected
|
110
|
-
var styleLoaded
|
111
|
-
var id
|
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.
|
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 =
|
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
|
-
|
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
|
-
//
|
161
|
-
user_state_detected = j1.existsCookie(
|
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
|
165
|
+
user_state = j1.readCookie(cookie_names.user_state);
|
166
|
+
user_consent = j1.readCookie(cookie_names.user_consent);
|
164
167
|
}
|
165
168
|
|
166
|
-
// initial
|
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
|
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
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
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
|
-
|
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 (
|
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');
|