j1-template 2021.1.6 → 2021.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -299,7 +299,6 @@ j1.adapter['navigator'] = (function (j1, window) {
299
299
  // -----------------------------------------------------------------------
300
300
  // data loader
301
301
  // -----------------------------------------------------------------------
302
-
303
302
  j1.xhrData({
304
303
  xhr_container_id: navQuicklinksOptions.xhr_container_id,
305
304
  xhr_data_path: navQuicklinksOptions.xhr_data_path,
@@ -319,171 +318,131 @@ j1.adapter['navigator'] = (function (j1, window) {
319
318
  'j1.adapter.navigator',
320
319
  'data_loaded');
321
320
 
322
- var dependencies_met_load_menu_finished = setInterval (function () {
323
- if (j1.xhrDOMState['#'+navQuicklinksOptions.xhr_container_id] == 'not loaded' ||
324
- j1.xhrDOMState['#'+navAuthClientConfig.xhr_container_id] == 'not loaded' ||
325
- j1.xhrDOMState['#'+navMenuOptions.xhr_container_id] == 'not loaded' ){
326
- logger.error('load HTML data (AJAX): failed');
327
- _this.setState('finished');
328
- logger.info('state: ' + _this.getState());
329
- logger.info('initializing module: failed');
330
- logger.info('met dependencies for: xhrData');
331
- clearInterval(dependencies_met_load_menu_finished);
332
- }
333
- // continue if all AJAX loads (xhrData) has finished
334
- if (j1.xhrDOMState['#'+navQuicklinksOptions.xhr_container_id] == 'success' &&
335
- j1.xhrDOMState['#'+navAuthClientConfig.xhr_container_id] == 'success' &&
336
- j1.xhrDOMState['#'+navMenuOptions.xhr_container_id] == 'success' ){
337
- _this.setState('processing');
338
- logger.info('status: ' + _this.getState());
339
- logger.info('initialize navigator core');
340
-
341
- // Detect|Set J1 App status
342
- appDetected = j1.appDetected();
343
- authClientEnabled = j1.authEnabled();
344
- logger.info('application status detected: ' + appDetected);
345
-
346
- j1.core.navigator.init (
347
- _this.navDefaults,
348
- _this.navMenuOptions
349
- );
350
-
351
- // _this.delayShowMenu( 200 );
352
-
353
- // cast text-based booleans
354
- // themerEnabled = ({{themer_options.enabled }} === 'true');
355
-
356
- // load themes (to menu) if themer is enabled|finished
357
- if (themerEnabled) {
358
-
359
- logText = 'theme switcher: enabled';
360
- logger.info(logText);
361
-
362
- // Detect|Set J1 UserState
363
- user_state_detected = j1.existsCookie(cookie_user_state_name);
364
- if (user_state_detected) {
365
- user_state = j1.readCookie(cookie_user_state_name);
366
- }
321
+ var dependencies_met_load_menu_finished = setInterval (function () {
322
+ if (j1.xhrDOMState['#'+navQuicklinksOptions.xhr_container_id] === 'success' &&
323
+ j1.xhrDOMState['#'+navAuthClientConfig.xhr_container_id] === 'success' &&
324
+ j1.xhrDOMState['#'+navMenuOptions.xhr_container_id] === 'success' ) {
325
+ // continue if all AJAX loads (xhrData) has finished
326
+ _this.setState('processing');
327
+ logger.info('status: ' + _this.getState());
328
+ logger.info('initialize navigator core');
367
329
 
368
- var dependencies_met_page_finished = setInterval(function() {
369
- // jadams, 2020-10-03: NOT needed to wait for j1 get finished
370
- // if (j1.getState() == 'finished') {
371
- // jadams, 2021-06-22: disabled check on themer get finished
372
- // if (j1.adapter.themer.getState() == 'finished') {
373
- if ('true' === 'true') {
374
- // initialize theme switcher menus
375
-
376
- logText = 'load themes';
377
- logger.info(logText);
378
-
379
- // load LOCAL themes from JSON data
380
- logText = 'load local themes (json file)';
381
- logger.info(logText);
382
- $('#local_themes').bootstrapThemeSwitcher({
383
- localFeed: themerOptions.localThemes
384
- });
385
-
386
- // load REMOTE themes from Bootswatch API (localFeed EMPTY!)
387
- $('#remote_themes').bootstrapThemeSwitcher({
388
- localFeed: '',
389
- bootswatchApiVersion: themerOptions.bootswatchApiVersion
390
- });
391
-
392
- // jadams, 2021-04-22: Up to now, it is unclear why in some
393
- // cases the menu bar is NOT fully loaded for THEMES
394
- // TODO: Add additional checks to find the reason
395
-
396
- // added same checks (as already done by adapter themer) to
397
- // check if remote theme menu detected as LOADED
398
- //
399
- var dependencies_met_remote_themes_loaded = setInterval(function() {
400
- interval_count += 1;
401
- themes_count = document.getElementById("remote_themes").getElementsByTagName("li").length;
402
- if ( themes_count > 0 ) {
403
- logger.info('remote themes loaded: successfully');
404
- logger.info('remote themes loaded: successfully after: ' + interval_count * 25 + ' ms');
405
-
406
- clearInterval(dependencies_met_remote_themes_loaded);
407
- // clearInterval(dependencies_met_page_finished);
408
- } else {
409
- logger.debug('wait for theme to be loaded: ' + user_state.theme_name);
410
- }
411
- if (interval_count > max_count) {
412
- logger.warn('remote themes loading: failed');
413
- logger.warn('continue processing');
414
- clearInterval(dependencies_met_remote_themes_loaded);
415
- // clearInterval(dependencies_met_page_finished);
416
- }
417
- clearInterval(dependencies_met_page_finished);
418
- }, 25);
419
-
420
- // clearInterval(dependencies_met_page_finished);
421
- }
422
- _this.setState('initialized');
423
- }, 25); // END 'dependencies_met_page_finished'
424
- } else {
425
- logText = 'theme switcher detected as: disabled';
426
- logger.info(logText);
427
- }
330
+ // Detect|Set J1 App status
331
+ appDetected = j1.appDetected();
332
+ authClientEnabled = j1.authEnabled();
333
+ logger.info('application status detected: ' + appDetected);
334
+
335
+ j1.core.navigator.init (_this.navDefaults, _this.navMenuOptions);
428
336
 
429
- // -----------------------------------------------------------------
430
- // event handler|css styles
431
- // -----------------------------------------------------------------
432
- // continue if Theme CSS is applied
433
- var dependencies_met_themer_finished = setInterval(function() {
337
+ // load themes (to menu) if themer is enabled|finished
434
338
  if (themerEnabled) {
435
- if (j1.adapter.themer.getState() === 'finished') {
436
- _this.setState('processing');
339
+ logText = 'theme switcher: enabled';
340
+ logger.info(logText);
341
+
342
+ // Detect|Set J1 UserState
343
+ user_state_detected = j1.existsCookie(cookie_user_state_name);
344
+ if (user_state_detected) {
345
+ user_state = j1.readCookie(cookie_user_state_name);
346
+ }
437
347
 
438
- logger.info('initialize eventHandler');
439
- j1.core.navigator.eventHandler();
440
-
441
- var dependencies_met_page_finished = setInterval(function() {
442
- if (j1.getState() == 'finished') {
443
- // set general|global theme colors
444
- logger.info('initializing dynamic CSS styles: started');
445
- _this.setCSS (
446
- navDefaults, navBarOptions, navMenuOptions,
447
- navQuicklinksOptions, navTopsearchOptions
448
- );
348
+ // jadams, 2021-07-03: wait until navigator CORE get finished
349
+ var dependencies_met_page_finished = setInterval(function() {
350
+ if (j1.adapter.navigator.getState() == 'core_initialized') {
351
+ logText = 'load themes';
352
+ logger.info(logText);
353
+
354
+ // load LOCAL themes from JSON data
355
+ logText = 'load local themes (json file)';
356
+ logger.info(logText);
357
+ $('#local_themes').bootstrapThemeSwitcher({
358
+ localFeed: themerOptions.localThemes
359
+ });
360
+
361
+ // load REMOTE themes from Bootswatch API (localFeed EMPTY!)
362
+ $('#remote_themes').bootstrapThemeSwitcher({
363
+ localFeed: '',
364
+ bootswatchApiVersion: themerOptions.bootswatchApiVersion
365
+ });
366
+
367
+ // jadams, 2021-04-22: Up to now, it is unclear why in some
368
+ // cases the menu bar is NOT fully loaded for THEMES
369
+ // TODO: Add additional checks to find the reason
370
+
371
+ // added same checks (as already done by adapter themer) to
372
+ // check if remote theme menu detected as LOADED
373
+ //
374
+ var dependencies_met_remote_themes_loaded = setInterval(function() {
375
+ interval_count += 1;
376
+ themes_count = document.getElementById("remote_themes").getElementsByTagName("li").length;
377
+ if ( themes_count > 0 ) {
378
+ logger.info('remote themes loaded: successfully');
379
+ logger.info('remote themes loaded: successfully after: ' + interval_count * 25 + ' ms');
380
+
381
+ clearInterval(dependencies_met_remote_themes_loaded);
382
+ } else {
383
+ logger.debug('wait for theme to be loaded: ' + user_state.theme_name);
384
+ }
385
+ if (interval_count > max_count) {
386
+ logger.warn('remote themes loading: failed');
387
+ logger.warn('continue processing');
388
+ clearInterval(dependencies_met_remote_themes_loaded);
389
+ }
449
390
  clearInterval(dependencies_met_page_finished);
450
- }
451
- logger.info('initializing dynamic CSS styles: finished');
452
- }, 25); // END 'dependencies_met_page_finished'
391
+ }, 25);
392
+ }
393
+ _this.setState('initialized');
394
+ }, 25); // END 'dependencies_met_page_finished'
395
+ } else {
396
+ logText = 'theme switcher detected as: disabled';
397
+ logger.info(logText);
398
+ }
399
+
400
+ // -----------------------------------------------------------------
401
+ // event handler|css styles
402
+ // -----------------------------------------------------------------
403
+ // continue if themer|navigator are INITIALIZED
404
+ var dependencies_met_initialized = setInterval(function() {
405
+ if (themerEnabled) {
406
+ if (j1.adapter.navigator.getState() === 'initialized') {
407
+ _this.setState('processing');
408
+
409
+ // set general|global theme colors
410
+ logger.info('initializing dynamic CSS styles');
411
+ _this.setCSS (
412
+ navDefaults, navBarOptions, navMenuOptions,
413
+ navQuicklinksOptions, navTopsearchOptions
414
+ );
415
+
416
+ logger.info('init auth client');
417
+ _this.initAuthClient(_this.navAuthManagerConfig);
418
+
419
+ _this.setState('finished');
420
+ logger.info('state: ' + _this.getState());
421
+ logger.info('module initialized successfully');
422
+ logger.info('met dependencies for: j1');
423
+ clearInterval(dependencies_met_initialized);
424
+ }
425
+ } else {
426
+ _this.setState('processing');
427
+
428
+ // set general|global theme colors
429
+ logger.info('apply dynamic CSS styles');
430
+ _this.setCSS (
431
+ navDefaults, navBarOptions, navMenuOptions,
432
+ navQuicklinksOptions, navTopsearchOptions
433
+ );
453
434
 
454
435
  logger.info('init auth client');
455
436
  _this.initAuthClient(_this.navAuthManagerConfig);
456
-
457
437
  _this.setState('finished');
458
438
  logger.info('state: ' + _this.getState());
459
- logger.info('module initialized successfully');
460
- logger.info('met dependencies for: j1');
461
- clearInterval(dependencies_met_themer_finished);
439
+ clearInterval(dependencies_met_initialized);
462
440
  }
463
- } else {
464
- _this.setState('processing');
465
-
466
- logger.info('initialize eventHandler');
467
- j1.core.navigator.eventHandler();
468
-
469
- // set general|global theme colors
470
- logger.info('apply dynamic CSS styles');
471
- _this.setCSS (
472
- navDefaults, navBarOptions, navMenuOptions,
473
- navQuicklinksOptions, navTopsearchOptions
474
- );
475
-
476
- logger.info('init auth client');
477
- _this.initAuthClient(_this.navAuthManagerConfig);
478
- _this.setState('finished');
479
- logger.info('state: ' + _this.getState());
480
- clearInterval(dependencies_met_themer_finished);
481
- }
482
- }, 25); // END 'dependencies_met_themer_finished'
483
- logger.info('met dependencies for: themer');
484
- clearInterval(dependencies_met_load_menu_finished);
485
- }
486
- }, 25); // END 'dependencies_met_load_menu_finished'
441
+ }, 25); // END 'dependencies_met_initialized'
442
+ logger.info('met dependencies for: themer');
443
+ clearInterval(dependencies_met_load_menu_finished);
444
+ }
445
+ }, 25); // END 'dependencies_met_load_menu_finished'
487
446
 
488
447
  // --------------------------------------------------------------------
489
448
  // Register event 'reset on resize' to call j1.core.navigator on
@@ -506,16 +465,9 @@ j1.adapter['navigator'] = (function (j1, window) {
506
465
  }, 500);
507
466
 
508
467
  // Scroll the page one pixel back and forth to get
509
- // the right position for Toccer (trigger) and SSM
468
+ // the right position for the toccer
510
469
  $(window).scrollTop($(window).scrollTop()+1);
511
470
  $(window).scrollTop($(window).scrollTop()-1);
512
-
513
- // jadams, 2020-06-21: unclear|forgotten what I'm doing here!
514
- // Looks like the old BS3 implementation
515
- //
516
- // $('.navbar-collapse').removeClass('in');
517
- // $('.navbar-collapse').removeClass('on');
518
- // $('.navbar-collapse').removeClass('bounceIn');
519
471
  });
520
472
  }, // END init
521
473
 
@@ -685,17 +637,19 @@ j1.adapter['navigator'] = (function (j1, window) {
685
637
  var gridBreakpoint_sm = '576px';
686
638
  var navPrimaryColor = navDefaults.nav_primary_color;
687
639
 
688
- {% comment %} Set|Resolve navMenuOptions
689
- -------------------------------------------------------------------------- {% endcomment %}
640
+ logger.info('set dynamic styles for the theme loaded');
641
+
642
+ // Set|Resolve navMenuOptions
643
+ // ------------------------------------------------------------------------
690
644
  navMenuOptions.dropdown_font_size = navMenuOptions.dropdown_font_size;
691
645
  navMenuOptions.megamenu_font_size = navMenuOptions.megamenu_font_size;
692
646
 
693
- {% comment %} Set|Resolve navBarOptions
694
- -------------------------------------------------------------------------- {% endcomment %}
647
+ // Set|Resolve navBarOptions
648
+ // -----------------------------------------------------------------------
695
649
  navBarOptions.background_color_full = navBarOptions.background_color_full;
696
650
 
697
- {% comment %} Set|Resolve navMenuOptions
698
- -------------------------------------------------------------------------- {% endcomment %}
651
+ // Set|Resolve navMenuOptions
652
+ // -----------------------------------------------------------------------
699
653
  navMenuOptions.menu_item_color = navMenuOptions.menu_item_color;
700
654
  navMenuOptions.menu_item_color_hover = navMenuOptions.menu_item_color_hover;
701
655
  navMenuOptions.menu_item_dropdown_color = navMenuOptions.menu_item_dropdown_color;
@@ -704,24 +658,23 @@ j1.adapter['navigator'] = (function (j1, window) {
704
658
  navMenuOptions.dropdown_background_color_active = navMenuOptions.dropdown_background_color_active;
705
659
  navMenuOptions.dropdown_border_color = navMenuOptions.dropdown_border_color;
706
660
 
707
- {% comment %} Set|Resolve navQuicklinksOptions
708
- -------------------------------------------------------------------------- {% endcomment %}
661
+ // Set|Resolve navQuicklinksOptions
662
+ // -----------------------------------------------------------------------
709
663
  navQuicklinksOptions.icon_color = navQuicklinksOptions.icon_color;
710
664
  navQuicklinksOptions.icon_color_hover = navQuicklinksOptions.icon_color_hover;
711
665
  navQuicklinksOptions.background_color = navQuicklinksOptions.background_color;
712
666
 
713
- {% comment %} Set|Resolve navTopsearchOptions
714
- -------------------------------------------------------------------------- {% endcomment %}
667
+ // Set|Resolve navTopsearchOptions
668
+ // -----------------------------------------------------------------------
715
669
  navTopsearchOptions.input_color = navTopsearchOptions.input_color;
716
670
  navTopsearchOptions.background_color = navTopsearchOptions.background_color;
717
671
 
718
- {% comment %} Set dymanic styles
719
- -------------------------------------------------------------------------- {% endcomment %}
672
+ // Set dymanic styles
673
+ // -----------------------------------------------------------------------
720
674
  // $('nav-primary').css({"background-color": "navPrimaryColor"});
721
675
 
722
-
723
- {% comment %} navBar styles
724
- -------------------------------------------------------------------------- {% endcomment %}
676
+ // navBar styles
677
+ // -----------------------------------------------------------------------
725
678
  var bg_primary = j1.getStyleValue('bg-primary', 'background-color');
726
679
  var bg_scrolled = bg_primary;
727
680
  var bg_collapsed = bg_primary;
@@ -743,13 +696,13 @@ j1.adapter['navigator'] = (function (j1, window) {
743
696
  $('head').append('<style id="dynNav">@media (max-width: ' +gridBreakpoint_sm+ ') { nav.navbar.navigator.navbar-transparent.light { background-color: ' +navBarOptions.background_color_full+ ' !important; border-bottom: solid 0px !important; } }</style>');
744
697
  $('head').append('<style id="dynNav">@media (max-width: ' +gridBreakpoint_sm+ ') { nav.navbar.navigator.navbar-scrolled.light { background-color: ' +bg_scrolled+ ' !important; } }</style>');
745
698
 
746
- {% comment %} navQuicklinks styles
747
- -------------------------------------------------------------------------- {% endcomment %}
699
+ // navQuicklinks styles
700
+ // -----------------------------------------------------------------------
748
701
  $('head').append('<style>.attr-nav> ul > li > a { color: ' +navQuicklinksOptions.icon_color+ ' !important; }</style>');
749
702
  $('head').append('<style>.attr-nav> ul > li > a:hover { color: ' +navQuicklinksOptions.icon_color_hover+ ' !important; }</style>');
750
703
 
751
- {% comment %} navMenu styles
752
- -------------------------------------------------------------------------- {% endcomment %}
704
+ // navMenu styles
705
+ // -----------------------------------------------------------------------
753
706
  // Remove background for anchor
754
707
  $('head').append('<style>.dropdown-menu > .active > a { background-color: transparent !important; }</style>');
755
708
  // hover menu-item|menu-sub-item
@@ -778,40 +731,40 @@ j1.adapter['navigator'] = (function (j1, window) {
778
731
  $('head').append('<style>@media (min-width: ' +gridBreakpoint_lg+ ') { nav.navbar.navigator li.dropdown ul.dropdown-menu > li > a { color: ' +navMenuOptions.dropdown_item_color+ ' !important; font-size: ' +navMenuOptions.dropdown_font_size+ ' !important; font-weight: 400; } }</style>');
779
732
  $('head').append('<style>@media (min-width: ' +gridBreakpoint_lg+ ') { nav.navbar.navigator ul.dropdown-menu.megamenu-content .content ul.menu-col li a { color: ' +navMenuOptions.dropdown_item_color+ ' !important; font-size: ' +navMenuOptions.megamenu_font_size+ ' !important; font-weight: 400; } }</style>');
780
733
 
781
- {% comment %} navQuicklinks styles
782
- -------------------------------------------------------------------------- {% endcomment %}
734
+ // navQuicklinks styles
735
+ // -----------------------------------------------------------------------
783
736
 
784
- {% comment %} navTopSearch Styles
785
- -------------------------------------------------------------------------- {% endcomment %}
786
- // jadams, 2020-07-08: disabled because colors for icons set by the icon font settings
737
+ // navTopSearch Styles
738
+ // -----------------------------------------------------------------------
739
+ // jadams, 2020-07-08: disabled because colors for icons set by the icon font settings
787
740
  // $('head').append('<style>.top-search .input-group-addon { color: ' +navTopsearchOptions.input_color+ ' !important; }</style>');
788
741
  $('head').append('<style>.top-search { background-color: ' +navTopsearchOptions.background_color+ ' !important; }</style>');
789
742
  $('head').append('<style>.top-search input.form-control { color: ' +navTopsearchOptions.input_color+ ' !important; }</style>');
790
743
 
791
- {% comment %} Timeline styles
792
- -------------------------------------------------------------------------- {% endcomment %}
744
+ // Timeline styles
745
+ // -----------------------------------------------------------------------
793
746
  $('head').append('<style>.timeline > li > .timeline-panel:after {border-right-color: ' +bg_scrolled+ '; border-left-color: ' +bg_scrolled+ ';}</style>');
794
747
  $('head').append('<style>.tmicon {background: ' +bg_scrolled+ ';}</style>');
795
748
 
796
- {% comment %} Heading styles
797
- -------------------------------------------------------------------------- {% endcomment %}
749
+ // Heading styles
750
+ // -----------------------------------------------------------------------
798
751
  $('head').append('<style>.heading:after {background: ' +bg_scrolled+ ' !important;}</style>');
799
752
 
800
- {% comment %} Tag Cloud styles
801
- -------------------------------------------------------------------------- {% endcomment %}
753
+ // Tag Cloud styles
754
+ // -----------------------------------------------------------------------
802
755
  $('head').append('<style>.tag-cloud ul li a {background-color: ' +bg_scrolled+ ' !important;}</style>');
803
756
  // $('head').append('<style>.tag-cloud ul li a:hover {background-color: #212121 !important;}</style>');
804
757
 
805
- {% comment %} Toccer styles
806
- -------------------------------------------------------------------------- {% endcomment %}
758
+ // Toccer styles
759
+ // -----------------------------------------------------------------------
807
760
  $('head').append('<style>.is-active-link::before {background-color: ' +bg_scrolled+ ' !important;}</style>');
808
761
 
809
- {% comment %} BS extended Modal styles
810
- -------------------------------------------------------------------------- {% endcomment %}
762
+ // BS extended Modal styles
763
+ // -----------------------------------------------------------------------
811
764
  $('head').append('<style>.modal-dialog.modal-notify.modal-primary .modal-header {background-color: ' +bg_scrolled+ ';}</style>');
812
765
 
813
- {% comment %} BS nav|pills styles
814
- -------------------------------------------------------------------------- {% endcomment %}
766
+ // BS nav|pills styles
767
+ // -----------------------------------------------------------------------
815
768
  $('head').append('<style>.nav-pills .nav-link.active, .nav-pills .show > .nav-link {background-color: ' +bg_scrolled+ ' !important;}</style>');
816
769
 
817
770
  return true;
@@ -875,9 +828,13 @@ j1.adapter['navigator'] = (function (j1, window) {
875
828
  messageHandler: function (sender, message) {
876
829
  // var json_message = JSON.stringify(message, undefined, 2); // multiline
877
830
  var json_message = JSON.stringify(message);
831
+ _this.setState(message.action);
878
832
 
879
833
  logText = 'received message from ' + sender + ': ' + json_message;
880
- logger.debug(logText);
834
+ logger.info(logText);
835
+
836
+ logText = 'set state to: ' + message.action;
837
+ logger.info(logText);
881
838
 
882
839
  // -----------------------------------------------------------------------
883
840
  // Process commands|actions