j1-template 2023.0.2 → 2023.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/content_generator_collection.html +26 -74
  3. data/_includes/themes/j1/layouts/content_generator_post.html +8 -2
  4. data/_includes/themes/j1/layouts/layout_metadata_generator.html +6 -0
  5. data/_includes/themes/j1/procedures/blocks/footer/boxes/social_media_icons.proc +22 -22
  6. data/_includes/themes/j1/procedures/collections/create_collection_article_preview.proc +64 -19
  7. data/_includes/themes/j1/procedures/collections/pager.proc +127 -0
  8. data/_includes/themes/j1/procedures/posts/pager.proc +7 -3
  9. data/assets/data/banner.html +29 -18
  10. data/assets/data/panel.html +166 -120
  11. data/assets/themes/j1/adapter/js/navigator.js +77 -303
  12. data/assets/themes/j1/adapter/js/themer.js +106 -81
  13. data/assets/themes/j1/modules/themeSwitcher/js/_unsued/switcher.1.js +454 -0
  14. data/lib/j1/version.rb +1 -1
  15. data/lib/starter_web/Gemfile +3 -3
  16. data/lib/starter_web/README.md +5 -5
  17. data/lib/starter_web/_config.yml +23 -26
  18. data/lib/starter_web/_data/blocks/banner.yml +2 -1
  19. data/lib/starter_web/_data/blocks/panel.yml +7 -2
  20. data/lib/starter_web/_data/modules/attics.yml +2 -2
  21. data/lib/starter_web/_data/modules/defaults/navigator.yml +2 -2
  22. data/lib/starter_web/_data/modules/scroller.yml +5 -5
  23. data/lib/starter_web/_data/modules/themer.yml +0 -1
  24. data/lib/starter_web/_data/templates/feed.xml +1 -1
  25. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  26. data/lib/starter_web/assets/images/{triangles-bg.png → backgrounds/triangles-bg.png} +0 -0
  27. data/lib/starter_web/assets/images/icons/scalable/facebook.svg +34 -0
  28. data/lib/starter_web/assets/images/icons/scalable/google.svg +35 -0
  29. data/lib/starter_web/assets/images/icons/scalable/ibm.svg +24 -0
  30. data/lib/starter_web/assets/images/icons/scalable/microsoft.svg +42 -0
  31. data/lib/starter_web/collections/_biography/a-life-in-questions.adoc +98 -0
  32. data/lib/starter_web/collections/_biography/becoming.adoc +89 -0
  33. data/lib/starter_web/collections/_biography/born-to-run.adoc +92 -0
  34. data/lib/starter_web/collections/_biography/forty-autumns.adoc +91 -0
  35. data/lib/starter_web/collections/_biography/not-dead-yet.adoc +85 -0
  36. data/lib/starter_web/collections/_biography/princess-diarist-the.adoc +88 -0
  37. data/lib/starter_web/collections/_biography/when-breath-becomes-air.adoc +90 -0
  38. data/lib/starter_web/package.json +2 -1
  39. data/lib/starter_web/pages/public/blog/navigator/archive/allview.html +1 -0
  40. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +1 -0
  41. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +1 -0
  42. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +1 -0
  43. data/lib/starter_web/pages/public/blog/navigator/index.html +2 -1
  44. data/lib/starter_web/pages/public/bookshelf/viewer_biography.adoc +62 -0
  45. data/lib/starter_web/pages/public/bookshelf/whats_up.adoc +287 -0
  46. data/lib/starter_web/pages/public/previewer/preview_bootstrap_theme.adoc +1 -0
  47. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  48. data/lib/starter_web/utilsrv/package.json +1 -1
  49. metadata +18 -11
  50. data/assets/themes/j1/core/css/icon-fonts/materialdesign-light.css +0 -1222
  51. data/assets/themes/j1/core/css/icon-fonts/materialdesign-light.min.css +0 -1
  52. data/assets/themes/j1/core/css/icon-fonts/materialdesign.css +0 -22307
  53. data/assets/themes/j1/core/css/icon-fonts/materialdesign.min.css +0 -1
  54. data/assets/themes/j1/core/css/icon-fonts/twemoji.css +0 -9499
  55. data/assets/themes/j1/core/css/icon-fonts/twemoji.min.css +0 -1
  56. data/assets/themes/j1/core/css/themes/theme_vapor/bootstrap.css +0 -8876
  57. data/assets/themes/j1/core/css/themes/theme_vapor/bootstrap.min.css +0 -5
@@ -154,6 +154,22 @@ j1.adapter.themer = (function (j1, window) {
154
154
  return false;
155
155
  }
156
156
 
157
+ // see: https://stackoverflow.com/questions/4301968/checking-a-url-in-jquery-javascript
158
+ // see: https://stackoverflow.com/questions/16481598/prevent-unhandled-jquery-ajax-error
159
+ //
160
+ var urlExists = function(url, callback) {
161
+ if ( ! $.isFunction(callback)) {
162
+ throw Error('Not a valid callback');
163
+ }
164
+
165
+ $.ajax({
166
+ type: 'HEAD',
167
+ url: url,
168
+ success: $.proxy(callback, this, true),
169
+ error: $.proxy(callback, this, false)
170
+ });
171
+ };
172
+
157
173
  // ---------------------------------------------------------------------------
158
174
  // Main object
159
175
  // ---------------------------------------------------------------------------
@@ -202,7 +218,7 @@ j1.adapter.themer = (function (j1, window) {
202
218
  user_state = j1.readCookie(cookie_names.user_state);
203
219
  user_consent = j1.readCookie(cookie_names.user_consent);
204
220
 
205
- logger.info('\n' + 'cookie ' + cookie_names.user_state + ' successfully loaded after: ' + interval_count * 25 + ' ms');
221
+ logger.debug('\n' + 'cookie ' + cookie_names.user_state + ' successfully loaded after: ' + interval_count * 25 + ' ms');
206
222
 
207
223
  // initial theme data
208
224
  if (user_state.theme_css === '') {
@@ -217,99 +233,108 @@ j1.adapter.themer = (function (j1, window) {
217
233
  secure: secure,
218
234
  expires: 365
219
235
  });
236
+
220
237
  if (!cookie_written) {
221
- logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
238
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
222
239
  }
223
240
  }
224
241
 
225
- // check cookie consistency
226
- // if (Object.keys(user_state).length > 2) {
227
- // logger.debug('\n' + 'consistent state detected for cookie: ' + cookie_names.user_state);
228
- // } else {
229
- // logger.fatal('\n' + 'inconsistent state detected for cookie: ' + cookie_names.user_state);
230
- // }
231
-
232
242
  // set the theme switcher state
233
243
  user_state.theme_switcher = themerOptions.enabled;
234
-
235
244
  if (themerOptions.enabled) {
236
- // enable BS ThemeSwitcher
237
- logger.info('\n' + 'themes detected as: enabled');
238
- logger.info('\n' + 'theme is being initialized: ' + user_state.theme_name);
239
-
240
- /* eslint-disable */
241
- // load list of remote themes
242
- $('#remote_themes').bootstrapThemeSwitcher.defaults = {
243
- debug: themerOptions.debug,
244
- saveToCookie: themerOptions.saveToCookie,
245
- cssThemeLink: themerOptions.cssThemeLink,
246
- cookieThemeName: themerOptions.cookieThemeName,
247
- cookieDefaultThemeName: themerOptions.cookieDefaultThemeName,
248
- cookieThemeCss: themerOptions.cookieThemeCss,
249
- cookieThemeExtensionCss: themerOptions.cookieThemeExtensionCss,
250
- cookieExpiration: themerOptions.cookieExpiration,
251
- cookiePath: themerOptions.cookiePath,
252
- defaultCssFile: themerOptions.defaultCssFile,
253
- bootswatchApiUrl: themerOptions.bootswatchApiUrl,
254
- bootswatchApiVersion: themerOptions.bootswatchApiVersion,
255
- loadFromBootswatch: themerOptions.loadFromBootswatch,
256
- localFeed: themerOptions.localThemes,
257
- excludeBootswatch: themerOptions.excludeBootswatch,
258
- includeBootswatch: themerOptions.includeBootswatch,
259
- skipIncludeBootswatch: themerOptions.skipIncludeBootswatch
260
- };
261
- /* eslint-enable */
262
-
263
- // continue processing if page is ready
264
- var dependencies_met_theme_applied = setInterval (function () {
265
- if (j1.getState() == 'finished') {
266
- styleLoaded = styleSheetLoaded(user_state.theme_css);
267
- theme_css_html = '<link rel="stylesheet" id="' + id + '" href="' + user_state.theme_css + '" type="text/css" />';
268
-
269
- // loading theme CSS file except on UNO
270
- if (!user_state.theme_name.includes('Uno') || !styleLoaded) {
271
- $('head').append(theme_css_html);
272
- _this.setState('finished');
273
- logger.debug('\n' + 'state: ' + _this.getState());
274
- logger.info('\n' + 'module initialized successfully');
275
- clearInterval(dependencies_met_theme_applied);
276
- } else if (user_state.theme_name.includes('Uno')) {
277
- _this.setState('finished');
278
- logger.debug('\n' + 'state: ' + _this.getState());
279
- logger.info('\n' + 'module initialized successfully');
280
- clearInterval(dependencies_met_theme_applied);
245
+ // enable BS ThemeSwitcher
246
+ logger.info('\n' + 'themes detected as: ' + themerOptions.enabled);
247
+ logger.info('\n' + 'remote themes are being initialized');
248
+
249
+ /* eslint-disable */
250
+ // load list of remote themes
251
+ $('#remote_themes').bootstrapThemeSwitcher.defaults = {
252
+ debug: themerOptions.debug,
253
+ saveToCookie: themerOptions.saveToCookie,
254
+ cssThemeLink: themerOptions.cssThemeLink,
255
+ cookieThemeName: themerOptions.cookieThemeName,
256
+ cookieDefaultThemeName: themerOptions.cookieDefaultThemeName,
257
+ cookieThemeCss: themerOptions.cookieThemeCss,
258
+ cookieThemeExtensionCss: themerOptions.cookieThemeExtensionCss,
259
+ cookieExpiration: themerOptions.cookieExpiration,
260
+ cookiePath: themerOptions.cookiePath,
261
+ defaultCssFile: themerOptions.defaultCssFile,
262
+ bootswatchApiUrl: themerOptions.bootswatchApiUrl,
263
+ bootswatchApiVersion: themerOptions.bootswatchApiVersion,
264
+ loadFromBootswatch: themerOptions.loadFromBootswatch,
265
+ localFeed: themerOptions.localThemes,
266
+ excludeBootswatch: themerOptions.excludeBootswatch,
267
+ includeBootswatch: themerOptions.includeBootswatch,
268
+ skipIncludeBootswatch: themerOptions.skipIncludeBootswatch
269
+ };
270
+ /* eslint-enable */
271
+ } else {
272
+ logger.warn('\n' + 'themes detected as: disabled');
273
+ logger.warn('\n' + 'no remote themes are available');
274
+ }
275
+
276
+ // validate theme to be loaded
277
+ urlExists(user_state.theme_css, function(success) {
278
+ // load theme
279
+ if (success) {
280
+ // continue processing if page is ready
281
+ var dependencies_met_theme_loaded = setInterval (function () {
282
+ if (j1.getState() == 'finished') {
283
+ theme_css_html = '<link rel="stylesheet" id="' + id + '" href="' + user_state.theme_css + '" type="text/css" />';
284
+ $('head').append(theme_css_html);
285
+
286
+ clearInterval(dependencies_met_theme_loaded);
287
+ }
288
+ }, 25); // END dependencies_met_theme_loaded
289
+ } else {
290
+ // invalid theme, fallback on default
291
+ logger.warn('\n' + 'themes CSS invalid: ' + user_state.theme_css);
292
+ theme_css_html = '<link rel="stylesheet" id="' + id + '" href="' + default_theme_css + '" type="text/css" />';
293
+ logger.warn('\n' + 'set default theme :' + default_theme_name);
294
+ logger.debug('\n' + 'theme CSS loaded: ' + default_theme_css);
295
+ $('head').append(theme_css_html);
296
+
297
+ // write theme defaults to cookie
298
+ user_state.theme_name = default_theme_name;
299
+ user_state.theme_css = default_theme_css;
300
+ user_state.theme_author = default_theme_author;
301
+ user_state.theme_author_url = default_theme_author_url;
302
+
303
+ cookie_written = j1.writeCookie({
304
+ name: cookie_names.user_state,
305
+ data: user_state,
306
+ secure: secure,
307
+ expires: 365
308
+ });
309
+
310
+ if (!cookie_written) {
311
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
281
312
  }
282
- }
283
- }, 25); // END dependencies_met_theme_applied
284
313
 
285
- } else {
286
- _this.setState('finished');
287
- logger.debug('\n' + 'state: ' + _this.getState());
288
- logger.info('\n' + 'themes detected as: disabled');
289
- }
314
+ // reload page using the default thme
315
+ location.reload(true);
316
+ }
317
+ });
290
318
  clearInterval(dependencies_met_user_state_available);
291
319
  }
320
+ }, 25); // END dependencies_met_user_state_available
292
321
 
293
- if (interval_count > max_count) {
294
- logger.error('\n' + 'interval max count reached: ' + max_count);
295
- logger.error('\n' + 'check failed after: ' + max_count * 25 + ' ms');
296
- logger.error('\n' + 'loading cookie failed: ' + cookie_names.user_state);
297
-
298
- logger.debug('\n' + 'j1 cookies found:' + j1Cookies.length);
299
- j1Cookies.forEach(item => console.log('j1.core.switcher: ' + item));
300
- logger.debug('\n' + 'ga cookies found:' + gaCookies.length);
301
- gaCookies.forEach(item => console.log('j1.core.switcher: ' + item));
302
-
303
- // jadams, 2021-07-15: redirect to homepage
304
- // NOTE: UNCLEAR why it is needed to create the user state
305
- // cookie THIS way
306
- //
307
- logger.warn('\n' + 'redirect to home page');
308
- // window.location.href = error_page;
309
- window.location.href = '/';
310
- clearInterval(dependencies_met_user_state_available);
322
+ // set final module state if theme loaded
323
+ var dependencies_met_theme_applied = setInterval (function () {
324
+ user_state = j1.readCookie(cookie_names.user_state);
325
+ styleLoaded = styleSheetLoaded(user_state.theme_css);
326
+
327
+ if (styleLoaded) {
328
+ logger.info('\n' + 'theme loaded successfully: ' + user_state.theme_name);
329
+ logger.debug('\n' + 'theme CSS loaded: ' + user_state.theme_css);
330
+ _this.setState('finished');
331
+ logger.debug('\n' + 'state: ' + _this.getState());
332
+ logger.info('\n' + 'module initialized successfully');
333
+
334
+ clearInterval(dependencies_met_theme_applied);
311
335
  }
312
- }, 25); // END dependencies_met_user_state_available
336
+ }, 25); // END dependencies_met_theme_applied
337
+
313
338
  }, // END init
314
339
 
315
340
  // -------------------------------------------------------------------------