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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/content_generator_blog_archive.html +22 -18
  3. data/_includes/themes/j1/layouts/content_generator_collection.html +15 -12
  4. data/_includes/themes/j1/layouts/content_generator_page.html +16 -17
  5. data/_includes/themes/j1/layouts/content_generator_post.html +19 -24
  6. data/_includes/themes/j1/modules/navigator/generator.html +62 -40
  7. data/assets/data/menu.html +6 -5
  8. data/assets/data/mmenu.html +455 -0
  9. data/assets/data/{sidebar.html → mmenu_sidebar.html} +24 -18
  10. data/assets/data/mmenu_toc.html +45 -0
  11. data/assets/data/quicklinks.html +9 -4
  12. data/assets/data/ssm.html +227 -0
  13. data/assets/error_pages/HTTP204.html +3 -3
  14. data/assets/themes/j1/core/css/bootstrap.css +116 -93
  15. data/assets/themes/j1/core/css/bootstrap.min.css +4 -4
  16. data/assets/themes/j1/core/css/globals.css +1 -1
  17. data/assets/themes/j1/core/css/theme_extensions.css +186 -96
  18. data/assets/themes/j1/core/css/theme_extensions.min.css +1 -1
  19. data/assets/themes/j1/core/css/uno.css +186 -96
  20. data/assets/themes/j1/core/css/uno.min.css +1 -1
  21. data/assets/themes/j1/core/css/vendor.css +130 -104
  22. data/assets/themes/j1/core/css/vendor.min.css +4 -4
  23. data/assets/themes/j1/core/js/template.js +296 -24
  24. data/assets/themes/j1/core/js/template.js.map +1 -1
  25. data/assets/themes/j1/core/js/template.min.js +1 -1
  26. data/lib/j1/version.rb +1 -1
  27. data/lib/j1_app/j1_auth_manager/auth_manager.rb +21 -17
  28. data/lib/j1_app/j1_auth_manager/config.rb +13 -9
  29. data/lib/j1_app/j1_site_manager/static_site.rb +1 -1
  30. data/lib/starter_web/Gemfile +2 -2
  31. data/lib/starter_web/_config.yml +12 -139
  32. data/lib/starter_web/_data/modules/authentication.yml +1 -1
  33. data/lib/starter_web/_data/modules/defaults/navigator.yml +25 -24
  34. data/lib/starter_web/_data/modules/defaults/ssm.yml +50 -0
  35. data/lib/starter_web/_data/modules/defaults/toccer.yml +14 -15
  36. data/lib/starter_web/_data/modules/navigator.yml +164 -97
  37. data/lib/starter_web/_data/modules/ssm.yml +133 -0
  38. data/lib/starter_web/_data/modules/toccer.yml +20 -62
  39. data/lib/starter_web/_data/resources.yml +74 -51
  40. data/lib/starter_web/_data/template_settings.yml +13 -13
  41. data/lib/starter_web/_plugins/uglify.rb +41 -0
  42. data/lib/starter_web/apps/public/{cc → cc/cc.yml} +0 -0
  43. data/lib/starter_web/apps/public/cc/index.adoc +107 -0
  44. data/lib/starter_web/assets/images/modules/icons/j1/{j1..ico → j1.ico} +0 -0
  45. data/lib/starter_web/assets/themes/j1/adapter/js/algolia.js +321 -0
  46. data/lib/starter_web/assets/themes/j1/adapter/js/attic.js +4 -4
  47. data/lib/starter_web/assets/themes/j1/adapter/js/carousel.js +3 -3
  48. data/lib/starter_web/assets/themes/j1/adapter/js/framer.js +3 -3
  49. data/lib/starter_web/assets/themes/j1/adapter/js/j1.js +19 -60
  50. data/lib/starter_web/assets/themes/j1/adapter/js/mmenu.js +452 -0
  51. data/lib/starter_web/assets/themes/j1/adapter/js/navigator.js +50 -50
  52. data/lib/starter_web/assets/themes/j1/adapter/js/ssm.js +498 -0
  53. data/lib/starter_web/assets/themes/j1/adapter/js/themer.js +1 -1
  54. data/lib/starter_web/assets/themes/j1/adapter/js/toccer.js +40 -43
  55. data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/css/mmenu-light.css +384 -0
  56. data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/css/mmenu-light.min.css +384 -0
  57. data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/css/themes/uno.css +153 -0
  58. data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/css/themes/uno.min.css +153 -0
  59. data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/js/mmenu-light.js +11 -0
  60. data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/js/mmenu-light.min.js +11 -0
  61. data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/js/mmenu-light.polyfills.js +118 -0
  62. data/lib/starter_web/assets/themes/j1/extensions/mmenu-light/js/mmenu-light.polyfills.min.js +118 -0
  63. data/lib/starter_web/collections/posts/public/{jekyll → featured}/_posts/2018-05-01-confusion-about-base-url.adoc +0 -0
  64. data/lib/starter_web/package.json +1 -1
  65. data/lib/starter_web/pages/public/learn/floating_sidebar.adoc +199 -0
  66. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +2 -2
  67. data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +2 -2
  68. data/lib/starter_web/pages/public/learn/whats_up.adoc +12 -11
  69. data/lib/starter_web/pages/public/legal/en/500_support.adoc +1 -1
  70. data/lib/starter_web/pages/public/previewer/000_includes/tables/mdi_icons/200_rotate.asciidoc +1 -1
  71. data/lib/starter_web/pages/public/previewer/mdi_icons_preview.adoc +2 -3
  72. data/lib/starter_web/pages/public/previewer/twitter_emoji_preview.adoc +3 -3
  73. data/lib/starter_web/pages/public/site_search.adoc +196 -0
  74. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  75. data/lib/starter_web/utilsrv/package.json +1 -1
  76. metadata +26 -13
  77. data/assets/themes/j1/core/css/globals.scss +0 -28
  78. data/lib/starter_web/_data/modules/back2top.yml +0 -40
  79. data/lib/starter_web/_data/modules/defaults/back2top.yml +0 -147
  80. data/lib/starter_web/_data/modules/defaults/smooth_scroll.yml +0 -169
  81. data/lib/starter_web/_data/modules/smooth_scroll.yml +0 -169
  82. data/lib/starter_web/assets/themes/j1/adapter/js/back2top.js +0 -227
  83. data/lib/starter_web/assets/themes/j1/adapter/js/scroller.js +0 -177
@@ -0,0 +1,321 @@
1
+ ---
2
+ regenerate: false
3
+ ---
4
+
5
+ {% capture cache %}
6
+
7
+ {% comment %}
8
+ # -----------------------------------------------------------------------------
9
+ # ~/assets/themes/j1/adapter/js/algolia.js
10
+ # Liquid template to adapt Algolia Core functions
11
+ #
12
+ # Product/Info:
13
+ # https://jekyll.one
14
+ # https://community.algolia.com/instantsearch.js/v2/getting-started.html
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 procedures
26
+ -------------------------------------------------------------------------------- {% endcomment %}
27
+
28
+ {% comment %} Set global settings
29
+ -------------------------------------------------------------------------------- {% endcomment %}
30
+ {% assign environment = site.environment %}
31
+ {% assign template_version = site.version %}
32
+
33
+ {% comment %} Process YML config data
34
+ ================================================================================ {% endcomment %}
35
+
36
+ {% comment %} Set config files
37
+ -------------------------------------------------------------------------------- {% endcomment %}
38
+ {% assign site_config = site %}
39
+ {% assign template_config = site.data.template_settings %}
40
+ {% assign blocks = site.data.blocks %}
41
+ {% assign modules = site.data.modules %}
42
+
43
+ {% comment %} Set config data
44
+ -------------------------------------------------------------------------------- {% endcomment %}
45
+ {% assign algolia_config = site_config.algolia %}
46
+
47
+ {% comment %} Set config options
48
+ -------------------------------------------------------------------------------- {% endcomment %}
49
+
50
+ /*
51
+ # -----------------------------------------------------------------------------
52
+ # ~/assets/themes/j1/adapter/js/algolia.js
53
+ # J1 Adapter for Algolia
54
+ #
55
+ # Product/Info:
56
+ # https://jekyll.one
57
+ #
58
+ # Copyright (C) 2020 Juergen Adams
59
+ #
60
+ # J1 Template is licensed under the MIT License.
61
+ # For details, see https://jekyll.one
62
+ # -----------------------------------------------------------------------------
63
+ # Adapter generated: {{site.time}}
64
+ # -----------------------------------------------------------------------------
65
+ */
66
+ 'use strict';
67
+
68
+ {% comment %} Main
69
+ -------------------------------------------------------------------------------- {% endcomment %}
70
+ j1.adapter['algolia'] = (function (j1, window) {
71
+
72
+ {% comment %} Set global variables
73
+ ------------------------------------------------------------------------------ {% endcomment %}
74
+ var environment = '{{environment}}';
75
+ var moduleOptions = {};
76
+ var _this;
77
+ var logger;
78
+ var logText;
79
+
80
+ // ---------------------------------------------------------------------------
81
+ // Helper functions
82
+ // ---------------------------------------------------------------------------
83
+
84
+ // ---------------------------------------------------------------------------
85
+ // Main object
86
+ // ---------------------------------------------------------------------------
87
+ return {
88
+
89
+ // -------------------------------------------------------------------------
90
+ // Initializer
91
+ // -------------------------------------------------------------------------
92
+ init: function (options) {
93
+ // initialize state flag
94
+ j1.adapter.algolia.state = 'pending';
95
+
96
+ // -----------------------------------------------------------------------
97
+ // Default module settings
98
+ // -----------------------------------------------------------------------
99
+ var settings = $.extend({
100
+ module_name: 'j1.adapter.algolia',
101
+ generated: '{{site.time}}'
102
+ }, options);
103
+
104
+ {% comment %} Set global variables
105
+ -------------------------------------------------------------------------- {% endcomment %}
106
+ _this = j1.adapter.algolia;
107
+ logger = log4javascript.getLogger('j1.adapter.algolia');
108
+
109
+ _this.setState('started');
110
+ logger.info('state: ' + _this.getState());
111
+ logger.info('module is being initialized');
112
+
113
+ {% comment %} Load module config from yml data
114
+ -------------------------------------------------------------------------- {% endcomment %}
115
+ // Load module DEFAULTS|CONFIG
116
+ moduleOptions = $.extend({}, {{algolia_config | replace: '=>', ':' | replace: 'nil', '""'}});
117
+
118
+ if (typeof settings !== 'undefined') {
119
+ moduleOptions = j1.mergeData(moduleOptions, settings);
120
+ }
121
+
122
+ var search = instantsearch({
123
+ appId: moduleOptions.application_id,
124
+ apiKey: moduleOptions.search_only_api_key,
125
+ indexName: moduleOptions.index_name,
126
+ routing: true
127
+ });
128
+
129
+ var hitTemplate = function(hit) {
130
+ // state = 'start search';
131
+ // logger.info('state: ' + state);
132
+ // var re = new RegExp("^\/posts");
133
+ // var re = new RegExp("^\/pages");
134
+ var re = new RegExp("^\/pages|^\/posts|^\/collections");
135
+ if (re.test(hit.url)) {
136
+ let date = '';
137
+ if (hit.date) {
138
+ date = moment.unix(hit.date).format('MMM D, YYYY');
139
+ }
140
+ // let url = `/jekyll-algolia-example${hit.url}#${hit.anchor}`;
141
+ let url = `${hit.url}`;
142
+
143
+ const title = hit._highlightResult.title.value;
144
+ let breadcrumbs = '';
145
+
146
+ if (hit._highlightResult.headings) {
147
+ breadcrumbs = hit._highlightResult.headings.map(match => {
148
+ return `<span class="post-breadcrumb">${match.value}</span>`
149
+ }).join(' > ')
150
+ }
151
+
152
+ var content = hit._highlightResult.html.value;
153
+
154
+ return `
155
+ <li class="search-result-item">
156
+ <div class="card card-flat">
157
+ <div class="card-body">
158
+ <span class="post-meta">${date}</span>
159
+ <h2 class="card-title">${title}</h2>
160
+ <h6 class="card-subtitle mb-2 text-muted">${hit.tagline}</h6>
161
+ <div class="card-text">${content}</div>
162
+ <div class="card-footer">
163
+ <a class="card-link" href="${url}" target="_blank">Read more ..</a>
164
+ </div>
165
+ </div>
166
+ </div>
167
+ </li>
168
+ `;
169
+ }
170
+ // state = 'finished search';
171
+ // logger.info('state: ' + state);
172
+ }
173
+
174
+ if (moduleOptions.enabled == true) {
175
+ // initialize currentRefinedValues
176
+ search.addWidget(
177
+ instantsearch.widgets.currentRefinedValues({
178
+ container: '#current-refined-values',
179
+ // This widget can also contain a clear all link to remove all filters,
180
+ // we disable it in this example since we use `clearAll` widget on its own.
181
+ clearAll: false
182
+ })
183
+ );
184
+
185
+ // initialize clearAll
186
+ search.addWidget(
187
+ instantsearch.widgets.clearAll({
188
+ container: '#clear-all',
189
+ templates: {
190
+ link: 'Reset TAGS'
191
+ },
192
+ clearsQuery: false,
193
+ autoHideContainer: false
194
+ })
195
+ );
196
+
197
+ // initialize pagination
198
+ search.addWidget(
199
+ instantsearch.widgets.pagination({
200
+ container: '#pagination',
201
+ maxPages: 20,
202
+ // default is to scroll to 'body', here we disable this behavior
203
+ scrollTo: false
204
+ })
205
+ );
206
+ // initialize SearchBox
207
+ search.addWidget(
208
+ instantsearch.widgets.searchBox({
209
+ container: '#search-searchbar',
210
+ placeholder: 'Search this site ..',
211
+ autofocus: true,
212
+ reset: true,
213
+ loadingIndicator: false,
214
+ poweredBy: true // This is required if you're on the free Community plan
215
+ })
216
+ );
217
+ // initialize hits widget
218
+ search.addWidget(
219
+ instantsearch.widgets.hits({
220
+ container: '#search-hits',
221
+ templates: {
222
+ empty: 'No results',
223
+ item: hitTemplate
224
+ }
225
+ })
226
+ );
227
+ // initialize RefinementList
228
+ search.addWidget(
229
+ instantsearch.widgets.refinementList({
230
+ container: '#refinement-list',
231
+ attributeName: 'tags',
232
+ collapsible: true,
233
+ operator: "and",
234
+ limit: 5,
235
+ sortBy: ["isRefined","count:desc","name:asc"],
236
+ templates: {
237
+ header: 'Tags'
238
+ },
239
+ showMore: true
240
+ })
241
+ );
242
+ /*
243
+ search.addWidget(
244
+ instantsearch.widgets.hitsPerPageSelector({
245
+ container: '#hits-per-page-selector',
246
+ items: [
247
+ {value: 3, label: '3 per page', default: true},
248
+ {value: 6, label: '6 per page'},
249
+ {value: 12, label: '12 per page'},
250
+ ]
251
+ })
252
+ );
253
+ */
254
+ }
255
+
256
+ if (moduleOptions.enabled == true) {
257
+ search.start();
258
+ $('#searcher').addClass('row');
259
+
260
+ _this.setState('finished');
261
+ logger.info('state: ' + _this.getState());
262
+ logger.info('initializing module finished');
263
+ } else {
264
+ $('#algolia-site-search').append('<p class="ml-5 mt-5 mb-5 "> <strong>Algolia Search DISABLED</strong> </p>');
265
+ _this.setState('finished');
266
+ logger.info('state: ' + _this.getState());
267
+ logger.warn("module disabled");
268
+ }
269
+
270
+ return true;
271
+ }, // END init
272
+
273
+ // -------------------------------------------------------------------------
274
+ // messageHandler: MessageHandler for J1 CookieConsent module
275
+ // Manage messages send from other J1 modules
276
+ // -------------------------------------------------------------------------
277
+ messageHandler: function (sender, message) {
278
+ var json_message = JSON.stringify(message, undefined, 2);
279
+
280
+ logText = 'received message from ' + sender + ': ' + json_message;
281
+ logger.debug(logText);
282
+
283
+ // -----------------------------------------------------------------------
284
+ // Process commands|actions
285
+ // -----------------------------------------------------------------------
286
+ if (message.type === 'command' && message.action === 'module_initialized') {
287
+ //
288
+ // Place handling of command|action here
289
+ //
290
+ logger.info(message.text);
291
+ }
292
+
293
+ //
294
+ // Place handling of other command|action here
295
+ //
296
+
297
+ return true;
298
+ }, // END messageHandler
299
+
300
+ // -------------------------------------------------------------------------
301
+ // setState
302
+ // Set the current (processing) state of the module
303
+ // -------------------------------------------------------------------------
304
+ setState: function (stat) {
305
+ j1.adapter.algolia.state = stat;
306
+ }, // END setState
307
+
308
+ // -------------------------------------------------------------------------
309
+ // getState
310
+ // Returns the current (processing) state of the module
311
+ // -------------------------------------------------------------------------
312
+ getState: function () {
313
+ return j1.adapter.algolia.state;
314
+ } // END state
315
+
316
+ }; // END return
317
+ })(j1, window);
318
+
319
+ {% endcapture %}
320
+ {{ cache | strip_empty_lines }}
321
+ {% assign cache = nil %}
@@ -120,7 +120,7 @@ j1.adapter['attic'] = (function (j1, window) {
120
120
  // clear interval checking
121
121
  clearInterval(dependencies_met_attic_adapter);
122
122
  }
123
- }, 50); // END 'dataLoaded'
123
+ }, 25); // END 'dataLoaded'
124
124
 
125
125
  return true;
126
126
  }, // END init
@@ -544,7 +544,7 @@ j1.adapter['attic'] = (function (j1, window) {
544
544
  // Set the current (processing) state of the module
545
545
  // -------------------------------------------------------------------------
546
546
  setState: function (stat) {
547
- j1.adapter.scroller.state = stat;
547
+ j1.adapter.attic.state = stat;
548
548
  }, // END setState
549
549
 
550
550
  // -------------------------------------------------------------------------
@@ -552,7 +552,7 @@ j1.adapter['attic'] = (function (j1, window) {
552
552
  // Returns the current (processing) state of the module
553
553
  // -------------------------------------------------------------------------
554
554
  getState: function () {
555
- return j1.adapter.scroller.state;
555
+ return j1.adapter.attic.state;
556
556
  } // END state
557
557
 
558
558
  }; // END return
@@ -560,4 +560,4 @@ j1.adapter['attic'] = (function (j1, window) {
560
560
 
561
561
  {% endcapture %}
562
562
  {{ cache | strip_empty_lines }}
563
- {% assign cache = nil %}
563
+ {% assign cache = nil %}
@@ -293,7 +293,7 @@ j1.adapter['carousel'] = (function (j1, window) {
293
293
  // Set the current (processing) state of the module
294
294
  // -------------------------------------------------------------------------
295
295
  setState: function (stat) {
296
- j1.adapter.scroller.state = stat;
296
+ j1.adapter.carousel.state = stat;
297
297
  }, // END setState
298
298
 
299
299
  // -------------------------------------------------------------------------
@@ -301,7 +301,7 @@ j1.adapter['carousel'] = (function (j1, window) {
301
301
  // Returns the current (processing) state of the module
302
302
  // -------------------------------------------------------------------------
303
303
  getState: function () {
304
- return j1.adapter.scroller.state;
304
+ return j1.adapter.carousel.state;
305
305
  } // END state
306
306
 
307
307
  }; // END return
@@ -310,4 +310,4 @@ j1.adapter['carousel'] = (function (j1, window) {
310
310
 
311
311
  {% endcapture %}
312
312
  {{cache | strip_empty_lines}}
313
- {% assign cache = nil %}
313
+ {% assign cache = nil %}
@@ -189,7 +189,7 @@ j1.adapter['framer'] = (function (j1, window) {
189
189
  // Set the current (processing) state of the module
190
190
  // -------------------------------------------------------------------------
191
191
  setState: function (stat) {
192
- j1.adapter.scroller.state = stat;
192
+ j1.adapter.framer.state = stat;
193
193
  }, // END setState
194
194
 
195
195
  // -------------------------------------------------------------------------
@@ -197,7 +197,7 @@ j1.adapter['framer'] = (function (j1, window) {
197
197
  // Returns the current (processing) state of the module
198
198
  // -------------------------------------------------------------------------
199
199
  getState: function () {
200
- return j1.adapter.scroller.state;
200
+ return j1.adapter.framer.state;
201
201
  } // END state
202
202
 
203
203
  }; // END return
@@ -205,4 +205,4 @@ j1.adapter['framer'] = (function (j1, window) {
205
205
 
206
206
  {% endcapture %}
207
207
  {{ cache | strip_empty_lines }}
208
- {% assign cache = nil %}
208
+ {% assign cache = nil %}
@@ -176,24 +176,6 @@ var j1 = (function () {
176
176
  };
177
177
 
178
178
  // user STATE cookie (initial values)
179
- // var user_state = {
180
- // 'theme_css': default_theme_css,
181
- // 'theme_extension_css': '{{themer_options.includeBootswatch}}',
182
- // 'theme_name': default_theme_name,
183
- // 'theme_author': default_theme_author,
184
- // 'theme_author_url': '{{template_config.theme_author_url}}',
185
- // 'theme_link': default_theme_link,
186
- // 'theme_version': '{{site.version}}',
187
- // 'cookies_accepted': 'pending',
188
- // 'whitelistedPages': default_white_listed_pages,
189
- // 'deleteOnDecline': false,
190
- // 'showConsentOnPending': false,
191
- // 'stopScrolling': true,
192
- // 'session_active': false,
193
- // 'last_session_ts': '',
194
- // 'cc_authenticated': false
195
- // };
196
-
197
179
  var user_state = {
198
180
  'theme_css': default_theme_css,
199
181
  'theme_extension_css': themeExtensionCss,
@@ -308,10 +290,10 @@ var j1 = (function () {
308
290
  user_state.last_session_ts = timestamp_now;
309
291
 
310
292
  // DANGEROUS (??): delete user session in browser using MULTI_TAB!
311
- if (j1.existsCookie(cookie_names.user_session)) {
312
- var bla = cookie_names.user_session;
313
- j1.deleteCookie(cookie_names.user_session)
314
- }
293
+ // if (j1.existsCookie(cookie_names.user_session)) {
294
+ // var bla = cookie_names.user_session;
295
+ // j1.deleteCookie(cookie_names.user_session)
296
+ // }
315
297
 
316
298
  j1.writeCookie({
317
299
  name: cookie_user_state_name,
@@ -1082,8 +1064,6 @@ var j1 = (function () {
1082
1064
 
1083
1065
  var logText = 'initializing material design finished';
1084
1066
  logger.info(logText);
1085
-
1086
- return true;
1087
1067
  }, // END initMDB
1088
1068
 
1089
1069
  // -------------------------------------------------------------------------
@@ -1103,7 +1083,6 @@ var j1 = (function () {
1103
1083
  o[p] = a[i][p];
1104
1084
  }
1105
1085
  }
1106
-
1107
1086
  return o;
1108
1087
  }, // END mergeData
1109
1088
 
@@ -1121,61 +1100,41 @@ var j1 = (function () {
1121
1100
  // -------------------------------------------------------------------------
1122
1101
  getLanguage: function () {
1123
1102
  var language = navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage);
1124
-
1125
- return language;
1126
1103
  }, // END getLanguage
1127
1104
 
1128
1105
  // -------------------------------------------------------------------------
1129
- // returns the template version taken from site config ( _config.yml)
1106
+ // returns the template version taken from site config (_config.yml)
1130
1107
  // -------------------------------------------------------------------------
1131
1108
  getTemplateVersion: function () {
1132
1109
  return '{{template_version}}';
1133
1110
  }, // END getTemplateVersion
1134
1111
 
1135
1112
  // -------------------------------------------------------------------------
1136
- // Scrolls smooth to any anchor referenced by an page URL
1137
- // Values for delay|offset are taken from TOC module (Tocbot)
1113
+ // Scrolls smooth to any anchor referenced by an page URL on
1114
+ // e.g. a page reload. Values for delay|offset are taken from
1115
+ // TOCCER module
1138
1116
  // -------------------------------------------------------------------------
1139
1117
  scrollTo: function () {
1140
- // Unclear why a offset correction is needed (sometimes ???)
1141
- var offset_correction = {{toccer_options.headingsOffset}};
1142
- var offset = {{toccer_options.smoothScrollOffset}};
1143
- var anchor_id = window.location.href.split("#")[1];
1118
+ var anchor = window.location.href.split("#")[1];
1119
+ var anchor_id = '#' + anchor;
1144
1120
  var selector;
1145
- var heading;
1146
- var re;
1147
1121
 
1148
1122
  if (anchor_id) {
1149
- selector = $('.' + anchor_id + ', #' + anchor_id +',[name='+anchor_id+']');
1150
- heading = selector[0].nodeName;
1151
-
1152
1123
  // scroll only, if an anchor is given with URL
1124
+ selector = $(anchor_id);
1153
1125
  if (selector.length) {
1154
- var delay = {{toccer_options.smoothScrollDuration}};
1155
- var scroll_to = parseInt( selector.offset().top - offset - offset_correction );
1156
- //var scroll_to = selector.offset().top;
1157
- $('html,body').animate({scrollTop: scroll_to}, delay,
1158
- function () {
1159
- // scroll the page one pixel back and forth
1160
- // to get the right position for the NAV Module (Tocbot)
1161
- $(window).scrollTop($(window).scrollTop()+1);
1162
- $(window).scrollTop($(window).scrollTop()-1);
1126
+ j1.core.scrollSmooth.scroll( anchor_id, {
1127
+ duration: {{toccer_options.scrollSmoothDuration}},
1128
+ offset: {{toccer_options.scrollSmoothOffset}},
1129
+ callback: null
1163
1130
  });
1164
1131
  } else {
1165
- // TODO: to be checked if this else is needed
1166
- // scroll the page one pixel back and forth
1167
- // to get the right position for the NAV Module (Tocbot)
1132
+ // scroll the page one pixel back and forth (trigger)
1133
+ // to get the right position for the Toccer
1168
1134
  $(window).scrollTop($(window).scrollTop()+1);
1169
1135
  $(window).scrollTop($(window).scrollTop()-1);
1170
- } // selector.length
1171
- } else {
1172
- // scroll the page one pixel back and forth
1173
- // to get the right position for the NAV Module (Tocbot)
1174
- $(window).scrollTop($(window).scrollTop()+1);
1175
- $(window).scrollTop($(window).scrollTop()-1);
1176
- } // END if anchor_id
1177
-
1178
- return true;
1136
+ } // END if anchor_id
1137
+ }
1179
1138
  }, // END scrollTo
1180
1139
 
1181
1140
  // -------------------------------------------------------------------------