j1-template 2020.0.1 → 2020.0.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/content_generator_blog_archive.html +22 -18
- data/_includes/themes/j1/layouts/content_generator_collection.html +15 -12
- data/_includes/themes/j1/layouts/content_generator_page.html +16 -17
- data/_includes/themes/j1/layouts/content_generator_post.html +19 -24
- data/_includes/themes/j1/modules/navigator/generator.html +62 -40
- data/assets/data/menu.html +6 -5
- data/assets/data/mmenu.html +455 -0
- data/assets/data/{sidebar.html → mmenu_sidebar.html} +24 -18
- data/assets/data/mmenu_toc.html +45 -0
- data/assets/data/quicklinks.html +9 -4
- data/assets/data/ssm.html +227 -0
- data/assets/error_pages/HTTP204.html +3 -3
- data/assets/themes/j1/core/css/bootstrap.css +116 -93
- data/assets/themes/j1/core/css/bootstrap.min.css +4 -4
- data/assets/themes/j1/core/css/globals.css +1 -1
- data/assets/themes/j1/core/css/theme_extensions.css +186 -96
- data/assets/themes/j1/core/css/theme_extensions.min.css +1 -1
- data/assets/themes/j1/core/css/uno.css +186 -96
- data/assets/themes/j1/core/css/uno.min.css +1 -1
- data/assets/themes/j1/core/css/vendor.css +130 -104
- data/assets/themes/j1/core/css/vendor.min.css +4 -4
- data/assets/themes/j1/core/js/template.js +296 -24
- data/assets/themes/j1/core/js/template.js.map +1 -1
- data/assets/themes/j1/core/js/template.min.js +1 -1
- data/lib/j1/version.rb +1 -1
- data/lib/j1_app/j1_auth_manager/auth_manager.rb +21 -17
- data/lib/j1_app/j1_auth_manager/config.rb +13 -9
- data/lib/j1_app/j1_site_manager/static_site.rb +1 -1
- data/lib/starter_web/Gemfile +2 -2
- data/lib/starter_web/_config.yml +12 -139
- data/lib/starter_web/_data/modules/authentication.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/navigator.yml +25 -24
- data/lib/starter_web/_data/modules/defaults/ssm.yml +50 -0
- data/lib/starter_web/_data/modules/defaults/toccer.yml +14 -15
- data/lib/starter_web/_data/modules/navigator.yml +164 -97
- data/lib/starter_web/_data/modules/ssm.yml +133 -0
- data/lib/starter_web/_data/modules/toccer.yml +20 -62
- data/lib/starter_web/_data/resources.yml +74 -51
- data/lib/starter_web/_data/template_settings.yml +13 -13
- data/lib/starter_web/_plugins/uglify.rb +41 -0
- data/lib/starter_web/apps/public/{cc → cc/cc.yml} +0 -0
- data/lib/starter_web/apps/public/cc/index.adoc +107 -0
- data/lib/starter_web/assets/images/modules/icons/j1/{j1..ico → j1.ico} +0 -0
- data/lib/starter_web/assets/themes/j1/adapter/js/algolia.js +321 -0
- data/lib/starter_web/assets/themes/j1/adapter/js/attic.js +4 -4
- data/lib/starter_web/assets/themes/j1/adapter/js/carousel.js +3 -3
- data/lib/starter_web/assets/themes/j1/adapter/js/framer.js +3 -3
- data/lib/starter_web/assets/themes/j1/adapter/js/j1.js +19 -60
- data/lib/starter_web/assets/themes/j1/adapter/js/mmenu.js +452 -0
- data/lib/starter_web/assets/themes/j1/adapter/js/navigator.js +50 -50
- data/lib/starter_web/assets/themes/j1/adapter/js/ssm.js +498 -0
- data/lib/starter_web/assets/themes/j1/adapter/js/themer.js +1 -1
- data/lib/starter_web/assets/themes/j1/adapter/js/toccer.js +40 -43
- data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/css/mmenu-light.css +384 -0
- data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/css/mmenu-light.min.css +384 -0
- data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/css/themes/uno.css +153 -0
- data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/css/themes/uno.min.css +153 -0
- data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/js/mmenu-light.js +11 -0
- data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/js/mmenu-light.min.js +11 -0
- data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/js/mmenu-light.polyfills.js +118 -0
- data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/js/mmenu-light.polyfills.min.js +118 -0
- data/lib/starter_web/collections/posts/public/{jekyll → featured}/_posts/2018-05-01-confusion-about-base-url.adoc +0 -0
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/learn/floating_sidebar.adoc +199 -0
- data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +2 -2
- data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +2 -2
- data/lib/starter_web/pages/public/learn/whats_up.adoc +12 -11
- data/lib/starter_web/pages/public/legal/en/500_support.adoc +1 -1
- data/lib/starter_web/pages/public/previewer/000_includes/tables/mdi_icons/200_rotate.asciidoc +1 -1
- data/lib/starter_web/pages/public/previewer/mdi_icons_preview.adoc +2 -3
- data/lib/starter_web/pages/public/previewer/twitter_emoji_preview.adoc +3 -3
- data/lib/starter_web/pages/public/site_search.adoc +196 -0
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +26 -13
- data/assets/themes/j1/core/css/globals.scss +0 -28
- data/lib/starter_web/_data/modules/back2top.yml +0 -40
- data/lib/starter_web/_data/modules/defaults/back2top.yml +0 -147
- data/lib/starter_web/_data/modules/defaults/smooth_scroll.yml +0 -169
- data/lib/starter_web/_data/modules/smooth_scroll.yml +0 -169
- data/lib/starter_web/assets/themes/j1/adapter/js/back2top.js +0 -227
- data/lib/starter_web/assets/themes/j1/adapter/js/scroller.js +0 -177
@@ -0,0 +1,452 @@
|
|
1
|
+
---
|
2
|
+
regenerate: true
|
3
|
+
---
|
4
|
+
|
5
|
+
{% capture cache %}
|
6
|
+
|
7
|
+
{% comment %}
|
8
|
+
# -----------------------------------------------------------------------------
|
9
|
+
# ~/assets/themes/j1/adapter/js/mmenu.js
|
10
|
+
# Liquid template to adapt Mmenu-Light Core functions
|
11
|
+
#
|
12
|
+
# Product/Info:
|
13
|
+
# https://jekyll.one
|
14
|
+
#
|
15
|
+
# Copyright (C) 2020 Juergen Adams
|
16
|
+
#
|
17
|
+
# J1 Template is licensed under the MIT License.
|
18
|
+
# For details, see https://jekyll.one
|
19
|
+
# -----------------------------------------------------------------------------
|
20
|
+
# Test data:
|
21
|
+
# {{ liquid_var | debug }}
|
22
|
+
# -----------------------------------------------------------------------------
|
23
|
+
# NOTE:
|
24
|
+
#
|
25
|
+
# JSON pretty print
|
26
|
+
# Example: var str = JSON.stringify(obj, null, 2); // spacing level = 2
|
27
|
+
# See: https://stackoverflow.com/questions/4810841/how-can-i-pretty-print-json-using-javascript
|
28
|
+
# -----------------------------------------------------------------------------
|
29
|
+
{% endcomment %}
|
30
|
+
|
31
|
+
{% comment %} Liquid procedures
|
32
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
33
|
+
{% capture select_color %}themes/{{site.template.name}}/procedures/global/select_color.proc{% endcapture %}
|
34
|
+
|
35
|
+
{% comment %} Set global settings
|
36
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
37
|
+
{% assign environment = site.environment %}
|
38
|
+
{% assign brand_image_height = site.brand.image_height %}
|
39
|
+
|
40
|
+
{% comment %} Process YML config data
|
41
|
+
================================================================================ {% endcomment %}
|
42
|
+
|
43
|
+
{% comment %} Set config files
|
44
|
+
{% assign auth_manager_config = site.j1_auth %}
|
45
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
46
|
+
{% assign site_config = site %}
|
47
|
+
{% assign template_config = site.data.template_settings %}
|
48
|
+
{% assign blocks = site.data.blocks %}
|
49
|
+
{% assign modules = site.data.modules %}
|
50
|
+
|
51
|
+
{% assign template_config = site.data.template_settings %}
|
52
|
+
{% assign navigator_defaults = site.data.modules.defaults.navigator.defaults %}
|
53
|
+
{% assign navigator_settings = site.data.modules.navigator.settings %}
|
54
|
+
|
55
|
+
{% comment %} Set config data
|
56
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
57
|
+
{% assign nav_mmenu_defaults = navigator_defaults.nav_mmenu %}
|
58
|
+
{% assign nav_mmenu_settings = navigator_settings.nav_mmenu %}
|
59
|
+
|
60
|
+
{% comment %} Set config options
|
61
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
62
|
+
{% assign nav_mmenu_options = nav_mmenu_defaults | merge: nav_mmenu_settings %}
|
63
|
+
{% assign nav_mmenu_id = navigator_defaults.nav_mmenu.xhr_container_id %}
|
64
|
+
{% assign nav_navbar_media_breakpoint = navigator_defaults.nav_bar.media_breakpoint %}
|
65
|
+
|
66
|
+
/*
|
67
|
+
# -----------------------------------------------------------------------------
|
68
|
+
# ~/assets/themes/j1/adapter/js/mmenu.js
|
69
|
+
# JS Adapter for J1 MobileMenu (MMenu Light)
|
70
|
+
#
|
71
|
+
# Product/Info:
|
72
|
+
# {{site.data.template_settings.theme_author_url}}
|
73
|
+
#
|
74
|
+
# Copyright (C) 2020 Juergen Adams
|
75
|
+
#
|
76
|
+
# J1 Template is licensed under the MIT License.
|
77
|
+
# For details, see {{site.data.template_settings.theme_author_url}}
|
78
|
+
# -----------------------------------------------------------------------------
|
79
|
+
# NOTE: For AJAX (XHR) loads see
|
80
|
+
# https://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-requests-are-done
|
81
|
+
# -----------------------------------------------------------------------------
|
82
|
+
# NOTE: For getStyleValue helper see
|
83
|
+
# https://stackoverflow.com/questions/16965515/how-to-get-a-style-attribute-from-a-css-class-by-javascript-jquery
|
84
|
+
# -----------------------------------------------------------------------------
|
85
|
+
# Adapter generated: {{site.time}}
|
86
|
+
# -----------------------------------------------------------------------------
|
87
|
+
*/
|
88
|
+
'use strict';
|
89
|
+
|
90
|
+
j1.adapter['mmenu'] = (function (j1, window) {
|
91
|
+
|
92
|
+
// ---------------------------------------------------------------------------
|
93
|
+
// globals
|
94
|
+
// ---------------------------------------------------------------------------
|
95
|
+
var environment = '{{environment}}';
|
96
|
+
var dclFinished = false;
|
97
|
+
var moduleOptions = {};
|
98
|
+
var cookie_names = j1.getCookieNames();
|
99
|
+
var user_state;
|
100
|
+
var user_session;
|
101
|
+
var user_data;
|
102
|
+
var _this;
|
103
|
+
var logger;
|
104
|
+
var logText;
|
105
|
+
|
106
|
+
// ---------------------------------------------------------------------------
|
107
|
+
// helper functions
|
108
|
+
// ---------------------------------------------------------------------------
|
109
|
+
|
110
|
+
|
111
|
+
// ---------------------------------------------------------------------------
|
112
|
+
// main object
|
113
|
+
// ---------------------------------------------------------------------------
|
114
|
+
return {
|
115
|
+
|
116
|
+
// -------------------------------------------------------------------------
|
117
|
+
// module initializer
|
118
|
+
// -------------------------------------------------------------------------
|
119
|
+
init: function (options) {
|
120
|
+
// initialize state flag
|
121
|
+
j1.adapter.mmenu.state = 'pending';
|
122
|
+
|
123
|
+
// -----------------------------------------------------------------------
|
124
|
+
// defaults
|
125
|
+
// -----------------------------------------------------------------------
|
126
|
+
var settings = $.extend({
|
127
|
+
module_name: 'j1.adapter.mmenu',
|
128
|
+
generated: '{{site.time}}'
|
129
|
+
}, options);
|
130
|
+
|
131
|
+
// -----------------------------------------------------------------------
|
132
|
+
// globals
|
133
|
+
// -----------------------------------------------------------------------
|
134
|
+
_this = j1.adapter.mmenu;
|
135
|
+
logger = log4javascript.getLogger('j1.adapter.mmenu');
|
136
|
+
|
137
|
+
// -----------------------------------------------------------------------
|
138
|
+
// options loader
|
139
|
+
// -----------------------------------------------------------------------
|
140
|
+
var navMenuOptions = $.extend({}, {{nav_mmenu_options | replace: '=>', ':' }});
|
141
|
+
var xhr_data_path;
|
142
|
+
var menu_id;
|
143
|
+
|
144
|
+
// save config settings into the mmenu object for global access
|
145
|
+
//
|
146
|
+
j1.adapter.mmenu['navMenuOptions'] = navMenuOptions;
|
147
|
+
|
148
|
+
// Load (individual) frontmatter options (currently NOT used)
|
149
|
+
//
|
150
|
+
if (options != null) { var frontmatterOptions = $.extend({}, options) }
|
151
|
+
|
152
|
+
_this.setState('started');
|
153
|
+
logger.info('state: ' + _this.getState());
|
154
|
+
logger.info('module is being initialized');
|
155
|
+
|
156
|
+
// jadams, 2020-06-24: Set max_count to 100 what cause to wait 2.5s
|
157
|
+
// for J1 Navigator to finish (init)
|
158
|
+
//
|
159
|
+
var interval_count = 0;
|
160
|
+
var max_count = 100;
|
161
|
+
|
162
|
+
var dependencies_met_navigator = setInterval(function() {
|
163
|
+
interval_count += 1;
|
164
|
+
if ( j1.adapter.navigator.getState() == 'finished' ) {
|
165
|
+
logger.info('dependencies of module navigator met for: mmenu');
|
166
|
+
logger.info('dependencies of module navigator met after: ' + interval_count * 25 + ' ms');
|
167
|
+
j1.adapter.mmenu.mmenuLoader(navMenuOptions);
|
168
|
+
clearInterval(dependencies_met_navigator);
|
169
|
+
}
|
170
|
+
if (interval_count > max_count) {
|
171
|
+
logger.warn('dependency check failed for module: navigator');
|
172
|
+
logger.warn('dependencies of module navigator met after: ' + interval_count * 25 + ' ms');
|
173
|
+
clearInterval(dependencies_met_navigator);
|
174
|
+
j1.adapter.mmenu.mmenuLoader(navMenuOptions);
|
175
|
+
}
|
176
|
+
}, 25);
|
177
|
+
}, // END init
|
178
|
+
|
179
|
+
// -------------------------------------------------------------------------
|
180
|
+
// MMenu Loader
|
181
|
+
// -------------------------------------------------------------------------
|
182
|
+
mmenuLoader: function (mmOptions) {
|
183
|
+
var menu_id;
|
184
|
+
var xhr_data_path;
|
185
|
+
|
186
|
+
_this.setState('loading');
|
187
|
+
logger.info('status: ' + _this.getState());
|
188
|
+
logger.info('load HTML data for navs and drawers');
|
189
|
+
|
190
|
+
{% assign id_list = "" %}
|
191
|
+
|
192
|
+
// -----------------------------------------------------------------------
|
193
|
+
// Load HTML data (AJAX)
|
194
|
+
// -----------------------------------------------------------------------
|
195
|
+
// jadams, 202-06-24: Promise (chain) if $.when seems NOT to work correctly.
|
196
|
+
// It semms a chain using .then will be a better solution to make it sure
|
197
|
+
// that the last Deferred set the state to 'data_loaded'.
|
198
|
+
// Found the final state randomly set to 'null' what prevent the module
|
199
|
+
// to run mmenuInitializer.
|
200
|
+
// Workaround: Set 'data_loaded' to be returned by all Deferred in
|
201
|
+
// the chain.
|
202
|
+
// See: https://stackoverflow.com/questions/5436327/jquery-deferreds-and-promises-then-vs-done
|
203
|
+
//
|
204
|
+
{% comment %} Modify chain
|
205
|
+
--------------------------------------------------------------------------
|
206
|
+
{% if forloop.last %}'data_loaded'{% else %}'null'{% endif %}){% if forloop.last %}{% else %},{% endif %}
|
207
|
+
to
|
208
|
+
{% if forloop.last %}'data_loaded'{% else %}'data_loaded'{% endif %}){% if forloop.last %}{% else %},{% endif %}
|
209
|
+
-------------------------------------------------------------------------- {% endcomment %}
|
210
|
+
$.when (
|
211
|
+
{% for item in nav_mmenu_options.menus %} {% if item.menu.enabled %}
|
212
|
+
{% assign menu_id = item.menu.xhr_container_id %}
|
213
|
+
{% assign xhr_data_path = item.menu.xhr_data_path %}
|
214
|
+
|
215
|
+
j1.xhrData (
|
216
|
+
'j1.adapter.mmenu', {
|
217
|
+
xhr_container_id: "{{menu_id}}",
|
218
|
+
xhr_data_path: "{{xhr_data_path}}" },
|
219
|
+
{% if forloop.last %}'null'{% else %}'null'{% endif %}){% if forloop.last %}{% else %},{% endif %}
|
220
|
+
|
221
|
+
{% endif %}
|
222
|
+
{% capture id_list %}{{id_list}}{{menu_id}}{% if forloop.last %}{% else %},{% endif %} {% endcapture %}
|
223
|
+
{% endfor %} // ENDFOR menus
|
224
|
+
).done (function ({{id_list}}) {
|
225
|
+
// ---------------------------------------------------------------------
|
226
|
+
// Initialize MMenu Navs and Drawers
|
227
|
+
// ---------------------------------------------------------------------
|
228
|
+
// Make sure that Load HTML data (AJAX) is finished
|
229
|
+
setTimeout (function() {
|
230
|
+
_this.setState('data_loaded');
|
231
|
+
}, 300);
|
232
|
+
|
233
|
+
var dependencies_met_mmenu_initialized = setInterval (function () {
|
234
|
+
if (_this.getState() === 'data_loaded') {
|
235
|
+
logger.info('load HTML data (AJAX): finished');
|
236
|
+
_this.setState('processing');
|
237
|
+
logger.info('status: ' + _this.getState());
|
238
|
+
logger.info('initialize navs and drawers');
|
239
|
+
j1.adapter.mmenu.mmenuInitializer(mmOptions);
|
240
|
+
clearInterval(dependencies_met_mmenu_initialized);
|
241
|
+
}
|
242
|
+
}, 25); // END dependencies_met_mmenu_loaded
|
243
|
+
|
244
|
+
var dependencies_met_all_menu_loaded = setInterval (function () {
|
245
|
+
if ( $('#menu_mmenu').length && $('#sidebar_mmenu').length && $('#toc_mmenu').length ) {
|
246
|
+
_this.setState('finished');
|
247
|
+
logger.info('status: ' + _this.getState());
|
248
|
+
clearInterval(dependencies_met_all_menu_loaded);
|
249
|
+
}
|
250
|
+
}, 25); // END dependencies_met_all_menu_loaded
|
251
|
+
}); // END done
|
252
|
+
}, // END dataLoader
|
253
|
+
|
254
|
+
// -------------------------------------------------------------------------
|
255
|
+
// MMenu Initializer
|
256
|
+
// -------------------------------------------------------------------------
|
257
|
+
mmenuInitializer: function (mmOptions) {
|
258
|
+
var menu_id;
|
259
|
+
var xhr_data_path;
|
260
|
+
|
261
|
+
{% for item in nav_mmenu_options.menus %} {% if item.menu.enabled %}
|
262
|
+
|
263
|
+
{% assign menu_id = item.menu.xhr_container_id %}
|
264
|
+
menu_id = "{{menu_id}}";
|
265
|
+
xhr_data_path = "{{item.menu.xhr_data_path}}";
|
266
|
+
|
267
|
+
// Create an mmenu instance if id exists: {{menu_id}}
|
268
|
+
if ($('#{{menu_id}}').length) {
|
269
|
+
|
270
|
+
logger.info('mmenu is being initialized on id: {{menu_id}}');
|
271
|
+
|
272
|
+
{% if item.menu.content.type == "navigation" %}
|
273
|
+
// Create an mmenu instance of type NAVIGATION
|
274
|
+
logger.info('found content type: NAVIGATION');
|
275
|
+
// ---------------------------------------------------------------------
|
276
|
+
// menu initializer (NAVIGATION)
|
277
|
+
// ---------------------------------------------------------------------
|
278
|
+
logger.info('initialize mmenu on id: #{{menu_id}}');
|
279
|
+
var dependencies_met_{{menu_id}}_loaded = setInterval (function () {
|
280
|
+
if ({{menu_id}}) {
|
281
|
+
const menu_selector = document.querySelector('#{{menu_id}}');
|
282
|
+
const mmenu_{{menu_id}} = new MmenuLight (
|
283
|
+
menu_selector,
|
284
|
+
'(max-width: ' + mmOptions.mmenu_plugin.max_width +'px)', {
|
285
|
+
// plugin options
|
286
|
+
node: mmOptions.mmenu_plugin.node,
|
287
|
+
mediaQuery: mmOptions.mmenu_plugin.mediaQuery
|
288
|
+
});
|
289
|
+
|
290
|
+
const drawer_{{menu_id}} = mmenu_{{menu_id}}.offcanvas ({
|
291
|
+
// drawer options
|
292
|
+
position: mmOptions.mmenu_drawer.position
|
293
|
+
});
|
294
|
+
|
295
|
+
const navigator_{{menu_id}} = mmenu_{{menu_id}}.navigation ({
|
296
|
+
// navigator options
|
297
|
+
selected: mmOptions.mmenu_navigator.selected,
|
298
|
+
slidingSubmenus: mmOptions.mmenu_navigator.slidingSubmenus,
|
299
|
+
title: mmOptions.mmenu_navigator.title,
|
300
|
+
theme: mmOptions.mmenu_navigator.theme
|
301
|
+
});
|
302
|
+
|
303
|
+
// Toggle Bars (Hamburger) for the NavBar to open|close
|
304
|
+
// the mmenu drawer
|
305
|
+
$('{{item.menu.content.button}}').each(function(e) {
|
306
|
+
var $this = $(this);
|
307
|
+
|
308
|
+
$this.on('click', function(e){
|
309
|
+
const button_{{menu_id}} = this;
|
310
|
+
|
311
|
+
// TODO: Animated toggle button
|
312
|
+
//
|
313
|
+
// $('{{item.menu.content.toggler}}').toggleClass('fadeIn');
|
314
|
+
// $('{{item.menu.content.toggler}}').toggleClass('rotateIn')
|
315
|
+
|
316
|
+
// $('.mdi', this).toggleClass('mdi-menu');
|
317
|
+
// $('.mdi', this).toggleClass('mdi-close');
|
318
|
+
|
319
|
+
e.preventDefault();
|
320
|
+
|
321
|
+
// (toggler_{{menu_id}}.t = !toggler_{{menu_id}}.t)
|
322
|
+
// ? drawer_{{menu_id}}.open()
|
323
|
+
// : drawer_{{menu_id}}.close();
|
324
|
+
|
325
|
+
drawer_{{menu_id}}.open()
|
326
|
+
});
|
327
|
+
});
|
328
|
+
clearInterval(dependencies_met_{{menu_id}}_loaded);
|
329
|
+
$('#{{item.menu.content.id}}').show();
|
330
|
+
logger.info('initializing mmenu finished on id: #{{menu_id}}');
|
331
|
+
}; // END mmenu_loaded
|
332
|
+
}, 25); // END dependencies_met_mmenu_loaded
|
333
|
+
{% endif %} // ENDIF content_type: NAVIGATION
|
334
|
+
|
335
|
+
{% if item.menu.content.type == "drawer" %}
|
336
|
+
// Create an mmenu instance of type HTML
|
337
|
+
logger.info('found content type: DRAWER');
|
338
|
+
// -------------------------------------------------------------------
|
339
|
+
// menu initializer (DRAWER)
|
340
|
+
// -------------------------------------------------------------------
|
341
|
+
logger.info('initialize mmenu on id: #{{menu_id}}');
|
342
|
+
var dependencies_met_{{menu_id}}_loaded = setInterval (function () {
|
343
|
+
if ({{menu_id}}) {
|
344
|
+
const menu_selector = document.querySelector('#{{menu_id}}');
|
345
|
+
|
346
|
+
const mmenu_{{menu_id}} = new MmenuLight (
|
347
|
+
menu_selector,
|
348
|
+
'(max-width: ' + mmOptions.mmenu_plugin.max_width +'px)', {
|
349
|
+
// plugin options
|
350
|
+
node: mmOptions.mmenu_plugin.node,
|
351
|
+
mediaQuery: mmOptions.mmenu_plugin.mediaQuery
|
352
|
+
});
|
353
|
+
|
354
|
+
const drawer_{{menu_id}} = mmenu_{{menu_id}}.offcanvas ({
|
355
|
+
// drawer options
|
356
|
+
position: "{{item.menu.drawer.position}}"
|
357
|
+
});
|
358
|
+
|
359
|
+
// button for the MMenu tocbar to open|close the toc drawer
|
360
|
+
$('{{item.menu.content.button}}').each(function(e) {
|
361
|
+
var $this = $(this);
|
362
|
+
|
363
|
+
$this.on('click', function(e) {
|
364
|
+
var button_{{menu_id}} = this;
|
365
|
+
var hasClass;
|
366
|
+
|
367
|
+
// check if the button should be activated
|
368
|
+
// e.g for TOC only if clas js-toc-content is found
|
369
|
+
//
|
370
|
+
if ('{{item.menu.content.button_activated}}' != 'always') {
|
371
|
+
hasClass = $('main').hasClass('{{item.menu.content.button_activated}}');
|
372
|
+
} else {
|
373
|
+
hasClass = true;
|
374
|
+
}
|
375
|
+
if (hasClass) {
|
376
|
+
// Toggle button animation
|
377
|
+
//$('{{item.menu.content.toggler}}').toggleClass('{{item.menu.content.toggler_animation}}')
|
378
|
+
|
379
|
+
e.preventDefault();
|
380
|
+
|
381
|
+
// (toggler_{{menu_id}}.t = !toggler_{{menu_id}}.t)
|
382
|
+
// ? drawer_{{menu_id}}.open()
|
383
|
+
// : drawer_{{menu_id}}.close();
|
384
|
+
|
385
|
+
drawer_{{menu_id}}.open()
|
386
|
+
} // END if hasclass
|
387
|
+
});
|
388
|
+
});
|
389
|
+
clearInterval(dependencies_met_{{menu_id}}_loaded);
|
390
|
+
$('#{{item.menu.content.id}}').show();
|
391
|
+
}; // END if menu_loaded
|
392
|
+
}, 25); // END dependencies_met_mmenu_loaded
|
393
|
+
logger.info('initializing mmenu finished on id: #{{menu_id}}');
|
394
|
+
{% endif %} // ENDIF content_type: DRAWER
|
395
|
+
} // END menus|drawers
|
396
|
+
{% endif %} // ENDIF menu enabled
|
397
|
+
{% endfor %} // ENDFOR menus
|
398
|
+
}, // END mmenuInitializer
|
399
|
+
|
400
|
+
// -------------------------------------------------------------------------
|
401
|
+
// messageHandler
|
402
|
+
// Manage messages (paylods) send from other J1 modules
|
403
|
+
// -------------------------------------------------------------------------
|
404
|
+
messageHandler: function (sender, message) {
|
405
|
+
// var json_message = JSON.stringify(message, undefined, 2); // multiline
|
406
|
+
var json_message = JSON.stringify(message);
|
407
|
+
|
408
|
+
logText = 'received message from ' + sender + ': ' + json_message;
|
409
|
+
logger.debug(logText);
|
410
|
+
|
411
|
+
// -----------------------------------------------------------------------
|
412
|
+
// Process commands|actions
|
413
|
+
// -----------------------------------------------------------------------
|
414
|
+
if (message.type === 'command' && message.action === 'module_initialized') {
|
415
|
+
//
|
416
|
+
// Place handling of command|action here
|
417
|
+
//
|
418
|
+
logger.info(message.text);
|
419
|
+
}
|
420
|
+
if (message.type === 'command' && message.action === 'status') {
|
421
|
+
logger.info('messageHandler: received - ' + message.action);
|
422
|
+
}
|
423
|
+
|
424
|
+
//
|
425
|
+
// Place handling of other command|action here
|
426
|
+
//
|
427
|
+
|
428
|
+
return true;
|
429
|
+
}, // END messageHandler
|
430
|
+
|
431
|
+
// -------------------------------------------------------------------------
|
432
|
+
// setState
|
433
|
+
// Set the current (processing) state of the module
|
434
|
+
// -------------------------------------------------------------------------
|
435
|
+
setState: function (stat) {
|
436
|
+
j1.adapter.mmenu.state = stat;
|
437
|
+
}, // END setState
|
438
|
+
|
439
|
+
// -------------------------------------------------------------------------
|
440
|
+
// getState
|
441
|
+
// Returns the current (processing) state of the module
|
442
|
+
// -------------------------------------------------------------------------
|
443
|
+
getState: function () {
|
444
|
+
return j1.adapter.mmenu.state;
|
445
|
+
} // END state
|
446
|
+
|
447
|
+
}; // END return
|
448
|
+
})(j1, window);
|
449
|
+
|
450
|
+
{% endcapture %}
|
451
|
+
{{ cache | strip_empty_lines }}
|
452
|
+
{% assign cache = nil %}
|
@@ -26,6 +26,11 @@ regenerate: true
|
|
26
26
|
# Example: var str = JSON.stringify(obj, null, 2); // spacing level = 2
|
27
27
|
# See: https://stackoverflow.com/questions/4810841/how-can-i-pretty-print-json-using-javascript
|
28
28
|
# -----------------------------------------------------------------------------
|
29
|
+
# NOTE:
|
30
|
+
# jadams, 2020-06-21:
|
31
|
+
# J1 Navigator needs a general revision on BS4 code and functionalities
|
32
|
+
# Current, only base function are tested with BS4 (was coded for BS3)
|
33
|
+
# -----------------------------------------------------------------------------
|
29
34
|
{% endcomment %}
|
30
35
|
|
31
36
|
{% comment %} Liquid procedures
|
@@ -67,8 +72,6 @@ regenerate: true
|
|
67
72
|
{% assign nav_quicklinks_settings = navigator_settings.nav_quicklinks %}
|
68
73
|
{% assign nav_topsearch_defaults = navigator_defaults.nav_topsearch %}
|
69
74
|
{% assign nav_topsearch_settings = navigator_settings.nav_topsearch %}
|
70
|
-
{% assign nav_sidebar_defaults = navigator_defaults.nav_sidebar %}
|
71
|
-
{% assign nav_sidebar_settings = navigator_settings.nav_sidebar %}
|
72
75
|
{% assign nav_authclient_defaults = authentication_defaults.auth_client %}
|
73
76
|
{% assign nav_authclient_settings = authentication_settings.auth_client %}
|
74
77
|
|
@@ -79,12 +82,10 @@ regenerate: true
|
|
79
82
|
{% assign nav_menu_options = nav_menu_defaults | merge: nav_menu_settings %}
|
80
83
|
{% assign quicklinks_options = nav_quicklinks_defaults | merge: nav_quicklinks_settings %}
|
81
84
|
{% assign topsearch_options = nav_topsearch_defaults | merge: nav_topsearch_settings %}
|
82
|
-
{% assign sidebar_options = nav_sidebar_defaults | merge: nav_sidebar_settings %}
|
83
85
|
{% assign authclient_options = nav_authclient_defaults | merge: nav_authclient_settings %}
|
84
86
|
|
85
87
|
{% assign nav_bar_id = navigator_defaults.nav_bar.id %}
|
86
88
|
{% assign nav_menu_id = navigator_defaults.nav_menu.id %}
|
87
|
-
{% assign nav_sidebar_id = navigator_defaults.nav_sidebar.id %}
|
88
89
|
{% assign nav_quicklinks_id = navigator_defaults.nav_quicklinks.id %}
|
89
90
|
{% assign nav_navbar_media_breakpoint = navigator_defaults.nav_bar.media_breakpoint %}
|
90
91
|
{% assign authclient_modals_id = navigator_defaults.nav_authclient.xhr_container_id %}
|
@@ -137,14 +138,12 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
137
138
|
|
138
139
|
var nav_menu_id = '{{nav_menu_id}}';
|
139
140
|
var nav_quicklinks_id = '{{nav_quicklinks_id}}';
|
140
|
-
var nav_sidebar_id = '{{nav_sidebar_id}}';
|
141
141
|
var authclient_modals_id = '{{authclient_modals_id}}';
|
142
142
|
|
143
143
|
var colors_data_path = '{{template_config.colors_data_path}}';
|
144
144
|
var font_size_data_path = '{{template_config.font_size_data_path}}';
|
145
145
|
var nav_menu_data_path = '{{nav_menu_options.data_path}}';
|
146
146
|
var nav_quicklinks_data_path = '{{quicklinks_options.data_path}}';
|
147
|
-
var nav_sidebar_data_path = '{{sidebar_options.data_path}}';
|
148
147
|
var authclient_modals_data_path = '{{authclient_options.xhr_data_path}}';
|
149
148
|
|
150
149
|
var cookie_names = j1.getCookieNames();
|
@@ -201,13 +200,11 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
201
200
|
var navMenuConfig = {};
|
202
201
|
var navQuicklinksConfig = {};
|
203
202
|
var navTopsearchConfig = {};
|
204
|
-
var navSidebarConfig = {};
|
205
203
|
var navAuthClientConfig = {};
|
206
204
|
var navBarOptions = {};
|
207
205
|
var navMenuOptions = {};
|
208
206
|
var navQuicklinksOptions = {};
|
209
207
|
var navTopsearchOptions = {};
|
210
|
-
var navSidebarOptions = {};
|
211
208
|
var navAuthClientOptions = {};
|
212
209
|
var navAuthMAnagerConfig = {};
|
213
210
|
|
@@ -216,7 +213,6 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
216
213
|
navMenuConfig = $.extend({}, {{nav_menu_options | replace: '=>', ':' }});
|
217
214
|
navQuicklinksConfig = $.extend({}, {{quicklinks_options | replace: '=>', ':' }});
|
218
215
|
navTopsearchConfig = $.extend({}, {{topsearch_options | replace: '=>', ':' }});
|
219
|
-
navSidebarConfig = $.extend({}, {{sidebar_options | replace: '=>', ':' }});
|
220
216
|
navAuthClientConfig = $.extend({}, {{authclient_options | replace: '=>', ':' }});
|
221
217
|
|
222
218
|
navAuthMAnagerConfig = $.extend({}, {{authentication_options | replace: '=>', ':' }});
|
@@ -229,7 +225,6 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
229
225
|
navMenuOptions = j1.mergeData(navMenuConfig, navDefaults.nav_menu);
|
230
226
|
navQuicklinksOptions = j1.mergeData(navQuicklinksConfig, navDefaults.nav_quicklinks);
|
231
227
|
navTopsearchOptions = j1.mergeData(navTopsearchConfig, navDefaults.nav_topsearch);
|
232
|
-
navSidebarOptions = j1.mergeData(navSidebarConfig, navDefaults.nav_sidebar);
|
233
228
|
navAuthClientConfig = j1.mergeData(navAuthClientConfig, navDefaults.nav_authclient);
|
234
229
|
|
235
230
|
// save config settings into the navigator object for global access
|
@@ -239,7 +234,6 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
239
234
|
j1.adapter.navigator['navMenuOptions'] = navMenuOptions;
|
240
235
|
j1.adapter.navigator['navQuicklinksOptions'] = navQuicklinksOptions;
|
241
236
|
j1.adapter.navigator['navTopsearchOptions'] = navTopsearchOptions;
|
242
|
-
j1.adapter.navigator['navSidebarOptions'] = navSidebarOptions;
|
243
237
|
j1.adapter.navigator['navAuthClientConfig'] = navAuthClientConfig;
|
244
238
|
j1.adapter.navigator['navAuthManagerConfig'] = navAuthMAnagerConfig;
|
245
239
|
|
@@ -250,35 +244,48 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
250
244
|
logger.info('state: ' + _this.getState());
|
251
245
|
logger.info('module is being initialized');
|
252
246
|
|
247
|
+
// -----------------------------------------------------------------------
|
248
|
+
// Load HTML data (AJAX)
|
249
|
+
// -----------------------------------------------------------------------
|
250
|
+
// jadams, 202-06-24: Promise (chain) if $.when seems NOT to work correctly.
|
251
|
+
// It semms a chain using .then will be a better solution to make it sure
|
252
|
+
// that the last Deferred set the state to 'data_loaded'.
|
253
|
+
// Found the final state randomly set to 'null' what prevent the module
|
254
|
+
// to run mmenuInitializer.
|
255
|
+
// Workaround: Set 'data_loaded' to be returned by all Deferred in
|
256
|
+
// the chain.
|
257
|
+
// See: https://stackoverflow.com/questions/5436327/jquery-deferreds-and-promises-then-vs-done
|
258
|
+
//
|
253
259
|
// -----------------------------------------------------------------------
|
254
260
|
// data loader
|
255
261
|
// -----------------------------------------------------------------------
|
256
262
|
logger.info('run deferred data load');
|
257
263
|
$.when (
|
258
|
-
j1.xhrData (//
|
259
|
-
'j1.adapter.navigator', {
|
260
|
-
xhr_container_id: navSidebarOptions.xhr_container_id,
|
261
|
-
xhr_data_path: navSidebarOptions.xhr_data_path },
|
262
|
-
null),
|
263
|
-
j1.xhrData (// quicklinks
|
264
|
+
j1.xhrData ( // quicklinks
|
264
265
|
'j1.adapter.navigator', {
|
265
266
|
xhr_container_id: navQuicklinksOptions.xhr_container_id,
|
266
267
|
xhr_data_path: navQuicklinksOptions.xhr_data_path },
|
267
268
|
null),
|
268
|
-
j1.xhrData (// authclient
|
269
|
+
j1.xhrData ( // authclient
|
269
270
|
'j1.adapter.navigator', {
|
270
271
|
xhr_container_id: navAuthClientConfig.xhr_container_id,
|
271
272
|
xhr_data_path: navAuthClientConfig.xhr_data_path },
|
272
273
|
null),
|
273
|
-
j1.xhrData (// menubar
|
274
|
+
j1.xhrData ( // menubar
|
274
275
|
'j1.adapter.navigator', {
|
275
276
|
xhr_container_id: navMenuOptions.xhr_container_id,
|
276
277
|
xhr_data_path: navMenuOptions.xhr_data_path },
|
277
278
|
'data_loaded'))
|
278
|
-
.done (function (
|
279
|
+
.done (function (quickLinks, authclient, menuBar) {
|
279
280
|
// ---------------------------------------------------------------------
|
280
281
|
// core initializer
|
281
282
|
// ---------------------------------------------------------------------
|
283
|
+
|
284
|
+
// Make sure that Load HTML data (AJAX) is finished
|
285
|
+
// setTimeout (function() {
|
286
|
+
// _this.setState('data_loaded');
|
287
|
+
// }, 150);
|
288
|
+
|
282
289
|
var dependencies_met_navigator_core = setInterval (function () {
|
283
290
|
if (_this.getState() === 'data_loaded') {
|
284
291
|
_this.setState('processing');
|
@@ -325,8 +332,7 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
325
332
|
logger.info('apply styles');
|
326
333
|
_this.setCSS (
|
327
334
|
navBarOptions, navMenuOptions,
|
328
|
-
navQuicklinksOptions, navTopsearchOptions
|
329
|
-
navSidebarOptions
|
335
|
+
navQuicklinksOptions, navTopsearchOptions
|
330
336
|
);
|
331
337
|
|
332
338
|
logger.info('init auth client');
|
@@ -340,27 +346,28 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
340
346
|
}
|
341
347
|
}, 25); // END 'dependencies_met_navigator_core'
|
342
348
|
|
343
|
-
//
|
344
|
-
// Register event 'reset on resize'
|
345
|
-
//
|
349
|
+
// --------------------------------------------------------------------
|
350
|
+
// Register event 'reset on resize' to call j1.core.navigator on
|
351
|
+
// manageDropdownMenu to manage the (current) NAV menu for
|
352
|
+
// desktop or mobile
|
353
|
+
// ---------------------------------------------------------------------
|
346
354
|
$(window).on('resize', function() {
|
347
355
|
j1.core.navigator.manageDropdownMenu(navDefaults, navMenuOptions);
|
348
356
|
|
357
|
+
// Hide|Close topSearch on resize event
|
349
358
|
$('.top-search').slideUp();
|
359
|
+
|
360
|
+
// Manage sticky NAV bars
|
350
361
|
setTimeout (function(){
|
351
362
|
j1.core.navigator.navbarSticky();
|
352
363
|
}, 500);
|
353
364
|
|
354
|
-
//
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
$('.navbar-collapse').removeClass('in');
|
362
|
-
$('.navbar-collapse').removeClass('on');
|
363
|
-
$('.navbar-collapse').removeClass('bounceIn');
|
365
|
+
// jadams, 2020-06-21: unclear|forgotten what I'm doing here!
|
366
|
+
// Looks like the old BS3 implementation
|
367
|
+
//
|
368
|
+
// $('.navbar-collapse').removeClass('in');
|
369
|
+
// $('.navbar-collapse').removeClass('on');
|
370
|
+
// $('.navbar-collapse').removeClass('bounceIn');
|
364
371
|
});
|
365
372
|
|
366
373
|
return true;
|
@@ -369,12 +376,12 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
369
376
|
|
370
377
|
// -------------------------------------------------------------------------
|
371
378
|
// Initialize JS portion for the dialogs (modals) used by J1AuthClient
|
372
|
-
// NOTE: Currently cookie
|
379
|
+
// NOTE: Currently cookie updates NOT processed at the NAV module
|
373
380
|
// All updates on Cookies are managed by Cookie Consent.
|
374
381
|
// To be considered to re-add cookie updates for the auth state
|
375
382
|
// -------------------------------------------------------------------------
|
376
383
|
initAuthClient: function(auth_config) {
|
377
|
-
var logger
|
384
|
+
var logger = log4javascript.getLogger('j1.adapter.navigator.initAuthClient');
|
378
385
|
var user_session = j1.readCookie(cookie_user_session_name);
|
379
386
|
|
380
387
|
_this.modalEventHandler(auth_config);
|
@@ -502,7 +509,7 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
502
509
|
logger.info(logText);
|
503
510
|
logText = 'initiate signout for provider: ' +provider;
|
504
511
|
logger.info(logText);
|
505
|
-
|
512
|
+
|
506
513
|
var route = '/authentication?request=signout&provider=' + provider + '&provider_signout=' + signOut.providerSignOut; // + '/logout/';
|
507
514
|
logText = 'call middleware on route : ' +route;
|
508
515
|
logger.info(logText);
|
@@ -526,7 +533,7 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
526
533
|
// setCSS
|
527
534
|
// Set dynamic CSS styles
|
528
535
|
// -------------------------------------------------------------------------
|
529
|
-
setCSS: function (navBarOptions, navMenuOptions, navQuicklinksOptions, navTopsearchOptions
|
536
|
+
setCSS: function (navBarOptions, navMenuOptions, navQuicklinksOptions, navTopsearchOptions) {
|
530
537
|
var logger = log4javascript.getLogger("j1.adapter.navigator.setCSS");
|
531
538
|
var gridBreakpoint_lg = '992px';
|
532
539
|
var gridBreakpoint_md = '768px';
|
@@ -571,9 +578,6 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
571
578
|
navTopsearchOptions.input_color = j1.setColorData(navTopsearchOptions.input_color);
|
572
579
|
navTopsearchOptions.background_color = j1.setColorData(navTopsearchOptions.background_color);
|
573
580
|
|
574
|
-
{% comment %} Set|Resolve navSidebarOptions
|
575
|
-
-------------------------------------------------------------------------- {% endcomment %}
|
576
|
-
navSidebarOptions.background_color = j1.setColorData(navSidebarOptions.background_color);
|
577
581
|
|
578
582
|
{% comment %} Set dymanic styles
|
579
583
|
-------------------------------------------------------------------------- {% endcomment %}
|
@@ -595,14 +599,14 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
595
599
|
$('head').append("<style>@media (min-width: " +gridBreakpoint_lg+ ") { nav.navbar.navigator.navbar-scrolled.light { background-color: " +bg_scrolled+ " !important; } }</style>");
|
596
600
|
|
597
601
|
// Menubar collapsed (mobile)
|
598
|
-
|
602
|
+
// $('head').append('<style>.navbar-collapse.collapse.show { background-color: ' +bg_scrolled+ ' !important; }</style>');
|
599
603
|
|
600
604
|
|
601
605
|
/* Navbar media-queries, LARGE Window|Desktop (>= 1024) */
|
602
606
|
/* jadams: Oversized menu bar fixed by: overflow: hidden */
|
603
607
|
// $('head').append("<style>@media (max-width: " +gridBreakpoint_lg+ ") { nav.navbar.navigator { background-color: " +navBarOptions.background_color_collapsed+ " !important; overflow: hidden; } }</style>");
|
604
|
-
|
605
|
-
|
608
|
+
// $('head').append("<style>@media (max-width: " +gridBreakpoint_lg+ ") { nav.navbar.navigator { background-color: " +bg_collapsed+ " !important; overflow: hidden; } }</style>");
|
609
|
+
// $('head').append("<style>@media (max-width: 1023px) { row { margin-left: 0 !important; margin-right: 0 !important; } }</style>");
|
606
610
|
|
607
611
|
{% comment %} navQuicklinks styles
|
608
612
|
-------------------------------------------------------------------------- {% endcomment %}
|
@@ -670,10 +674,6 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
670
674
|
$('head').append("<style>.top-search .input-group-addon { color: " +navTopsearchOptions.input_color+ " !important; }</style>");
|
671
675
|
$('head').append("<style>.top-search .input.form-control { color: " +navTopsearchOptions.input_color+ " !important; }</style>");
|
672
676
|
|
673
|
-
{% comment %} navSidebar styles
|
674
|
-
-------------------------------------------------------------------------- {% endcomment %}
|
675
|
-
$('head').append("<style>.side { background-color: " +navSidebarOptions.background_color+ " !important; }</style>");
|
676
|
-
|
677
677
|
return true;
|
678
678
|
}, // END setCSS
|
679
679
|
|
@@ -779,4 +779,4 @@ j1.adapter['navigator'] = (function (j1, window) {
|
|
779
779
|
|
780
780
|
{% endcapture %}
|
781
781
|
{{ cache | strip_empty_lines }}
|
782
|
-
{% assign cache = nil %}
|
782
|
+
{% assign cache = nil %}
|