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,498 @@
|
|
1
|
+
---
|
2
|
+
regenerate: true
|
3
|
+
---
|
4
|
+
|
5
|
+
{% capture cache %}
|
6
|
+
|
7
|
+
{% comment %}
|
8
|
+
# -----------------------------------------------------------------------------
|
9
|
+
# ~/assets/themes/j1/adapter/js/ssm.js
|
10
|
+
# Liquid template to adapt SSM 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
|
+
{% endcomment %}
|
24
|
+
|
25
|
+
{% comment %} Liquid var initialization
|
26
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
27
|
+
|
28
|
+
{% comment %} Set config files
|
29
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
30
|
+
{% assign site_config = site %}
|
31
|
+
{% assign template_config = site.data.template_settings %}
|
32
|
+
{% assign modules = site.data.modules %}
|
33
|
+
|
34
|
+
{% comment %} Set config data
|
35
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
36
|
+
{% assign ssm_settings = modules.ssm.settings %}
|
37
|
+
{% assign ssm_defaults = modules.defaults.ssm.defaults %}
|
38
|
+
|
39
|
+
{% comment %} Set config options
|
40
|
+
-------------------------------------------------------------------------------- {% endcomment %}
|
41
|
+
{% assign ssm_options = ssm_defaults | merge: ssm_settings %}
|
42
|
+
|
43
|
+
/*
|
44
|
+
# -----------------------------------------------------------------------------
|
45
|
+
# ~/assets/themes/j1/adapter/js/ssm.js
|
46
|
+
# JS Adapter for J1 SSM (Sticky Side Menu)
|
47
|
+
#
|
48
|
+
# Product/Info:
|
49
|
+
# {{site.data.template_settings.theme_author_url}}
|
50
|
+
#
|
51
|
+
# Copyright (C) 2020 Juergen Adams
|
52
|
+
#
|
53
|
+
# J1 Template is licensed under the MIT License.
|
54
|
+
# For details, see {{site.data.template_settings.theme_author_url}}
|
55
|
+
# -----------------------------------------------------------------------------
|
56
|
+
# Adapter generated: {{site.time}}
|
57
|
+
# -----------------------------------------------------------------------------
|
58
|
+
*/
|
59
|
+
'use strict';
|
60
|
+
|
61
|
+
j1.adapter['ssm'] = (function (j1, window) {
|
62
|
+
|
63
|
+
// ---------------------------------------------------------------------------
|
64
|
+
// globals
|
65
|
+
// ---------------------------------------------------------------------------
|
66
|
+
var environment = '{{environment}}';
|
67
|
+
var dclFinished = false;
|
68
|
+
var moduleOptions = {};
|
69
|
+
var cookie_names = j1.getCookieNames();
|
70
|
+
var user_state;
|
71
|
+
var user_session;
|
72
|
+
var user_data;
|
73
|
+
var sect1Nodes;
|
74
|
+
var sect12Nodes;
|
75
|
+
var _this;
|
76
|
+
var logger;
|
77
|
+
var logText;
|
78
|
+
|
79
|
+
// ---------------------------------------------------------------------------
|
80
|
+
// helper functions
|
81
|
+
// ---------------------------------------------------------------------------
|
82
|
+
|
83
|
+
|
84
|
+
// ---------------------------------------------------------------------------
|
85
|
+
// main object
|
86
|
+
// ---------------------------------------------------------------------------
|
87
|
+
return {
|
88
|
+
|
89
|
+
// -------------------------------------------------------------------------
|
90
|
+
// module initializer
|
91
|
+
// -------------------------------------------------------------------------
|
92
|
+
init: function (options) {
|
93
|
+
|
94
|
+
// create seetings object from frontmatterOptions
|
95
|
+
var frontmatterOptions = options != null ? $.extend({}, options) : {};
|
96
|
+
|
97
|
+
// initialize state flag
|
98
|
+
j1.adapter.ssm.state = 'pending';
|
99
|
+
|
100
|
+
// -----------------------------------------------------------------------
|
101
|
+
// defaults
|
102
|
+
// -----------------------------------------------------------------------
|
103
|
+
var settings = $.extend({
|
104
|
+
module_name: 'j1.adapter.ssm',
|
105
|
+
generated: '{{site.time}}'
|
106
|
+
}, options);
|
107
|
+
|
108
|
+
// -----------------------------------------------------------------------
|
109
|
+
// globals
|
110
|
+
// -----------------------------------------------------------------------
|
111
|
+
_this = j1.adapter.ssm;
|
112
|
+
logger = log4javascript.getLogger('j1.adapter.ssm');
|
113
|
+
sect12Nodes = $("[class$='sect1'],[class$='sect2'");
|
114
|
+
sect1Nodes = $("[class$='sect1']");
|
115
|
+
|
116
|
+
// -----------------------------------------------------------------------
|
117
|
+
// options loader
|
118
|
+
// -----------------------------------------------------------------------
|
119
|
+
var ssmMenuOptions = $.extend({}, {{nav_ssm_options | replace: '=>', ':' }});
|
120
|
+
var ssmOptions = $.extend({}, {{ssm_options | replace: 'nil', 'null' | replace: '=>', ':' }});
|
121
|
+
var xhr_data_path;
|
122
|
+
var menu_id;
|
123
|
+
|
124
|
+
// Load (individual) frontmatter options (currently NOT used)
|
125
|
+
//
|
126
|
+
if (options != null) { var frontmatterOptions = $.extend({}, options) }
|
127
|
+
|
128
|
+
if (typeof frontmatterOptions !== 'undefined') {
|
129
|
+
moduleOptions = j1.mergeData(ssmOptions, frontmatterOptions);
|
130
|
+
}
|
131
|
+
|
132
|
+
// save config settings into the mmenu object for global access
|
133
|
+
//
|
134
|
+
j1.adapter.ssm['moduleOptions'] = moduleOptions;
|
135
|
+
|
136
|
+
_this.setState('started');
|
137
|
+
logger.info('state: ' + _this.getState());
|
138
|
+
logger.info('module is being initialized');
|
139
|
+
|
140
|
+
// jadams, 2020-06-24: Set max_count to 100 what cause to wait 2.5s
|
141
|
+
// for J1 Navigator to finish (init)
|
142
|
+
//
|
143
|
+
var interval_count = 0;
|
144
|
+
var max_count = 100;
|
145
|
+
|
146
|
+
var dependencies_met_navigator = setInterval(function() {
|
147
|
+
interval_count += 1;
|
148
|
+
if ( j1.adapter.navigator.getState() == 'finished' ) {
|
149
|
+
logger.info('dependencies of module navigator met for: mmenu');
|
150
|
+
logger.info('dependencies of module navigator met after: ' + interval_count * 25 + ' ms');
|
151
|
+
j1.core.ssm.init (moduleOptions);
|
152
|
+
_this.ssmLoader(moduleOptions);
|
153
|
+
clearInterval(dependencies_met_navigator);
|
154
|
+
}
|
155
|
+
if (interval_count > max_count) {
|
156
|
+
logger.warn('dependency check failed for module: navigator');
|
157
|
+
logger.warn('dependencies of module navigator met after: ' + interval_count * 25 + ' ms');
|
158
|
+
j1.core.ssm.init (moduleOptions);
|
159
|
+
_this.ssmLoader(moduleOptions);
|
160
|
+
clearInterval(dependencies_met_navigator);
|
161
|
+
}
|
162
|
+
}, 25);
|
163
|
+
|
164
|
+
}, // END init
|
165
|
+
|
166
|
+
// -------------------------------------------------------------------------
|
167
|
+
// SSM Loader
|
168
|
+
// -------------------------------------------------------------------------
|
169
|
+
ssmLoader: function (ssmOptions) {
|
170
|
+
var menu_id;
|
171
|
+
var xhr_data_path;
|
172
|
+
|
173
|
+
_this.setState('loading');
|
174
|
+
logger.info('status: ' + _this.getState());
|
175
|
+
logger.info('load HTML data for ssm');
|
176
|
+
|
177
|
+
{% assign id_list = "" %}
|
178
|
+
|
179
|
+
$.when (
|
180
|
+
{% assign menu_id = ssm_options.xhr_container_id %}
|
181
|
+
{% assign xhr_data_path = ssm_options.xhr_data_path %}
|
182
|
+
j1.xhrData (
|
183
|
+
'j1.adapter.ssm', {
|
184
|
+
xhr_container_id: "{{menu_id}}",
|
185
|
+
xhr_data_path: "{{xhr_data_path}}" },
|
186
|
+
'data_loaded')
|
187
|
+
).done (function (ssm) {
|
188
|
+
// ---------------------------------------------------------------------
|
189
|
+
// Initialize MMenu Navs and Drawers
|
190
|
+
// ---------------------------------------------------------------------
|
191
|
+
var dependencies_met_mmenu_initialized = setInterval (function () {
|
192
|
+
if (ssm) {
|
193
|
+
if (j1.getState() === 'finished') {
|
194
|
+
// if ( j1.adapter.navigator.getState() == 'finished' ) {
|
195
|
+
logger.info('load HTML data (AJAX): finished');
|
196
|
+
_this.setState('processing');
|
197
|
+
logger.info('status: ' + _this.getState());
|
198
|
+
logger.info('initialize ssm menu');
|
199
|
+
if ( ssmOptions.mode === 'icon') {
|
200
|
+
logger.info('icon mode detected');
|
201
|
+
}
|
202
|
+
_this.scrollSpy(ssmOptions);
|
203
|
+
_this.buttonInitializer(ssmOptions);
|
204
|
+
clearInterval(dependencies_met_mmenu_initialized);
|
205
|
+
}
|
206
|
+
} else {
|
207
|
+
logger.error('initialize ssm failed, HTML data NOT loaded');
|
208
|
+
}
|
209
|
+
}, 25); // END dependencies_met_mmenu_loaded
|
210
|
+
}); // END done
|
211
|
+
}, // END dataLoader
|
212
|
+
|
213
|
+
// -------------------------------------------------------------------------
|
214
|
+
// Button Initializer
|
215
|
+
// -------------------------------------------------------------------------
|
216
|
+
buttonInitializer: function (ssmOptions) {
|
217
|
+
var eventHandler;
|
218
|
+
|
219
|
+
{% for item in ssm_options.items %} {% if item.enabled %}
|
220
|
+
|
221
|
+
{% comment %} Identify the menu (item) type
|
222
|
+
-------------------------------------------------------------------------- {% endcomment %}
|
223
|
+
{% if item.sublevel %}
|
224
|
+
{% assign menu_type = 'sublevel_menu' %}
|
225
|
+
{% else %}
|
226
|
+
{% assign menu_type = 'top_level_item' %}
|
227
|
+
{% endif %}
|
228
|
+
|
229
|
+
{% if menu_type == 'top_level_item' %}
|
230
|
+
{% assign button_id = item.id %}
|
231
|
+
|
232
|
+
// Create an eventhandler instance if id exists: {{button_id}}
|
233
|
+
if ($('#{{button_id}}').length) {
|
234
|
+
eventHandler = "{{item.event_handler}}"
|
235
|
+
|
236
|
+
// check if eventhandler configured is a SINGLE word
|
237
|
+
if (eventHandler.split(" ").length == 1) {
|
238
|
+
logger.info('register pre-configured eventhandler {{item.event_handler}} on id: {{button_id}}');
|
239
|
+
$('#{{button_id}}').each(function(e) {
|
240
|
+
var $this = $(this);
|
241
|
+
$this.on('click', function(e) {
|
242
|
+
j1.adapter.ssm.{{item.event_handler}}(sect1Nodes);
|
243
|
+
});
|
244
|
+
});
|
245
|
+
} else {
|
246
|
+
logger.info('register custom eventhandler on id: {{button_id}}');
|
247
|
+
}
|
248
|
+
|
249
|
+
} // END items (buttons)
|
250
|
+
{% endif %} // menu_type 'top_level_item'
|
251
|
+
{% endif %} // ENDIF button_id enabled
|
252
|
+
{% endfor %} // ENDFOR items
|
253
|
+
}, // END buttonInitializer
|
254
|
+
|
255
|
+
// -------------------------------------------------------------------------
|
256
|
+
// Eventhandler
|
257
|
+
|
258
|
+
// -------------------------------------------------------------------------
|
259
|
+
// open mobile menu
|
260
|
+
// -------------------------------------------------------------------------
|
261
|
+
open_mmenu: function (id) {
|
262
|
+
logger.info('eventhandler fired on id: ' + id );
|
263
|
+
}, // END open_mmenu
|
264
|
+
|
265
|
+
// -------------------------------------------------------------------------
|
266
|
+
// scroll to previous section
|
267
|
+
// -------------------------------------------------------------------------
|
268
|
+
scroll_previous_section: function (nodes) {
|
269
|
+
var previous_header_id;
|
270
|
+
var currentNode;
|
271
|
+
var prev_node;
|
272
|
+
|
273
|
+
var index = 0;
|
274
|
+
var maxNode = $(nodes).length - 1;
|
275
|
+
var $toc = $("#sidebar");
|
276
|
+
var current_header_id = $toc.find(".is-active-link").attr('href');
|
277
|
+
|
278
|
+
// logger.info('eventhandler fired on id: ' + id );
|
279
|
+
|
280
|
+
nodes.each(function() {
|
281
|
+
currentNode = $(this).find(current_header_id);
|
282
|
+
if (currentNode.length) {
|
283
|
+
if (index > maxNode) {
|
284
|
+
return false
|
285
|
+
} else {
|
286
|
+
prev_node = (index > 0) ? nodes[index-1] : nodes[index];
|
287
|
+
previous_header_id = $(prev_node).find(":header").first()[0].id;
|
288
|
+
$('a[href*="' + current_header_id + '"]').removeClass('is-active-link');
|
289
|
+
$('a[href*="' + previous_header_id + '"]').addClass('is-active-link');
|
290
|
+
var dest = $('body').scrollTop() + $('#' + previous_header_id).offset().top - 100;
|
291
|
+
$('html, body').animate({
|
292
|
+
scrollTop: dest
|
293
|
+
}, 500);
|
294
|
+
return false;
|
295
|
+
}
|
296
|
+
}
|
297
|
+
(index < maxNode) ? index++ : index;
|
298
|
+
// (index = 0) ? index : index++;
|
299
|
+
});
|
300
|
+
}, // END scroll_previous_section
|
301
|
+
|
302
|
+
// -------------------------------------------------------------------------
|
303
|
+
// scroll to next section
|
304
|
+
// -------------------------------------------------------------------------
|
305
|
+
scroll_next_section: function (nodes) {
|
306
|
+
var next_header_id;
|
307
|
+
var currentNode;
|
308
|
+
var nextNode;
|
309
|
+
|
310
|
+
var index = 0;
|
311
|
+
var maxNode = $(nodes).length -1;
|
312
|
+
var $toc = $("#sidebar");
|
313
|
+
var current_header_id = $toc.find(".is-active-link").attr('href');
|
314
|
+
|
315
|
+
// logger.info('eventhandler fired on id: ' + id );
|
316
|
+
|
317
|
+
nodes.each(function() {
|
318
|
+
// currentNode = $(this).find(current_header_id);
|
319
|
+
currentNode = $(this).find(current_header_id);
|
320
|
+
if (currentNode.length) {
|
321
|
+
if (index == maxNode) {
|
322
|
+
return false
|
323
|
+
} else {
|
324
|
+
nextNode = nodes[index+1];
|
325
|
+
next_header_id = $(nextNode).closest().find(":header").first();
|
326
|
+
next_header_id = $(nextNode).find(":header").first()[0].id;
|
327
|
+
|
328
|
+
$('a[href*="' + current_header_id + '"]').removeClass('is-active-link');
|
329
|
+
$('a[href*="' + next_header_id + '"]').addClass('is-active-link');
|
330
|
+
|
331
|
+
var dest = $('body').scrollTop() + $('#' + next_header_id).offset().top - 100;
|
332
|
+
$('html, body').animate({
|
333
|
+
scrollTop: dest
|
334
|
+
}, 500);
|
335
|
+
return false;
|
336
|
+
}
|
337
|
+
}
|
338
|
+
(index < maxNode) ? index++ : index;
|
339
|
+
});
|
340
|
+
}, // END scroll_next_section
|
341
|
+
|
342
|
+
// -------------------------------------------------------------------------
|
343
|
+
// scroll to top
|
344
|
+
// -------------------------------------------------------------------------
|
345
|
+
scroll_to_top: function () {
|
346
|
+
var dest = 0;
|
347
|
+
|
348
|
+
// logger.info('eventhandler fired on id: ' + id );
|
349
|
+
|
350
|
+
$('html, body').animate({
|
351
|
+
scrollTop: dest
|
352
|
+
}, 500);
|
353
|
+
}, // END scroll_top
|
354
|
+
|
355
|
+
// -------------------------------------------------------------------------
|
356
|
+
// scroll to bottom
|
357
|
+
// -------------------------------------------------------------------------
|
358
|
+
scroll_to_bottom: function () {
|
359
|
+
var $page = $(document);
|
360
|
+
var $footer = $('#j1_footer');
|
361
|
+
var f = $footer.length ? $footer.outerHeight() : 0;
|
362
|
+
var pageHeight = $page.height() - f - 400;
|
363
|
+
var pageHeightOuter = $page.outerHeight()
|
364
|
+
|
365
|
+
// logger.info('eventhandler fired on id: ' + id );
|
366
|
+
|
367
|
+
$('html, body').animate({
|
368
|
+
scrollTop: pageHeight
|
369
|
+
}, 500);
|
370
|
+
}, // END scroll_bottom
|
371
|
+
|
372
|
+
// -------------------------------------------------------------------------
|
373
|
+
// scroll to comments (Disqus)
|
374
|
+
// -------------------------------------------------------------------------
|
375
|
+
scroll_to_comments: function () {
|
376
|
+
// logger.info('eventhandler fired on id: ' + id );
|
377
|
+
}, // END scroll_comments
|
378
|
+
|
379
|
+
// -------------------------------------------------------------------------
|
380
|
+
// create generic alert
|
381
|
+
// -------------------------------------------------------------------------
|
382
|
+
alert_me: function (id) {
|
383
|
+
// logger.info('eventhandler fired on id: ' + id );
|
384
|
+
alert ("Hello world!");
|
385
|
+
}, // END alert_me
|
386
|
+
// -------------------------------------------------------------------------
|
387
|
+
// messageHandler
|
388
|
+
// Manage messages (paylods) send from other J1 modules
|
389
|
+
// -------------------------------------------------------------------------
|
390
|
+
messageHandler: function (sender, message) {
|
391
|
+
// var json_message = JSON.stringify(message, undefined, 2); // multiline
|
392
|
+
var json_message = JSON.stringify(message);
|
393
|
+
|
394
|
+
logText = 'received message from ' + sender + ': ' + json_message;
|
395
|
+
logger.debug(logText);
|
396
|
+
|
397
|
+
// -----------------------------------------------------------------------
|
398
|
+
// Process commands|actions
|
399
|
+
// -----------------------------------------------------------------------
|
400
|
+
if (message.type === 'command' && message.action === 'module_initialized') {
|
401
|
+
//
|
402
|
+
// Place handling of command|action here
|
403
|
+
//
|
404
|
+
logger.info(message.text);
|
405
|
+
}
|
406
|
+
if (message.type === 'command' && message.action === 'status') {
|
407
|
+
logger.info('messageHandler: received - ' + message.action);
|
408
|
+
}
|
409
|
+
|
410
|
+
//
|
411
|
+
// Place handling of other command|action here
|
412
|
+
//
|
413
|
+
|
414
|
+
return true;
|
415
|
+
}, // END messageHandler
|
416
|
+
|
417
|
+
// -------------------------------------------------------------------------
|
418
|
+
// setState
|
419
|
+
// Set the current (processing) state of the module
|
420
|
+
// -------------------------------------------------------------------------
|
421
|
+
setState: function (stat) {
|
422
|
+
j1.adapter.ssm.state = stat;
|
423
|
+
}, // END setState
|
424
|
+
|
425
|
+
// -------------------------------------------------------------------------
|
426
|
+
// getState
|
427
|
+
// Returns the current (processing) state of the module
|
428
|
+
// -------------------------------------------------------------------------
|
429
|
+
getState: function () {
|
430
|
+
return j1.adapter.ssm.state;
|
431
|
+
}, // END state
|
432
|
+
|
433
|
+
// -------------------------------------------------------------------------
|
434
|
+
// Manage (top) position and sizes (@media breakpoints) of the
|
435
|
+
// SSM container depending on the size of the page header (attic)
|
436
|
+
// -------------------------------------------------------------------------
|
437
|
+
scrollSpy: function (options) {
|
438
|
+
logger = log4javascript.getLogger('j1.adapter.ssm.scrollSpy');
|
439
|
+
|
440
|
+
$(window).scroll(function(event){
|
441
|
+
var $navbar = $('nav.navbar');
|
442
|
+
var $pagehead = $('.attic');
|
443
|
+
var $main_content = $('.js-toc-content');
|
444
|
+
var $adblock = $('#adblock');
|
445
|
+
var $footer = $('#j1_footer');
|
446
|
+
var $ssmContainer = $('#ssm-container');
|
447
|
+
var $page = $(document);
|
448
|
+
|
449
|
+
var offset = 0;
|
450
|
+
var pageOffset = -120;
|
451
|
+
var scrollPos = $(document).scrollTop();
|
452
|
+
var pageHeight = $page.height()
|
453
|
+
var pageHeightOuter = $page.outerHeight()
|
454
|
+
|
455
|
+
// var m = parseInt(pagehead.css('margin-bottom'), 10);
|
456
|
+
var m = $main_content.offset().top;
|
457
|
+
var s = $ssmContainer.length ? $ssmContainer.height() : 0;
|
458
|
+
var f = $footer.length ? $footer.outerHeight() : 0;
|
459
|
+
var n = $navbar.length ? $navbar.height() : 0;
|
460
|
+
// var h = $pagehead.length ? $pagehead.outerHeight() : 0;
|
461
|
+
var a = $adblock.length ? $adblock.outerHeight() : 0;
|
462
|
+
|
463
|
+
// var o = n + h + a + offset;
|
464
|
+
// var o = n + m + offset;
|
465
|
+
var o = n + offset;
|
466
|
+
|
467
|
+
// space above the (fixed) ssm container
|
468
|
+
var showSsmPos = m + pageOffset;
|
469
|
+
|
470
|
+
// space below the (fixed) ssm container
|
471
|
+
var hideSsmPos = pageHeight - s - f + pageOffset;
|
472
|
+
|
473
|
+
// set the top position of ssm container for navbar modes
|
474
|
+
// e.g. "sticky" (navbar-fixed)
|
475
|
+
if($navbar.hasClass('navbar-fixed')){
|
476
|
+
$('#ssm-container').css('top', o);
|
477
|
+
} else {
|
478
|
+
$('#ssm-container').css('top', m);
|
479
|
+
}
|
480
|
+
|
481
|
+
// show|hide ssm container on scroll position in page
|
482
|
+
//
|
483
|
+
( scrollPos >= showSsmPos ) && ( scrollPos <= hideSsmPos )
|
484
|
+
? $ssmContainer.css('display','block')
|
485
|
+
: $ssmContainer.css('display','none');
|
486
|
+
|
487
|
+
logger.debug('content pos detected as: ' + m + 'px');
|
488
|
+
logger.debug('scroll pos detected as: ' + scrollPos + 'px');
|
489
|
+
}); // END setTop on scroll
|
490
|
+
|
491
|
+
} // END scrollSpy
|
492
|
+
|
493
|
+
}; // END return
|
494
|
+
})(j1, window);
|
495
|
+
|
496
|
+
{% endcapture %}
|
497
|
+
{{ cache | strip_empty_lines }}
|
498
|
+
{% assign cache = nil %}
|