j1-template 2021.1.1 → 2021.1.6
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 +23 -9
- data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +1 -1
- data/_includes/themes/j1/modules/connectors/ads +3 -5
- data/_includes/themes/j1/modules/connectors/analytic/google-analytics.html +9 -5
- data/_includes/themes/j1/modules/connectors/analytics +4 -2
- data/_includes/themes/j1/modules/connectors/comments +7 -6
- data/_includes/themes/j1/modules/connectors/translator +3 -4
- data/_includes/themes/j1/modules/navigator/generator.html +4 -40
- data/_includes/themes/j1/modules/navigator/procedures/topsearch.proc +2 -2
- data/_includes/themes/j1/procedures/global/create_bs_button.proc +64 -22
- data/_includes/themes/j1/procedures/posts/collate_timeline.proc +14 -10
- data/_layouts/default.html +4 -7
- data/assets/data/authclient.html +231 -229
- data/assets/data/banner.html +30 -32
- data/assets/data/cookieconsent.html +249 -0
- data/assets/data/fam.html +1 -1
- data/assets/data/footer.html +1 -1
- data/assets/data/gallery_customizer.html +10 -5
- data/assets/data/menu.html +3 -3
- data/assets/data/mmenu.html +4 -3
- data/assets/data/mmenu_sidebar.html +1 -1
- data/assets/data/mmenu_toc.html +1 -1
- data/assets/data/panel.html +20 -16
- data/assets/data/quicklinks.html +20 -18
- data/assets/data/themes.json +6 -6
- data/assets/themes/j1/adapter/js/{cookiebar.js → cookieConsent.js} +129 -55
- data/assets/themes/j1/adapter/js/j1.js +147 -145
- data/assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js +3 -2
- data/assets/themes/j1/adapter/js/mmenu.js +8 -4
- data/assets/themes/j1/adapter/js/navigator.js +77 -22
- data/assets/themes/j1/adapter/js/themer.js +37 -29
- data/assets/themes/j1/adapter/js/toccer.js +4 -45
- data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.css +17 -14
- data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +3960 -240
- data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +1 -1
- data/assets/themes/j1/core/js/template.js +3 -9
- data/assets/themes/j1/core/js/template.js.map +1 -1
- data/assets/themes/j1/core/js/template.min.js +3 -9
- data/assets/themes/j1/core/js/template.min.js.map +1 -1
- data/assets/themes/j1/modules/cookieConsent/LICENSE +21 -0
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +286 -0
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +28 -0
- 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/iframeResizer/examples/frame.absolute.html +4 -2
- data/assets/themes/j1/modules/iframeResizer/examples/frame.content.html +4 -3
- data/assets/themes/j1/modules/iframeResizer/examples/frame.hover.html +4 -2
- data/assets/themes/j1/modules/iframeResizer/examples/frame.nested.html +4 -2
- data/assets/themes/j1/modules/iframeResizer/examples/frame.textarea.html +4 -2
- data/assets/themes/j1/modules/iframeResizer/examples/frame.tolerance.html +4 -2
- data/assets/themes/j1/modules/iframeResizer/examples/index.html +2 -0
- data/assets/themes/j1/modules/iframeResizer/examples/two.html +4 -2
- 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 +33 -47
- data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +410 -2
- data/assets/themes/j1/modules/util/js/domready.js +146 -0
- data/assets/themes/j1/modules/util/js/gtag-opt-in.js +1 -0
- 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 +8 -7
- data/lib/starter_web/_data/_defaults/resources.yml +11 -8
- data/lib/starter_web/_data/apps/defaults/justifiedGalleryCustomizer.yml +1 -0
- data/lib/starter_web/_data/blocks/banner.yml +30 -24
- data/lib/starter_web/_data/blocks/panel.yml +9 -7
- data/lib/starter_web/_data/builder/blog_navigator.yml +6 -1
- data/lib/starter_web/_data/j1_config.yml +22 -19
- data/lib/starter_web/_data/layouts/blog_archive.yml +9 -0
- data/lib/starter_web/_data/layouts/default.yml +17 -27
- data/lib/starter_web/_data/layouts/home.yml +6 -5
- data/lib/starter_web/_data/layouts/page.yml +1 -1
- data/lib/starter_web/_data/modules/{cookiebar.yml → cookieconsent.yml} +4 -4
- data/lib/starter_web/_data/modules/defaults/authentication.yml +1 -0
- data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +135 -0
- data/lib/starter_web/_data/modules/defaults/navigator.yml +5 -2
- data/lib/starter_web/_data/modules/defaults/themer.yml +2 -1
- data/lib/starter_web/_data/modules/navigator.yml +24 -21
- data/lib/starter_web/_data/modules/navigator_menu.yml +1 -1
- data/lib/starter_web/_data/pages/builder.yml +7 -7
- data/lib/starter_web/_data/private.default.yml +119 -0
- data/lib/starter_web/_data/private.yml +6 -6
- data/lib/starter_web/_data/resources.yml +19 -15
- data/lib/starter_web/_includes/attributes.asciidoc +10 -1
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/assets/images/modules/attics/christa-dodoo-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/attics/{cookies-1920x1200-bw.jpg → cookies-1920x1200.jpg} +0 -0
- data/lib/starter_web/assets/images/modules/attics/lianhao-1920x1280.jpg +0 -0
- data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +3 -9
- data/lib/starter_web/collections/posts/public/featured/_posts/2020-01-01-about-cookies.adoc +4 -4
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-01-site-generators.adoc +1 -7
- data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-03-about-j1.adoc +2 -7
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-test-series.adoc +0 -4
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-test-series.adoc +0 -4
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-test-series.adoc +0 -4
- data/lib/starter_web/collections/posts/public/series/_posts/2020-01-04-post-test-series.adoc +0 -4
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-20-minneapolis.adoc +3 -0
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-24-narcisse-snake-dens.adoc +3 -0
- data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-26-columbia-river.adoc +3 -0
- data/lib/starter_web/dot.gitignore +1 -1
- data/lib/starter_web/index.html +3 -3
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/blog/navigator/archive.html +43 -23
- data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +51 -27
- data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +48 -26
- data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +44 -12
- data/lib/starter_web/pages/public/blog/navigator/index.html +1 -1
- data/lib/starter_web/pages/public/cookieConsent.adoc +93 -0
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.org.asciidoc +244 -0
- data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +2 -1
- data/lib/starter_web/pages/public/learn/where_to_go.adoc +0 -16
- data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +104 -209
- data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +6 -1
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +25 -14
- data/assets/data/cookiebar.html +0 -285
- data/lib/starter_web/_data/modules/defaults/cookiebar.yml +0 -132
@@ -2,10 +2,11 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
5
|
-
<title>iFrame message passing test</title>
|
6
|
-
<meta name="description" content="iFrame message passing test" />
|
5
|
+
<title>iFrame message passing test 2</title>
|
6
|
+
<meta name="description" content="iFrame message passing test 2" />
|
7
7
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
8
|
-
|
8
|
+
<meta name="robots" content="noindex">
|
9
|
+
<meta name="robots" content="nofollow">
|
9
10
|
<style>
|
10
11
|
*,
|
11
12
|
*:before,
|
@@ -2,9 +2,11 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
5
|
-
<title>iFrame message passing test</title>
|
6
|
-
<meta name="description" content="iFrame message passing test" />
|
5
|
+
<title>iFrame message passing test 3</title>
|
6
|
+
<meta name="description" content="iFrame message passing test 3" />
|
7
7
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
8
|
+
<meta name="robots" content="noindex">
|
9
|
+
<meta name="robots" content="nofollow">
|
8
10
|
<style>
|
9
11
|
a {
|
10
12
|
float: right;
|
@@ -2,10 +2,12 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
5
|
-
<title>iFrame message passing test</title>
|
6
|
-
<meta name="description" content="iFrame message passing test" />
|
5
|
+
<title>iFrame message passing test 4</title>
|
6
|
+
<meta name="description" content="iFrame message passing test 4" />
|
7
7
|
<meta name="viewport" content="width=device-width" />
|
8
8
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
9
|
+
<meta name="robots" content="noindex">
|
10
|
+
<meta name="robots" content="nofollow">
|
9
11
|
<style>
|
10
12
|
*,
|
11
13
|
*:before,
|
@@ -2,9 +2,11 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
5
|
-
<title>iFrame message passing test</title>
|
6
|
-
<meta name="description" content="iFrame message passing test" />
|
5
|
+
<title>iFrame message passing test 5</title>
|
6
|
+
<meta name="description" content="iFrame message passing test 5" />
|
7
7
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
8
|
+
<meta name="robots" content="noindex">
|
9
|
+
<meta name="robots" content="nofollow">
|
8
10
|
<style>
|
9
11
|
a {
|
10
12
|
float: right;
|
@@ -2,8 +2,10 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
5
|
-
<title>iFrame message passing test</title>
|
6
|
-
<meta name="description" content="iFrame message passing test" />
|
5
|
+
<title>iFrame message passing test 6</title>
|
6
|
+
<meta name="description" content="iFrame message passing test 6" />
|
7
|
+
<meta name="robots" content="noindex">
|
8
|
+
<meta name="robots" content="nofollow">
|
7
9
|
<style>
|
8
10
|
a.back {
|
9
11
|
float: right;
|
@@ -6,6 +6,8 @@
|
|
6
6
|
<meta name="description" content="iFrame message passing test" />
|
7
7
|
<meta name="viewport" content="width=device-width" />
|
8
8
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
9
|
+
<meta name="robots" content="noindex">
|
10
|
+
<meta name="robots" content="nofollow">
|
9
11
|
</head>
|
10
12
|
|
11
13
|
<body>
|
@@ -2,10 +2,12 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
5
|
-
<title>iFrame message passing test</title>
|
6
|
-
<meta name="description" content="iFrame message passing test" />
|
5
|
+
<title>iFrame message passing test 7</title>
|
6
|
+
<meta name="description" content="iFrame message passing test 7" />
|
7
7
|
<meta name="viewport" content="width=device-width" />
|
8
8
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
9
|
+
<meta name="robots" content="noindex">
|
10
|
+
<meta name="robots" content="nofollow">
|
9
11
|
</head>
|
10
12
|
|
11
13
|
<body>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -66,16 +66,7 @@
|
|
66
66
|
this.settings = $.extend({}, $.fn.bootstrapThemeSwitcher.defaults, options);
|
67
67
|
this.themesList = [];
|
68
68
|
|
69
|
-
//
|
70
|
-
// this.getThemes()
|
71
|
-
// )
|
72
|
-
// .then(function(data) {
|
73
|
-
// logger.info('loading local themes (json) finished');
|
74
|
-
// })
|
75
|
-
// .catch(function(error) {
|
76
|
-
// logger.error('loading local themes (json) failed: ' + error);
|
77
|
-
// });
|
78
|
-
|
69
|
+
// loading local themes
|
79
70
|
this.getThemes();
|
80
71
|
return this;
|
81
72
|
};
|
@@ -98,9 +89,9 @@
|
|
98
89
|
// checkStyleSheetByName
|
99
90
|
// -------------------------------------------------------------------------
|
100
91
|
checkStyleSheetByName: function (name) {
|
101
|
-
var found
|
102
|
-
var test
|
103
|
-
var re
|
92
|
+
var found = false;
|
93
|
+
var test = '\/' + name + '\/';
|
94
|
+
var re = new RegExp(test, 'i');
|
104
95
|
|
105
96
|
for(var i = 0; i < document.styleSheets.length; i++){
|
106
97
|
if(re.test(document.styleSheets[i].href)){
|
@@ -131,29 +122,26 @@
|
|
131
122
|
var debug = settings.debug;
|
132
123
|
var includeCSS = this.settings.includeBootswatch;
|
133
124
|
|
134
|
-
//
|
125
|
+
// detect|set user state cookie
|
135
126
|
user_state_detected = j1.existsCookie ( 'j1.user.state' );
|
136
127
|
if ( user_state_detected ) {
|
137
|
-
logger.debug('
|
128
|
+
logger.debug('cookie found: j1.user.state');
|
138
129
|
j1_user_state = j1.readCookie(user_state_cookie_name);
|
139
130
|
} else {
|
140
|
-
logger.error('
|
131
|
+
logger.error('cookie not found: j1.user.state');
|
141
132
|
}
|
142
133
|
|
143
134
|
themeName = j1_user_state.theme_name;
|
144
135
|
theme_css = j1_user_state.theme_css;
|
145
|
-
theme_extension_css = j1_user_state.theme_extension_css;
|
146
136
|
|
147
|
-
if ( cssFile === undefined
|
148
|
-
if ( name === undefined
|
149
|
-
// Clear 'includeCSS' if NO theme extension CSS is needed
|
150
|
-
if ( name === this.settings.skipIncludeBootswatch ) { includeCSS = ''; }
|
137
|
+
if (typeof cssFile === 'undefined') { cssFile = this.settings.defaultCssFile; }
|
138
|
+
if (typeof name === 'undefined') { name = cssFile; }
|
151
139
|
|
152
140
|
// check if theme is to be saved to cookie
|
153
|
-
if (
|
154
|
-
if ( Cookies === undefined ) {
|
141
|
+
if (settings.saveToCookie) {
|
142
|
+
if ( typeof Cookies === 'undefined' ) {
|
155
143
|
if ( debug === 'true' ) {
|
156
|
-
logger.error('
|
144
|
+
logger.error('cookies library not present');
|
157
145
|
}
|
158
146
|
return false;
|
159
147
|
}
|
@@ -162,17 +150,18 @@
|
|
162
150
|
j1_user_state.theme_css = cssFile;
|
163
151
|
|
164
152
|
if (!(j1_user_state.theme_name.includes('Uno') || j1_user_state.theme_name == 'Bootstrap')) {
|
165
|
-
j1_user_state.theme_author
|
166
|
-
j1_user_state.theme_author_url
|
153
|
+
j1_user_state.theme_author = 'Bootswatch';
|
154
|
+
j1_user_state.theme_author_url = 'https://bootswatch.com/';
|
167
155
|
} else {
|
168
|
-
j1_user_state.theme_author
|
169
|
-
j1_user_state.theme_author_url
|
156
|
+
j1_user_state.theme_author = 'J1 Team';
|
157
|
+
j1_user_state.theme_author_url = 'https://jekyll.one/';
|
170
158
|
}
|
171
159
|
|
172
160
|
j1.writeCookie({
|
173
161
|
name: user_state_cookie_name,
|
174
162
|
data: j1_user_state
|
175
163
|
});
|
164
|
+
|
176
165
|
// force reload the page from the server (skip cache)
|
177
166
|
// and detect selected theme from cookie
|
178
167
|
location.reload(true);
|
@@ -188,20 +177,21 @@
|
|
188
177
|
// -------------------------------------------------------------------------
|
189
178
|
loadThemeFromCookie: function (options) {
|
190
179
|
|
191
|
-
if ( Cookies === undefined ) {
|
192
|
-
logger.error('
|
180
|
+
if ( typeof Cookies === 'undefined' ) {
|
181
|
+
logger.error('cookies library not present');
|
193
182
|
return false;
|
194
183
|
}
|
195
184
|
|
196
185
|
var settings = $.extend({}, $.fn.bootstrapThemeSwitcher.defaults, options);
|
197
186
|
|
198
|
-
//
|
187
|
+
// detect|set user state cookie
|
199
188
|
user_state_detected = j1.existsCookie ( 'j1.user.state' );
|
189
|
+
|
200
190
|
if ( user_state_detected ) {
|
201
|
-
logger.info('
|
191
|
+
logger.info('cookie found: j1.user.state');
|
202
192
|
j1_user_state = j1.readCookie(user_state_cookie_name);
|
203
193
|
} else {
|
204
|
-
logger.error('
|
194
|
+
logger.error('cookie not found: j1.user.state');
|
205
195
|
}
|
206
196
|
|
207
197
|
var themeName = j1_user_state.theme_name;
|
@@ -214,8 +204,8 @@
|
|
214
204
|
// addTheme
|
215
205
|
// -------------------------------------------------------------------------
|
216
206
|
addTheme: function(name, cssFile, start, deleteCount) {
|
217
|
-
if (start === undefined) { start = 0; }
|
218
|
-
if (deleteCount === undefined) { deleteCount = 0; }
|
207
|
+
if (typeof start === 'undefined') { start = 0; }
|
208
|
+
if (typeof deleteCount === 'undefined') { deleteCount = 0; }
|
219
209
|
this.themesList.splice(start, deleteCount, {name: name, css: cssFile});
|
220
210
|
this.addThemesToControl();
|
221
211
|
}, // END addTheme
|
@@ -224,11 +214,11 @@
|
|
224
214
|
// addThemesToControl
|
225
215
|
// -------------------------------------------------------------------------
|
226
216
|
addThemesToControl: function() {
|
227
|
-
if (this.$element === undefined) {
|
217
|
+
if (typeof this.$element === 'undefined') {
|
228
218
|
logger.error('bootstrapThemeSelector|addThemesToControl: Element is undefined');
|
229
219
|
return false;
|
230
220
|
}
|
231
|
-
if (this.themesList === undefined) {
|
221
|
+
if (typeof this.themesList === 'undefined') {
|
232
222
|
logger.error('bootstrapThemeSelector|addThemesToControl: Themes is undefined');
|
233
223
|
return false;
|
234
224
|
}
|
@@ -264,7 +254,7 @@
|
|
264
254
|
var themeName;
|
265
255
|
var debug = settings.debug;
|
266
256
|
|
267
|
-
//
|
257
|
+
// detect|set user state cookie
|
268
258
|
user_state_detected = j1.existsCookie ( 'j1.user.state' );
|
269
259
|
if ( user_state_detected ) {
|
270
260
|
logger.debug('User state cookie found');
|
@@ -308,7 +298,7 @@
|
|
308
298
|
} else {
|
309
299
|
base.switchTheme(value.name, value.cssCdn);
|
310
300
|
}
|
311
|
-
//
|
301
|
+
// remove previous "active" class and apply to latest clicked element
|
312
302
|
$(this).parent().find('li').removeClass('active');
|
313
303
|
$(this).addClass('active');
|
314
304
|
});
|
@@ -355,8 +345,6 @@
|
|
355
345
|
$.ajax({
|
356
346
|
url: this.settings.localFeed,
|
357
347
|
// jadams 2016-10-10: removed the setting for sychronous XMLHttpRequest
|
358
|
-
// because deprecated by jQuery on the MAIN thread. Because the Theme Manager
|
359
|
-
// is initialized very early, no blocking (sychronous) AJAX call is needed
|
360
348
|
// async: false,
|
361
349
|
dataType: 'json',
|
362
350
|
success: function (data) {
|
@@ -373,12 +361,10 @@
|
|
373
361
|
$.ajax({
|
374
362
|
url: this.settings.bootswatchApiUrl + '/' + this.settings.bootswatchApiVersion + '.json',
|
375
363
|
// jadams 2016-10-10: removed the setting for sychronous XMLHttpRequest
|
376
|
-
// because deprecated by jQuery on the main thread. Because the Theme Manager
|
377
|
-
// is initialized very early, no blocking|sychronous AJAX call is needed
|
378
364
|
// async: false,
|
379
365
|
dataType: 'json',
|
380
366
|
success: function (data) {
|
381
|
-
if (data.themes === undefined) {
|
367
|
+
if (typeof data.themes === 'undefined') {
|
382
368
|
return null;
|
383
369
|
}
|
384
370
|
base.themesList = data.themes;
|
@@ -393,7 +379,7 @@
|
|
393
379
|
// themes
|
394
380
|
// -------------------------------------------------------------------------
|
395
381
|
themes : function (newThemeList) {
|
396
|
-
if (newThemeList === undefined) {
|
382
|
+
if (typeof newThemeList === 'undefined') {
|
397
383
|
return this.themesList;
|
398
384
|
}
|
399
385
|
else {
|
@@ -419,7 +405,7 @@
|
|
419
405
|
if (typeof option === 'string') {
|
420
406
|
methodReturn = data[ option ].apply(data, args);
|
421
407
|
}
|
422
|
-
return ( methodReturn === undefined ) ? $this : methodReturn;
|
408
|
+
return ( typeof methodReturn === 'undefined' ) ? $this : methodReturn;
|
423
409
|
};
|
424
410
|
|
425
411
|
$.fn.bootstrapThemeSwitcher.defaults = {
|
@@ -430,7 +416,7 @@
|
|
430
416
|
cookieThemeCss: 'boostrapTheme.css',
|
431
417
|
cookieExpiration: 365,
|
432
418
|
cookiePath: '/',
|
433
|
-
defaultCssFile: 'https://
|
419
|
+
defaultCssFile: 'https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css',
|
434
420
|
bootswatchApiUrl: 'https://bootswatch.com/api/',
|
435
421
|
bootswatchApiVersion: '4',
|
436
422
|
loadFromBootswatch: true,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
# -----------------------------------------------------------------------------
|
3
|
-
# ~/assets/themes/j1/modules/bsThemeSwitcher/js/switcher.
|
3
|
+
# ~/assets/themes/j1/modules/bsThemeSwitcher/js/switcher.js
|
4
4
|
# Provides Javascript functions for Bootstrap ThemeSwitcher
|
5
5
|
#
|
6
6
|
# Product/Info:
|
@@ -15,7 +15,26 @@
|
|
15
15
|
# Bootstrap Theme Switcher is licensed under the MIT License.
|
16
16
|
# See: https://github.com/jguadagno/bootstrapThemeSwitcher
|
17
17
|
# -----------------------------------------------------------------------------
|
18
|
+
# NOTE: This modules is MODIFIED to be used with MobileMenu (mmenuLight).
|
19
|
+
# The original version cannot be used with J1 for theme menu creation!
|
20
|
+
# -----------------------------------------------------------------------------
|
18
21
|
*/
|
22
|
+
'use strict';
|
23
|
+
|
24
|
+
// -----------------------------------------------------------------------------
|
25
|
+
// ESLint shimming
|
26
|
+
// -----------------------------------------------------------------------------
|
27
|
+
/* eslint indent: "off" */
|
28
|
+
/* eslint no-console: ["error", { allow: ["log", "warn", "error"] }] */
|
29
|
+
/* eslint no-unused-vars: "off" */
|
30
|
+
/* eslint no-undef: "off" */
|
31
|
+
/* eslint no-useless-escape: "off" */
|
32
|
+
/* eslint no-prototype-builtins: "off" */
|
33
|
+
/* eslint no-shadow-restricted-names: "off" */
|
34
|
+
/* global jQuery */
|
35
|
+
/* global Cookies */
|
36
|
+
// -----------------------------------------------------------------------------
|
37
|
+
|
19
38
|
/**
|
20
39
|
* jQuery Twitter Bootstrap Theme Switcher v1.1.5
|
21
40
|
* https://github.com/jguadagno/bootstrapThemeSwitcher
|
@@ -23,4 +42,393 @@
|
|
23
42
|
* Copyright 2014, Joseph Guadagno
|
24
43
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
25
44
|
*/
|
26
|
-
|
45
|
+
|
46
|
+
(function ($, window, document, undefined) {
|
47
|
+
|
48
|
+
var old = $.fn.bootstrapThemeSwitcher;
|
49
|
+
|
50
|
+
var cookie_names = j1.getCookieNames();
|
51
|
+
const user_state_cookie_name = cookie_names.user_state;
|
52
|
+
|
53
|
+
var logger = log4javascript.getLogger('j1.core.switcher');
|
54
|
+
var logText;
|
55
|
+
|
56
|
+
var user_state_detected;
|
57
|
+
var j1_user_state = {};
|
58
|
+
var j1_user_state_json;
|
59
|
+
var j1_user_state_cookie;
|
60
|
+
|
61
|
+
// Constructor
|
62
|
+
// ---------------------------------------------------------------------------
|
63
|
+
var BootstrapThemeSwitcher = function (element, options) {
|
64
|
+
|
65
|
+
this.$element = $(element);
|
66
|
+
this.settings = $.extend({}, $.fn.bootstrapThemeSwitcher.defaults, options);
|
67
|
+
this.themesList = [];
|
68
|
+
|
69
|
+
// loading local themes
|
70
|
+
this.getThemes();
|
71
|
+
return this;
|
72
|
+
};
|
73
|
+
|
74
|
+
// Prototype
|
75
|
+
// ---------------------------------------------------------------------------
|
76
|
+
BootstrapThemeSwitcher.prototype = {
|
77
|
+
clear: function () {
|
78
|
+
logger.debug('bootstrapThemeSwitcher.clear');
|
79
|
+
return this.$element.each(function () {
|
80
|
+
this.$element.empty();
|
81
|
+
});
|
82
|
+
},
|
83
|
+
update: function () {
|
84
|
+
logger.debug('bootstrapThemeSwitcher.update');
|
85
|
+
this.getThemes();
|
86
|
+
},
|
87
|
+
|
88
|
+
// -------------------------------------------------------------------------
|
89
|
+
// checkStyleSheetByName
|
90
|
+
// -------------------------------------------------------------------------
|
91
|
+
checkStyleSheetByName: function (name) {
|
92
|
+
var found = false;
|
93
|
+
var test = '\/' + name + '\/';
|
94
|
+
var re = new RegExp(test, 'i');
|
95
|
+
|
96
|
+
for(var i = 0; i < document.styleSheets.length; i++){
|
97
|
+
if(re.test(document.styleSheets[i].href)){
|
98
|
+
found=true;
|
99
|
+
break;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
return found;
|
103
|
+
},
|
104
|
+
|
105
|
+
// -------------------------------------------------------------------------
|
106
|
+
// switchTheme
|
107
|
+
// -------------------------------------------------------------------------
|
108
|
+
// NOTE:
|
109
|
+
// For J1 template, switchTheme set only the cookies contents. The theme
|
110
|
+
// switch is done by a page reload. The reload triggers the theme_generator
|
111
|
+
// to load theme CSS from cookies, finally.
|
112
|
+
// -------------------------------------------------------------------------
|
113
|
+
switchTheme: function (name, cssFile) {
|
114
|
+
|
115
|
+
var $this = $(this);
|
116
|
+
var settings = $.extend({}, $.fn.bootstrapThemeSwitcher.defaults, $this.data('bootstrapThemeSwitcher'));
|
117
|
+
var themeName;
|
118
|
+
var theme_css;
|
119
|
+
var theme_extension_css;
|
120
|
+
|
121
|
+
var id = settings.cssThemeLink;
|
122
|
+
var debug = settings.debug;
|
123
|
+
var includeCSS = this.settings.includeBootswatch;
|
124
|
+
|
125
|
+
// detect|set user state cookie
|
126
|
+
user_state_detected = j1.existsCookie ( 'j1.user.state' );
|
127
|
+
if ( user_state_detected ) {
|
128
|
+
logger.debug('cookie found: j1.user.state');
|
129
|
+
j1_user_state = j1.readCookie(user_state_cookie_name);
|
130
|
+
} else {
|
131
|
+
logger.error('cookie not found: j1.user.state');
|
132
|
+
}
|
133
|
+
|
134
|
+
themeName = j1_user_state.theme_name;
|
135
|
+
theme_css = j1_user_state.theme_css;
|
136
|
+
|
137
|
+
if (typeof cssFile === 'undefined') { cssFile = this.settings.defaultCssFile; }
|
138
|
+
if (typeof name === 'undefined') { name = cssFile; }
|
139
|
+
|
140
|
+
// check if theme is to be saved to cookie
|
141
|
+
if (settings.saveToCookie) {
|
142
|
+
if ( typeof Cookies === 'undefined' ) {
|
143
|
+
if ( debug === 'true' ) {
|
144
|
+
logger.error('cookies library not present');
|
145
|
+
}
|
146
|
+
return false;
|
147
|
+
}
|
148
|
+
|
149
|
+
j1_user_state.theme_name = name;
|
150
|
+
j1_user_state.theme_css = cssFile;
|
151
|
+
|
152
|
+
if (!(j1_user_state.theme_name.includes('Uno') || j1_user_state.theme_name == 'Bootstrap')) {
|
153
|
+
j1_user_state.theme_author = 'Bootswatch';
|
154
|
+
j1_user_state.theme_author_url = 'https://bootswatch.com/';
|
155
|
+
} else {
|
156
|
+
j1_user_state.theme_author = 'J1 Team';
|
157
|
+
j1_user_state.theme_author_url = 'https://jekyll.one/';
|
158
|
+
}
|
159
|
+
|
160
|
+
j1.writeCookie({
|
161
|
+
name: user_state_cookie_name,
|
162
|
+
data: j1_user_state
|
163
|
+
});
|
164
|
+
|
165
|
+
// force reload the page from the server (skip cache)
|
166
|
+
// and detect selected theme from cookie
|
167
|
+
location.reload(true);
|
168
|
+
} else {
|
169
|
+
logger.warn('write to cookie : disabled');
|
170
|
+
logger.warn('selected theme not activated: ' + name);
|
171
|
+
} // END if saveToCookie
|
172
|
+
|
173
|
+
}, // END switchTheme
|
174
|
+
|
175
|
+
// -------------------------------------------------------------------------
|
176
|
+
// loadThemeFromCookie
|
177
|
+
// -------------------------------------------------------------------------
|
178
|
+
loadThemeFromCookie: function (options) {
|
179
|
+
|
180
|
+
if ( typeof Cookies === 'undefined' ) {
|
181
|
+
logger.error('cookies library not present');
|
182
|
+
return false;
|
183
|
+
}
|
184
|
+
|
185
|
+
var settings = $.extend({}, $.fn.bootstrapThemeSwitcher.defaults, options);
|
186
|
+
|
187
|
+
// detect|set user state cookie
|
188
|
+
user_state_detected = j1.existsCookie ( 'j1.user.state' );
|
189
|
+
|
190
|
+
if ( user_state_detected ) {
|
191
|
+
logger.info('cookie found: j1.user.state');
|
192
|
+
j1_user_state = j1.readCookie(user_state_cookie_name);
|
193
|
+
} else {
|
194
|
+
logger.error('cookie not found: j1.user.state');
|
195
|
+
}
|
196
|
+
|
197
|
+
var themeName = j1_user_state.theme_name;
|
198
|
+
var themeCss = j1_user_state.theme_css;
|
199
|
+
this.switchTheme(themeName, themeCss);
|
200
|
+
|
201
|
+
}, // END loadThemeFromCookie
|
202
|
+
|
203
|
+
// -------------------------------------------------------------------------
|
204
|
+
// addTheme
|
205
|
+
// -------------------------------------------------------------------------
|
206
|
+
addTheme: function(name, cssFile, start, deleteCount) {
|
207
|
+
if (typeof start === 'undefined') { start = 0; }
|
208
|
+
if (typeof deleteCount === 'undefined') { deleteCount = 0; }
|
209
|
+
this.themesList.splice(start, deleteCount, {name: name, css: cssFile});
|
210
|
+
this.addThemesToControl();
|
211
|
+
}, // END addTheme
|
212
|
+
|
213
|
+
// -------------------------------------------------------------------------
|
214
|
+
// addThemesToControl
|
215
|
+
// -------------------------------------------------------------------------
|
216
|
+
addThemesToControl: function() {
|
217
|
+
if (typeof this.$element === 'undefined') {
|
218
|
+
logger.error('bootstrapThemeSelector|addThemesToControl: Element is undefined');
|
219
|
+
return false;
|
220
|
+
}
|
221
|
+
if (typeof this.themesList === 'undefined') {
|
222
|
+
logger.error('bootstrapThemeSelector|addThemesToControl: Themes is undefined');
|
223
|
+
return false;
|
224
|
+
}
|
225
|
+
|
226
|
+
// if BootSwatch excludes are set
|
227
|
+
if(this.settings.excludeBootswatch){
|
228
|
+
var excludeBootswatchs;
|
229
|
+
// split the string on ,
|
230
|
+
if(this.settings.excludeBootswatch.indexOf(',') !== -1){
|
231
|
+
excludeBootswatchs = this.settings.excludeBootswatch.replace(/ /g, '').split(',');
|
232
|
+
} else {
|
233
|
+
excludeBootswatchs = [];
|
234
|
+
excludeBootswatchs.push(this.settings.excludeBootswatch);
|
235
|
+
}
|
236
|
+
|
237
|
+
var tempThemeList = this.themesList;
|
238
|
+
$.each(tempThemeList, function (i, value) {
|
239
|
+
if(value && value.name){
|
240
|
+
if( $.inArray( value.name, excludeBootswatchs ) !== -1 ){
|
241
|
+
tempThemeList.splice(i,1);
|
242
|
+
}
|
243
|
+
}
|
244
|
+
});
|
245
|
+
this.themesList = tempThemeList;
|
246
|
+
}
|
247
|
+
|
248
|
+
var base = this;
|
249
|
+
|
250
|
+
if (this.$element.is('ul')) {
|
251
|
+
var $this = $(this);
|
252
|
+
var settings = $.extend({}, $.fn.bootstrapThemeSwitcher.defaults, $this.data('bootstrapThemeSwitcher'));
|
253
|
+
var id = settings.cssThemeLink;
|
254
|
+
var themeName;
|
255
|
+
var debug = settings.debug;
|
256
|
+
|
257
|
+
// detect|set user state cookie
|
258
|
+
user_state_detected = j1.existsCookie ( 'j1.user.state' );
|
259
|
+
if ( user_state_detected ) {
|
260
|
+
logger.debug('User state cookie found');
|
261
|
+
j1_user_state = j1.readCookie(user_state_cookie_name);
|
262
|
+
} else {
|
263
|
+
logger.error('User state NOT cookie found');
|
264
|
+
}
|
265
|
+
|
266
|
+
themeName = j1_user_state.theme_name;
|
267
|
+
|
268
|
+
if ( debug === 'true' ) {
|
269
|
+
logger.debug('bootstrapThemeSelector: UL element selected');
|
270
|
+
}
|
271
|
+
this.$element.empty();
|
272
|
+
|
273
|
+
var cssClass;
|
274
|
+
var iconColor = '#9E9E9E';
|
275
|
+
$.each(this.themesList, function (i, value) {
|
276
|
+
// Use DIFFERENT class for MobileMenu
|
277
|
+
//if (base.$element[0].id.includes('MMenu')) {
|
278
|
+
if (base.$element[0].id.includes('mmenu')) {
|
279
|
+
cssClass = 'mmenu-item';
|
280
|
+
} else {
|
281
|
+
cssClass = 'dropdown-item';
|
282
|
+
}
|
283
|
+
// Add class "active" to the current theme selected
|
284
|
+
if ( value.name === themeName ) {
|
285
|
+
// if (base.$element[0].id.includes('MMenu')) {
|
286
|
+
if (base.$element[0].id.includes('mmenu')) {
|
287
|
+
cssClass = 'mmenu-item active';
|
288
|
+
} else {
|
289
|
+
cssClass = 'dropdown-item active';
|
290
|
+
}
|
291
|
+
}
|
292
|
+
var li = $('<li />')
|
293
|
+
.attr('class',cssClass)
|
294
|
+
.append('<a href="#"><i class="mdi mdi-view-quilt mdi-18px mr-2" style="color: ' +iconColor+ '"></i>' +value.name+ '</a>')
|
295
|
+
.on('click', function () {
|
296
|
+
if (settings.loadFromBootswatch) {
|
297
|
+
base.switchTheme(value.name, value.css);
|
298
|
+
} else {
|
299
|
+
base.switchTheme(value.name, value.cssCdn);
|
300
|
+
}
|
301
|
+
// remove previous "active" class and apply to latest clicked element
|
302
|
+
$(this).parent().find('li').removeClass('active');
|
303
|
+
$(this).addClass('active');
|
304
|
+
});
|
305
|
+
base.$element.append(li);
|
306
|
+
});
|
307
|
+
|
308
|
+
} else if (this.$element.is('select')) {
|
309
|
+
logger.debug('bootstrapThemeSelector: SELECT element selected');
|
310
|
+
this.$element.empty();
|
311
|
+
|
312
|
+
var optionSelectedMarker;
|
313
|
+
$.each(this.themesList, function (i, value) {
|
314
|
+
optionSelectedMarker = null;
|
315
|
+
if ( value.name === themeName ) {
|
316
|
+
optionSelectedMarker = 'selected';
|
317
|
+
}
|
318
|
+
if (settings.loadFromBootswatch) {
|
319
|
+
base.$element.append('<option ' + optionSelectedMarker + ' value=\'' + value.css + '\'>' + value.name + '</option>');
|
320
|
+
} else {
|
321
|
+
base.$element.append('<option ' + optionSelectedMarker + ' value=\'' + value.cssCdn + '\'>' + value.name + '</option>');
|
322
|
+
}
|
323
|
+
});
|
324
|
+
this.$element.on('change', function () {
|
325
|
+
var optionSelected = $('option:selected', this);
|
326
|
+
base.switchTheme(optionSelected.text(), optionSelected.val());
|
327
|
+
});
|
328
|
+
|
329
|
+
} else {
|
330
|
+
// no container found to add Theme list
|
331
|
+
logger.info('bootstrapThemeSelector: no UL or SELECT element found');
|
332
|
+
logger.error('bootstrapThemeSelector: failed');
|
333
|
+
// console.warn('bootstrapThemeSelector only works with ul or select elements');
|
334
|
+
}
|
335
|
+
}, // END addThemesToControl
|
336
|
+
|
337
|
+
// -------------------------------------------------------------------------
|
338
|
+
// getThemes
|
339
|
+
// -------------------------------------------------------------------------
|
340
|
+
getThemes: function() {
|
341
|
+
var base = this;
|
342
|
+
|
343
|
+
if (this.settings.localFeed !== null && this.settings.localFeed !== '') {
|
344
|
+
// Deferred loading themes from local themes (json file)
|
345
|
+
$.ajax({
|
346
|
+
url: this.settings.localFeed,
|
347
|
+
// jadams 2016-10-10: removed the setting for sychronous XMLHttpRequest
|
348
|
+
// async: false,
|
349
|
+
dataType: 'json',
|
350
|
+
success: function (data) {
|
351
|
+
base.themesList = data.themes;
|
352
|
+
base.addThemesToControl();
|
353
|
+
},
|
354
|
+
error: function (jqXHR, textStatus, errorThrown) {
|
355
|
+
logger.error('Failed to retrieve the local feed from: \'' + base.settings.localFeed + '\'');
|
356
|
+
}
|
357
|
+
});
|
358
|
+
} else {
|
359
|
+
// Deferred loading remote themes from Bootswatch API
|
360
|
+
// -----------------------------------------------------------------------
|
361
|
+
$.ajax({
|
362
|
+
url: this.settings.bootswatchApiUrl + '/' + this.settings.bootswatchApiVersion + '.json',
|
363
|
+
// jadams 2016-10-10: removed the setting for sychronous XMLHttpRequest
|
364
|
+
// async: false,
|
365
|
+
dataType: 'json',
|
366
|
+
success: function (data) {
|
367
|
+
if (typeof data.themes === 'undefined') {
|
368
|
+
return null;
|
369
|
+
}
|
370
|
+
base.themesList = data.themes;
|
371
|
+
base.themesList.splice(0,0, {name: 'default', css: base.settings.defaultCssFile});
|
372
|
+
base.addThemesToControl();
|
373
|
+
}
|
374
|
+
});
|
375
|
+
}
|
376
|
+
}, // END getThemes
|
377
|
+
|
378
|
+
// -------------------------------------------------------------------------
|
379
|
+
// themes
|
380
|
+
// -------------------------------------------------------------------------
|
381
|
+
themes : function (newThemeList) {
|
382
|
+
if (typeof newThemeList === 'undefined') {
|
383
|
+
return this.themesList;
|
384
|
+
}
|
385
|
+
else {
|
386
|
+
// TODO: Set the associated control.
|
387
|
+
this.themesList = newThemeList;
|
388
|
+
}
|
389
|
+
} // END themes
|
390
|
+
|
391
|
+
}; // END prototype
|
392
|
+
|
393
|
+
// Plugin definition
|
394
|
+
// ---------------------------------------------------------------------------
|
395
|
+
$.fn.bootstrapThemeSwitcher = function (option) {
|
396
|
+
var methodReturn;
|
397
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
398
|
+
var $this = $(this);
|
399
|
+
var data = $this.data('bootstrapThemeSwitcher');
|
400
|
+
var options = typeof option === 'object' && option;
|
401
|
+
|
402
|
+
if (!data) {
|
403
|
+
$this.data('bootstrapThemeSwitcher', (data = new BootstrapThemeSwitcher(this, options) ));
|
404
|
+
}
|
405
|
+
if (typeof option === 'string') {
|
406
|
+
methodReturn = data[ option ].apply(data, args);
|
407
|
+
}
|
408
|
+
return ( typeof methodReturn === 'undefined' ) ? $this : methodReturn;
|
409
|
+
};
|
410
|
+
|
411
|
+
$.fn.bootstrapThemeSwitcher.defaults = {
|
412
|
+
debug: false,
|
413
|
+
saveToCookie: true,
|
414
|
+
cssThemeLink: 'bootstrapTheme',
|
415
|
+
cookieThemeName: 'bootstrapTheme.name',
|
416
|
+
cookieThemeCss: 'boostrapTheme.css',
|
417
|
+
cookieExpiration: 365,
|
418
|
+
cookiePath: '/',
|
419
|
+
defaultCssFile: 'https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css',
|
420
|
+
bootswatchApiUrl: 'https://bootswatch.com/api/',
|
421
|
+
bootswatchApiVersion: '4',
|
422
|
+
loadFromBootswatch: true,
|
423
|
+
localFeed: '',
|
424
|
+
excludeBootswatch: ''
|
425
|
+
};
|
426
|
+
|
427
|
+
$.fn.bootstrapThemeSwitcher.Constructor = BootstrapThemeSwitcher;
|
428
|
+
|
429
|
+
$.fn.bootstrapThemeSwitcher.noConflict = function () {
|
430
|
+
$.fn.BootstrapThemeSwitcher = old;
|
431
|
+
return this;
|
432
|
+
};
|
433
|
+
|
434
|
+
})(jQuery, window, document);
|