regenerate: true


{% capture cache %}

{% comment %}

# -----------------------------------------------------------------------------
#  ~/assets/themes/j1/core/js/adapter/searcher.js
#  Liquid template to create the Template Adapter for J1 Searcher
#
#  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:
#  {{ liquid_var | debug }}
#
# -----------------------------------------------------------------------------

{% endcomment %}

/*

# -----------------------------------------------------------------------------
#  ~/assets/themes/j1/core/js/adapter/searcher.js
#  JS Adapter for J1 Searcher (SimpleJekyllSearch)
#
#  Product/Info:
#  https://jekyll.one
#  https://github.com/christian-fei/Simple-Jekyll-Search
#
#  Copyright (C) 2019 Juergen Adams
#  Copyright (C) 2015 Christian Fei
#
#  J1 Template is licensed under the MIT License.
#  For details, see https://jekyll.one
#  SimpleJekyllSearch is licensed under the MIT License.
#  For details, see https://github.com/christian-fei/Simple-Jekyll-Search
#
# -----------------------------------------------------------------------------
#  Adapter generated: {{site.time}}
# -----------------------------------------------------------------------------

*/ 'use strict';

{% comment %} Variables ——————————————————————————– {% endcomment %}

{% assign environment = site.environment %} {% assign config = site.data.modules.j1_jekyll_search %}

{% comment %} Main ——————————————————————————– {% endcomment %}

{% if config.enabled %}

j1.Searcher = (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.QuickSearch.adapter");
    logger.info("Jekyll Search is being initialized");
    state = 'started';
    logger.info('state: ' + state); // Set|Log status

    var jekyllSearch = SimpleJekyllSearch({
      searchInput:            document.getElementById( {{config.search_input | json }} ),
      resultsOutput:          document.getElementById( {{config.results_output | json }} ),
      resultsContainer:       document.getElementById( {{config.results_container | json }} ),
      json:                   {{config.index_data | json }},
      searchResultTemplate:   {{config.result_template | json }},
      limit:                  {{config.result_limit | json }},
      minSearchItemLen:       {{config.min_search_item_len | json }},
      fuzzy:                  {{config.search_fuzzy | json }},
      exclude:                [ {{config.search_exlude| json }} ],
      noResultsText:          {{quick_search_quick_search_config.no_results_text | json }}
    });

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

    return true;
  }, // END init

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

}; // END return

})(j1, window);

{% endif %}

{% endcapture %}

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