regenerate: true


{% capture cache %}

{% comment %}

# -----------------------------------------------------------------------------
#  ~/assets/themes/j1/core/js/adapter/switcher.js
#  Liquid template to create the Template Adapter for J1 (Theme) Switcher
#
#  Product/Info:
#  https://jekyll.one
#
#  Copyright (C) 2019 Juergen Adams
#
#  J1 Template is licensed under the MIT License.
#  For details, see https://jekyll.one
#
# -----------------------------------------------------------------------------
# Test data:
#  {{ config | debug }}
# -----------------------------------------------------------------------------

{% endcomment %}

/*

# -----------------------------------------------------------------------------
#  ~/assets/themes/j1/core/js/adapter/switcher.js
#  JS Adapter for J1 Switcher (BS Theme Switcher)
#
#  Product/Info:
#  https://jekyll.one
#  https://github.com/jguadagno/bootstrapThemeSwitcher
#
#  Copyright (C) 2019 Juergen Adams
#  Copyright (C) 2014 Joseph Guadagno
#
#  J1 Template is licensed under the MIT License.
#  For details, see https://jekyll.one
#  BS Theme Switcher is licensed under the MIT License.
#  For details, see https://github.com/jguadagno/bootstrapThemeSwitcher/blob/master/LICENSE
#
# -----------------------------------------------------------------------------
#  Adapter generated: {{site.time}}
# -----------------------------------------------------------------------------

*/ 'use strict';

{% assign config = site.data.modules.j1_theme_switcher %}

j1.Switcher = (function (j1, window) {

var environment = '{{environment}}'; // Set environment
var state       = 'not_started';
var logger;
var logText;

return {

  // Initialize
  init: function () {
    // Setup logger
    logger = log4javascript.getLogger("j1.ThemeSwitcher");
    state = 'started';
    logger.info('state: ' + state); // Set|Log status
    logger.info("ThemeSwitcher being initialized");

    //$().bootstrapThemeSwitcher.defaults = {
    $('#ThemeList').bootstrapThemeSwitcher.defaults = {
      debug:                    {{ config.debug | json }},
      cssThemeLink:             {{ config.cssThemeLink | json }},
      saveToCookie:             {{ config.saveToCookie | json }},
      cookieThemeName:          {{ config.cookieThemeName | json }},
      cookieDefaultThemeName:   {{ config.cookieDefaultThemeName | json }},
      cookieThemeCss:           {{ config.cookieThemeCss | json }},
      cookieThemeExtensionCss:  {{ config.cookieThemeExtensionCss | json }},
      cookieExpiration:         {{ config.cookieExpiration | json }},
      cookiePath:               {{ config.cookiePath | json }},
      defaultCssFile:           {{ config.defaultCssFile | json }},
      bootswatchApiUrl:         {{ config.bootswatchApiUrl | json }},
      bootswatchApiVersion:     {{ config.bootswatchApiVersion | json }},
      loadFromBootswatch:       {{ config.loadFromBootswatch | json }},
      localFeed:                {{ config.localFeed | json }},
      excludeBootswatch:        {{ config.excludeBootswatch | json }},
      includeBootswatch:        {{ config.includeBootswatch | json }},
      skipIncludeBootswatch:    {{ config.skipIncludeBootswatch | json }},
      hideOnReload:             {{ config.hideOnReload | json }},
    };

/*

// Setup theme selectors moved to j1_adapter_navigator.js
// at callback for loading the menu bar
$('#ThemeList').bootstrapThemeSwitcher({localFeed: ''}); // Load from Bootswatch API
$('#ThemeSelect').bootstrapThemeSwitcher();              // Load from localFeed

*/

    state = 'finished';
    logger.info('state: ' + state); // Set|Log status
    logger.info("J1 Theme Switcher initialized successfully");

    return true;
  }, // END init

  // -------------------------------------------------------------------------
  //  returns the current (processing) state of the module
  // -------------------------------------------------------------------------
  state: function () {
    return state;
  } // END state

}; // END return

})(j1, window);

{% endcapture %}

{{ cache | strip_empty_lines }} {% assign cache = nil %}