j1-template 2020.0.4 → 2020.0.5
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 +1 -1
- data/_includes/themes/j1/layouts/content_generator_collection.html +1 -1
- data/_includes/themes/j1/layouts/content_generator_page.html +1 -1
- data/_includes/themes/j1/layouts/content_generator_post.html +2 -2
- data/_includes/themes/j1/modules/navigator/generator.html +14 -4
- data/assets/data/menu.html +2 -1
- data/assets/data/mmenu.html +2 -2
- data/assets/data/quicklinks.html +0 -3
- data/assets/data/ssm.html +227 -0
- data/assets/themes/j1/core/css/globals.css +1 -1
- data/assets/themes/j1/core/css/theme_extensions.css +138 -0
- data/assets/themes/j1/core/css/theme_extensions.min.css +1 -1
- data/assets/themes/j1/core/css/uno.css +138 -0
- data/assets/themes/j1/core/css/uno.min.css +1 -1
- data/assets/themes/j1/core/js/template.js +3 -3
- 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/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/modules/authentication.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/ssm.yml +50 -0
- data/lib/starter_web/_data/modules/navigator.yml +6 -9
- data/lib/starter_web/_data/modules/navigator.yml.new +232 -0
- data/lib/starter_web/_data/modules/ssm.yml +133 -0
- data/lib/starter_web/_data/resources.yml +28 -7
- data/lib/starter_web/assets/images/modules/icons/j1/{j1..ico → j1.ico} +0 -0
- data/lib/starter_web/assets/themes/j1/adapter/js/mmenu.js +26 -19
- data/lib/starter_web/assets/themes/j1/adapter/js/mmenu.js.new +432 -0
- data/lib/starter_web/assets/themes/j1/adapter/js/ssm.js +496 -0
- data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/js/mmenu-light.js +2 -206
- data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/js/mmenu-light.min.js +2 -204
- 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/whats_up.adoc +12 -11
- 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/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +10 -3
@@ -0,0 +1,133 @@
|
|
1
|
+
# ------------------------------------------------------------------------------
|
2
|
+
# ~/_data/modules/ssc.yml
|
3
|
+
# User Configuration of the SSC Module (Sticky Side Menu)
|
4
|
+
#
|
5
|
+
# Product/Info:
|
6
|
+
# https://jekyll.one
|
7
|
+
#
|
8
|
+
# Copyright (C) 2020 Juergen Adams
|
9
|
+
#
|
10
|
+
# J1 Template is licensed under the MIT License.
|
11
|
+
# See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE
|
12
|
+
#
|
13
|
+
# ------------------------------------------------------------------------------
|
14
|
+
# NOTE:
|
15
|
+
#
|
16
|
+
# ------------------------------------------------------------------------------
|
17
|
+
|
18
|
+
# ------------------------------------------------------------------------------
|
19
|
+
# About this configuration (used for J1 CC only)
|
20
|
+
#
|
21
|
+
about_config:
|
22
|
+
title: Sticky Side Menu
|
23
|
+
scope: User settings
|
24
|
+
location: _data/modules/ssm.yml
|
25
|
+
|
26
|
+
# ------------------------------------------------------------------------------
|
27
|
+
# User settings
|
28
|
+
#
|
29
|
+
settings:
|
30
|
+
enabled: true
|
31
|
+
mode: icon # icon|menu
|
32
|
+
|
33
|
+
# ----------------------------------------------------------------------------
|
34
|
+
# CONTAINER elements
|
35
|
+
#
|
36
|
+
items:
|
37
|
+
|
38
|
+
# --------------------------------------------------------------------------
|
39
|
+
# TOPLEVEL items
|
40
|
+
#
|
41
|
+
- item: Table of Contents
|
42
|
+
enabled: true
|
43
|
+
id: ssm_toc
|
44
|
+
href:
|
45
|
+
target:
|
46
|
+
event_handler: open_mmenu
|
47
|
+
icon: wrap
|
48
|
+
icon_classes:
|
49
|
+
|
50
|
+
- item: To Top
|
51
|
+
enabled: true
|
52
|
+
id: ssm_scroll_to_top
|
53
|
+
event_handler: scroll_to_top
|
54
|
+
href:
|
55
|
+
target:
|
56
|
+
icon: step-backward-2
|
57
|
+
icon_classes: mdi-rotate-90
|
58
|
+
|
59
|
+
- item: Previous Section
|
60
|
+
enabled: true
|
61
|
+
id: ssm_previous_section
|
62
|
+
event_handler: scroll_previous_section
|
63
|
+
href:
|
64
|
+
target:
|
65
|
+
icon: step-backward
|
66
|
+
icon_classes: mdi-rotate-90
|
67
|
+
|
68
|
+
- item: Next Section
|
69
|
+
enabled: true
|
70
|
+
id: ssm_next_section
|
71
|
+
event_handler: scroll_next_section
|
72
|
+
href:
|
73
|
+
target:
|
74
|
+
icon: step-forward
|
75
|
+
icon_classes: mdi-rotate-90
|
76
|
+
|
77
|
+
- item: To Bottom
|
78
|
+
enabled: true
|
79
|
+
id: ssm_scroll_to_bottom
|
80
|
+
event_handler: scroll_to_bottom
|
81
|
+
href:
|
82
|
+
target:
|
83
|
+
icon: step-forward-2
|
84
|
+
icon_classes: mdi-rotate-90
|
85
|
+
|
86
|
+
- item: Leave a Comment
|
87
|
+
enabled: false
|
88
|
+
id: ssm_scroll_to_comments
|
89
|
+
event_handler: scroll_to_comments
|
90
|
+
href:
|
91
|
+
target:
|
92
|
+
icon: comment
|
93
|
+
icon_classes:
|
94
|
+
|
95
|
+
- item: Tester
|
96
|
+
enabled: false
|
97
|
+
id: ssm_test
|
98
|
+
href:
|
99
|
+
target:
|
100
|
+
event_handler: alert_me
|
101
|
+
icon: alert
|
102
|
+
icon_classes:
|
103
|
+
|
104
|
+
# --------------------------------------------------------------------------
|
105
|
+
# MENU items
|
106
|
+
#
|
107
|
+
- item: Social Share
|
108
|
+
enabled: false
|
109
|
+
icon: menu
|
110
|
+
icon_classes:
|
111
|
+
sublevel:
|
112
|
+
|
113
|
+
- title: Facebook
|
114
|
+
enabled: true
|
115
|
+
id: ssm_facebook
|
116
|
+
href: https://www.facebook.com/sharer/sharer.php?u=http://demo.enigmaweb.com.au/
|
117
|
+
target:
|
118
|
+
event_handler: window.open(this.href, 'facebook', 'left=60,top=40,width=500,height=500,toolbar=1,resizable=0'); return false;
|
119
|
+
icon: facebook
|
120
|
+
icon_classes:
|
121
|
+
|
122
|
+
- title: Twitter
|
123
|
+
enabled: true
|
124
|
+
id: ssm_twitter
|
125
|
+
href: https://twitter.com/home?status=http://demo.enigmaweb.com.au/
|
126
|
+
target:
|
127
|
+
event_handler: window.open(this.href, 'twitter', 'left=60,top=40,width=500,height=500,toolbar=1,resizable=0'); return false;
|
128
|
+
icon: twitter
|
129
|
+
icon_classes:
|
130
|
+
|
131
|
+
|
132
|
+
# ------------------------------------------------------------------------------
|
133
|
+
# END config
|
@@ -351,7 +351,7 @@ resources:
|
|
351
351
|
# 6 n/a moment@2.19.2
|
352
352
|
# 7 log4javascript log4javascript@1.4.15
|
353
353
|
# 8 clipboard clipboard@1.7.1
|
354
|
-
# 9 smoothscroll smoothscroll-for-websites@
|
354
|
+
# 9 smoothscroll smoothscroll-for-websites@4.11.12
|
355
355
|
# 10 bs_material_design bootstrap-material-design@4.0.0-beta.4
|
356
356
|
# 11 j1_template_4 j1_template_4@0.0.1
|
357
357
|
# 12 tocbot tocbot@3.0.2
|
@@ -439,7 +439,7 @@ resources:
|
|
439
439
|
region: head
|
440
440
|
layout: [ all ]
|
441
441
|
required: always
|
442
|
-
script_load: defer
|
442
|
+
script_load: defer # Warum defer???
|
443
443
|
dependencies: [ logger ]
|
444
444
|
pass_init_data: false
|
445
445
|
data:
|
@@ -479,7 +479,7 @@ resources:
|
|
479
479
|
layout: [ page, post, collection, blog_archive ]
|
480
480
|
region: head
|
481
481
|
required: always
|
482
|
-
script_load: defer
|
482
|
+
script_load: defer # Warum defer???
|
483
483
|
dependencies: [ navigator ]
|
484
484
|
pass_init_data: true
|
485
485
|
data:
|
@@ -494,12 +494,12 @@ resources:
|
|
494
494
|
- name: J1 Back2Top
|
495
495
|
resource:
|
496
496
|
id: back2top
|
497
|
-
enabled:
|
497
|
+
enabled: false
|
498
498
|
comment: module back2top
|
499
499
|
region: head
|
500
500
|
layout: [ all ]
|
501
501
|
required: always
|
502
|
-
script_load: defer
|
502
|
+
script_load: defer # Warum defer???
|
503
503
|
dependencies: [ navigator ]
|
504
504
|
pass_init_data: false
|
505
505
|
data:
|
@@ -568,6 +568,27 @@ resources:
|
|
568
568
|
js: []
|
569
569
|
init_function: [ j1.adapter.cookie_consent.init ]
|
570
570
|
|
571
|
+
# ----------------------------------------------------------------------------
|
572
|
+
# Sticky Side Menu
|
573
|
+
#
|
574
|
+
- name: Sticky Side Menu
|
575
|
+
resource:
|
576
|
+
id: ssm
|
577
|
+
enabled: true
|
578
|
+
comment: module ssm
|
579
|
+
region: head
|
580
|
+
layout: [ app, page, post, collection ]
|
581
|
+
required: always
|
582
|
+
script_load: defer
|
583
|
+
dependencies: false
|
584
|
+
pass_init_data: true
|
585
|
+
data:
|
586
|
+
css: []
|
587
|
+
files: [ adapter/js/ssm.js ]
|
588
|
+
js: []
|
589
|
+
init_function: [ j1.adapter.ssm.init ]
|
590
|
+
|
591
|
+
|
571
592
|
# ==============================================================================
|
572
593
|
# J1 Core MODULES initialized 'ondemand' for a layout
|
573
594
|
# ------------------------------------------------------------------------------
|
@@ -712,11 +733,11 @@ resources:
|
|
712
733
|
dependencies: false
|
713
734
|
pass_init_data: false
|
714
735
|
data:
|
715
|
-
css: [
|
736
|
+
css: [
|
716
737
|
extensions/mmenu-light/css/mmenu-light,
|
717
738
|
extensions/mmenu-light/css/themes/uno
|
718
739
|
]
|
719
|
-
files: [ adapter/js/mmenu.js]
|
740
|
+
files: [ adapter/js/mmenu.js ]
|
720
741
|
js: [
|
721
742
|
extensions/mmenu-light/js/mmenu-light,
|
722
743
|
extensions/mmenu-light/js/mmenu-light.polyfills
|
File without changes
|
@@ -290,23 +290,27 @@ j1.adapter['mmenu'] = (function (j1, window) {
|
|
290
290
|
|
291
291
|
// Toggle Bars (Hamburger) for the NavBar to open|close
|
292
292
|
// the mmenu drawer
|
293
|
-
$('{{item.menu.content.
|
293
|
+
$('{{item.menu.content.button}}').each(function(e) {
|
294
294
|
var $this = $(this);
|
295
295
|
|
296
296
|
$this.on('click', function(e){
|
297
|
-
const
|
297
|
+
const button_{{menu_id}} = this;
|
298
298
|
|
299
299
|
// TODO: Animated toggle button
|
300
300
|
//
|
301
|
-
$('{{item.menu.content.toggler}}').toggleClass('fadeIn');
|
302
|
-
$('{{item.menu.content.toggler}}').toggleClass('rotateIn')
|
301
|
+
// $('{{item.menu.content.toggler}}').toggleClass('fadeIn');
|
302
|
+
// $('{{item.menu.content.toggler}}').toggleClass('rotateIn')
|
303
|
+
|
304
|
+
// $('.mdi', this).toggleClass('mdi-menu');
|
305
|
+
// $('.mdi', this).toggleClass('mdi-close');
|
303
306
|
|
304
|
-
$('.mdi', this).toggleClass('mdi-menu');
|
305
|
-
$('.mdi', this).toggleClass('mdi-close');
|
306
307
|
e.preventDefault();
|
307
|
-
|
308
|
-
|
309
|
-
|
308
|
+
|
309
|
+
// (toggler_{{menu_id}}.t = !toggler_{{menu_id}}.t)
|
310
|
+
// ? drawer_{{menu_id}}.open()
|
311
|
+
// : drawer_{{menu_id}}.close();
|
312
|
+
|
313
|
+
drawer_{{menu_id}}.open()
|
310
314
|
});
|
311
315
|
});
|
312
316
|
clearInterval(dependencies_met_{{menu_id}}_loaded);
|
@@ -339,30 +343,33 @@ j1.adapter['mmenu'] = (function (j1, window) {
|
|
339
343
|
position: "{{item.menu.drawer.position}}"
|
340
344
|
});
|
341
345
|
|
342
|
-
//
|
343
|
-
$('{{item.menu.content.
|
346
|
+
// button for the MMenu tocbar to open|close the toc drawer
|
347
|
+
$('{{item.menu.content.button}}').each(function(e) {
|
344
348
|
var $this = $(this);
|
345
349
|
|
346
350
|
$this.on('click', function(e) {
|
347
|
-
var
|
351
|
+
var button_{{menu_id}} = this;
|
348
352
|
var hasClass;
|
349
353
|
|
350
|
-
// check if the
|
354
|
+
// check if the button should be activated
|
351
355
|
// e.g for TOC only if clas js-toc-content is found
|
352
356
|
//
|
353
|
-
if ('{{item.menu.content.
|
354
|
-
hasClass = $('main').hasClass('{{item.menu.content.
|
357
|
+
if ('{{item.menu.content.button_activated}}' != 'always') {
|
358
|
+
hasClass = $('main').hasClass('{{item.menu.content.button_activated}}');
|
355
359
|
} else {
|
356
360
|
hasClass = true;
|
357
361
|
}
|
358
362
|
if (hasClass) {
|
359
363
|
// Toggle button animation
|
360
|
-
|
364
|
+
//$('{{item.menu.content.toggler}}').toggleClass('{{item.menu.content.toggler_animation}}')
|
361
365
|
|
362
366
|
e.preventDefault();
|
363
|
-
|
364
|
-
|
365
|
-
|
367
|
+
|
368
|
+
// (toggler_{{menu_id}}.t = !toggler_{{menu_id}}.t)
|
369
|
+
// ? drawer_{{menu_id}}.open()
|
370
|
+
// : drawer_{{menu_id}}.close();
|
371
|
+
|
372
|
+
drawer_{{menu_id}}.open()
|
366
373
|
} // END if hasclass
|
367
374
|
});
|
368
375
|
});
|
@@ -0,0 +1,432 @@
|
|
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
|
+
|
178
|
+
}, // END init
|
179
|
+
|
180
|
+
// -------------------------------------------------------------------------
|
181
|
+
// MMenu Loader
|
182
|
+
// -------------------------------------------------------------------------
|
183
|
+
mmenuLoader: function (mmOptions) {
|
184
|
+
var menu_id;
|
185
|
+
var xhr_data_path;
|
186
|
+
|
187
|
+
_this.setState('loading');
|
188
|
+
logger.info('status: ' + _this.getState());
|
189
|
+
logger.info('load HTML data for navs and drawers');
|
190
|
+
|
191
|
+
{% assign id_list = "" %}
|
192
|
+
|
193
|
+
// -----------------------------------------------------------------------
|
194
|
+
// Load HTML data (AJAX)
|
195
|
+
// -----------------------------------------------------------------------
|
196
|
+
// jadams, 202-06-24: Promise (chain) if $.when seems NOT to work correctly.
|
197
|
+
// It semms a chain using .then will be a better solution to make it sure
|
198
|
+
// that the last Deferred set the state to 'data_loaded'.
|
199
|
+
// Found the final state randomly set to 'null' what prevent the module
|
200
|
+
// to run mmenuInitializer.
|
201
|
+
// Workaround: Set 'data_loaded' to be returned by all Deferred in
|
202
|
+
// the chain.
|
203
|
+
// See: https://stackoverflow.com/questions/5436327/jquery-deferreds-and-promises-then-vs-done
|
204
|
+
//
|
205
|
+
{% comment %} Modify chain
|
206
|
+
--------------------------------------------------------------------------
|
207
|
+
{% if forloop.last %}'data_loaded'{% else %}'null'{% endif %}){% if forloop.last %}{% else %},{% endif %}
|
208
|
+
to
|
209
|
+
{% if forloop.last %}'data_loaded'{% else %}'data_loaded'{% endif %}){% if forloop.last %}{% else %},{% endif %}
|
210
|
+
-------------------------------------------------------------------------- {% endcomment %}
|
211
|
+
$.when (
|
212
|
+
{% for item in nav_mmenu_options.menus %} {% if item.menu.enabled %}
|
213
|
+
{% assign menu_id = item.menu.xhr_container_id %}
|
214
|
+
{% assign xhr_data_path = item.menu.xhr_data_path %}
|
215
|
+
|
216
|
+
j1.xhrData (
|
217
|
+
'j1.adapter.mmenu', {
|
218
|
+
xhr_container_id: "{{menu_id}}",
|
219
|
+
xhr_data_path: "{{xhr_data_path}}" },
|
220
|
+
{% if forloop.last %}'data_loaded'{% else %}'data_loaded'{% endif %}){% if forloop.last %}{% else %},{% endif %}
|
221
|
+
|
222
|
+
{% endif %}
|
223
|
+
{% capture id_list %}{{id_list}}{{menu_id}}{% if forloop.last %}{% else %},{% endif %} {% endcapture %}
|
224
|
+
{% endfor %} // ENDFOR menus
|
225
|
+
).done (function ({{id_list}}) {
|
226
|
+
// ---------------------------------------------------------------------
|
227
|
+
// Initialize MMenu Navs and Drawers
|
228
|
+
// ---------------------------------------------------------------------
|
229
|
+
var dependencies_met_mmenu_initialized = setInterval (function () {
|
230
|
+
if (_this.getState() === 'data_loaded') {
|
231
|
+
logger.info('load HTML data (AJAX): finished');
|
232
|
+
_this.setState('processing');
|
233
|
+
logger.info('status: ' + _this.getState());
|
234
|
+
logger.info('initialize navs and drawers');
|
235
|
+
j1.adapter.mmenu.mmenuInitializer(mmOptions);
|
236
|
+
clearInterval(dependencies_met_mmenu_initialized);
|
237
|
+
}
|
238
|
+
}); // END dependencies_met_mmenu_loaded
|
239
|
+
}); // END done
|
240
|
+
}, // END dataLoader
|
241
|
+
|
242
|
+
// -------------------------------------------------------------------------
|
243
|
+
// MMenu Initializer
|
244
|
+
// -------------------------------------------------------------------------
|
245
|
+
mmenuInitializer: function (mmOptions) {
|
246
|
+
var menu_id;
|
247
|
+
var xhr_data_path;
|
248
|
+
|
249
|
+
{% for item in nav_mmenu_options.menus %} {% if item.menu.enabled %}
|
250
|
+
|
251
|
+
{% assign menu_id = item.menu.xhr_container_id %}
|
252
|
+
menu_id = "{{menu_id}}";
|
253
|
+
xhr_data_path = "{{item.menu.xhr_data_path}}";
|
254
|
+
|
255
|
+
// Create an mmenu instance if id exists: {{menu_id}}
|
256
|
+
if ($('#{{menu_id}}').length) {
|
257
|
+
|
258
|
+
logger.info('mmenu is being initialized on id: {{menu_id}}');
|
259
|
+
|
260
|
+
{% if item.menu.content.type == "navigation" %}
|
261
|
+
// Create an mmenu instance of type NAVIGATION
|
262
|
+
logger.info('found content type: NAVIGATION');
|
263
|
+
// ---------------------------------------------------------------------
|
264
|
+
// menu initializer (NAVIGATION)
|
265
|
+
// ---------------------------------------------------------------------
|
266
|
+
logger.info('initialize mmenu on id: #{{menu_id}}');
|
267
|
+
var dependencies_met_{{menu_id}}_loaded = setInterval (function () {
|
268
|
+
if ({{menu_id}}) {
|
269
|
+
const menu_selector = document.querySelector('#{{menu_id}}');
|
270
|
+
const mmenu_{{menu_id}} = new MmenuLight (
|
271
|
+
menu_selector,
|
272
|
+
'(max-width: ' + mmOptions.mmenu_plugin.max_width +'px)', {
|
273
|
+
// plugin options
|
274
|
+
node: mmOptions.mmenu_plugin.node,
|
275
|
+
mediaQuery: mmOptions.mmenu_plugin.mediaQuery
|
276
|
+
});
|
277
|
+
|
278
|
+
const drawer_{{menu_id}} = mmenu_{{menu_id}}.offcanvas ({
|
279
|
+
// drawer options
|
280
|
+
position: mmOptions.mmenu_drawer.position
|
281
|
+
});
|
282
|
+
|
283
|
+
const navigator_{{menu_id}} = mmenu_{{menu_id}}.navigation ({
|
284
|
+
// navigator options
|
285
|
+
selected: mmOptions.mmenu_navigator.selected,
|
286
|
+
slidingSubmenus: mmOptions.mmenu_navigator.slidingSubmenus,
|
287
|
+
title: mmOptions.mmenu_navigator.title,
|
288
|
+
theme: mmOptions.mmenu_navigator.theme
|
289
|
+
});
|
290
|
+
|
291
|
+
// Button|Toggler for the NavBar to open|close
|
292
|
+
// the mmenu drawer
|
293
|
+
$('{{item.menu.content.button_selector}}').each(function(e) {
|
294
|
+
var $this = $(this);
|
295
|
+
|
296
|
+
$this.on('click', function(e){
|
297
|
+
const toggler_{{menu_id}} = this;
|
298
|
+
|
299
|
+
// TODO: Animated toggle button
|
300
|
+
//
|
301
|
+
$('{{item.menu.content.button_selector}}').toggleClass('fadeIn');
|
302
|
+
$('{{item.menu.content.button_selector}}').toggleClass('rotateIn')
|
303
|
+
|
304
|
+
$('.mdi', this).toggleClass('mdi-menu');
|
305
|
+
$('.mdi', this).toggleClass('mdi-close');
|
306
|
+
e.preventDefault();
|
307
|
+
(toggler_{{menu_id}}.t = !toggler_{{menu_id}}.t)
|
308
|
+
? drawer_{{menu_id}}.open()
|
309
|
+
: drawer_{{menu_id}}.close();
|
310
|
+
});
|
311
|
+
});
|
312
|
+
clearInterval(dependencies_met_{{menu_id}}_loaded);
|
313
|
+
logger.info('initializing mmenu finished on id: #{{menu_id}}');
|
314
|
+
}; // END mmenu_loaded
|
315
|
+
}); // END dependencies_met_mmenu_loaded
|
316
|
+
{% endif %} // ENDIF content_type: NAVIGATION
|
317
|
+
|
318
|
+
{% if item.menu.content.type == "drawer" %}
|
319
|
+
// Create an mmenu instance of type HTML
|
320
|
+
logger.info('found content type: DRAWER');
|
321
|
+
// -------------------------------------------------------------------
|
322
|
+
// menu initializer (DRAWER)
|
323
|
+
// -------------------------------------------------------------------
|
324
|
+
logger.info('initialize mmenu on id: #{{menu_id}}');
|
325
|
+
var dependencies_met_{{menu_id}}_loaded = setInterval (function () {
|
326
|
+
if ({{menu_id}}) {
|
327
|
+
const menu_selector = document.querySelector('#{{menu_id}}');
|
328
|
+
|
329
|
+
const mmenu_{{menu_id}} = new MmenuLight (
|
330
|
+
menu_selector,
|
331
|
+
'(max-width: ' + mmOptions.mmenu_plugin.max_width +'px)', {
|
332
|
+
// plugin options
|
333
|
+
node: mmOptions.mmenu_plugin.node,
|
334
|
+
mediaQuery: mmOptions.mmenu_plugin.mediaQuery
|
335
|
+
});
|
336
|
+
|
337
|
+
const drawer_{{menu_id}} = mmenu_{{menu_id}}.offcanvas ({
|
338
|
+
// drawer options
|
339
|
+
position: "{{item.menu.drawer.position}}"
|
340
|
+
});
|
341
|
+
|
342
|
+
// Button|Toggler for the MMenu tocbar to open|close the toc drawer
|
343
|
+
$('{{item.menu.content.button_selector}}').each(function(e) {
|
344
|
+
var $this = $(this);
|
345
|
+
|
346
|
+
$this.on('click', function(e) {
|
347
|
+
var toggler_{{menu_id}} = this;
|
348
|
+
var hasClass;
|
349
|
+
|
350
|
+
// check if the toggler should be activated
|
351
|
+
// e.g for TOC only if clas js-toc-content is found
|
352
|
+
//
|
353
|
+
if ('{{item.menu.content.toggler_activated}}' != 'always') {
|
354
|
+
hasClass = $('main').hasClass('{{item.menu.content.toggler_activated}}');
|
355
|
+
} else {
|
356
|
+
hasClass = true;
|
357
|
+
}
|
358
|
+
if (hasClass) {
|
359
|
+
// Toggle button animation
|
360
|
+
$('{{item.menu.content.button_selector}}').toggleClass('{{item.menu.content.toggler_animation}}')
|
361
|
+
|
362
|
+
e.preventDefault();
|
363
|
+
(toggler_{{menu_id}}.t = !toggler_{{menu_id}}.t)
|
364
|
+
? drawer_{{menu_id}}.open()
|
365
|
+
: drawer_{{menu_id}}.close();
|
366
|
+
} // END if hasclass
|
367
|
+
});
|
368
|
+
});
|
369
|
+
clearInterval(dependencies_met_{{menu_id}}_loaded);
|
370
|
+
}; // END if menu_loaded
|
371
|
+
}); // END dependencies_met_mmenu_loaded
|
372
|
+
logger.info('initializing mmenu finished on id: #{{menu_id}}');
|
373
|
+
{% endif %} // ENDIF content_type: DRAWER
|
374
|
+
} // END menus|drawers
|
375
|
+
|
376
|
+
{% endif %} // ENDIF menu enabled
|
377
|
+
{% endfor %} // ENDFOR menus
|
378
|
+
}, // END mmenuInitializer
|
379
|
+
|
380
|
+
// -------------------------------------------------------------------------
|
381
|
+
// messageHandler
|
382
|
+
// Manage messages (paylods) send from other J1 modules
|
383
|
+
// -------------------------------------------------------------------------
|
384
|
+
messageHandler: function (sender, message) {
|
385
|
+
// var json_message = JSON.stringify(message, undefined, 2); // multiline
|
386
|
+
var json_message = JSON.stringify(message);
|
387
|
+
|
388
|
+
logText = 'received message from ' + sender + ': ' + json_message;
|
389
|
+
logger.debug(logText);
|
390
|
+
|
391
|
+
// -----------------------------------------------------------------------
|
392
|
+
// Process commands|actions
|
393
|
+
// -----------------------------------------------------------------------
|
394
|
+
if (message.type === 'command' && message.action === 'module_initialized') {
|
395
|
+
//
|
396
|
+
// Place handling of command|action here
|
397
|
+
//
|
398
|
+
logger.info(message.text);
|
399
|
+
}
|
400
|
+
if (message.type === 'command' && message.action === 'status') {
|
401
|
+
logger.info('messageHandler: received - ' + message.action);
|
402
|
+
}
|
403
|
+
|
404
|
+
//
|
405
|
+
// Place handling of other command|action here
|
406
|
+
//
|
407
|
+
|
408
|
+
return true;
|
409
|
+
}, // END messageHandler
|
410
|
+
|
411
|
+
// -------------------------------------------------------------------------
|
412
|
+
// setState
|
413
|
+
// Set the current (processing) state of the module
|
414
|
+
// -------------------------------------------------------------------------
|
415
|
+
setState: function (stat) {
|
416
|
+
j1.adapter.mmenu.state = stat;
|
417
|
+
}, // END setState
|
418
|
+
|
419
|
+
// -------------------------------------------------------------------------
|
420
|
+
// getState
|
421
|
+
// Returns the current (processing) state of the module
|
422
|
+
// -------------------------------------------------------------------------
|
423
|
+
getState: function () {
|
424
|
+
return j1.adapter.mmenu.state;
|
425
|
+
} // END state
|
426
|
+
|
427
|
+
}; // END return
|
428
|
+
})(j1, window);
|
429
|
+
|
430
|
+
{% endcapture %}
|
431
|
+
{{ cache | strip_empty_lines }}
|
432
|
+
{% assign cache = nil %}
|