assets/themes/j1/adapter/js/lunr.js in j1-template-2022.6.0 vs assets/themes/j1/adapter/js/lunr.js in j1-template-2022.6.1

- old
+ new

@@ -82,10 +82,11 @@ var environment = '{{environment}}'; var searchOptions = {}; var _this; var logger; var logText; + var modalBody; // --------------------------------------------------------------------------- // Helper functions // --------------------------------------------------------------------------- @@ -118,11 +119,11 @@ // ----------------------------------------------------------------------- /* eslint-disable */ searchOptions = $.extend({}, {{lunr_search_options | replace: '=>', ':' | replace: 'nil', '""'}}); // ----------------------------------------------------------------------- - // lunr_search initializer + // lunr initializer // ----------------------------------------------------------------------- var dependencies_met_j1_finished = setInterval(function() { if (j1.getState() == 'finished') { // initialize state flag @@ -147,9 +148,41 @@ }, 25); _this.eventHandler(); }, // END init + + // ------------------------------------------------------------------------- + // loadDialog (modal) + // ------------------------------------------------------------------------- + loadDialog: function () { + + logger.info('\n' + 'create|append search modal, id: ' + 'bratze'); + + _this.modal = document.createElement('div'); + _this.modal.id = "topInfoModalContainer"; + document.body.append(_this.modal); + + {% raw %} + _this.modalScript = document.createElement('script'); + _this.modalScript.type = 'text/mustache'; + _this.modalScript.id = 'search-results-template'; + _this.modalScript.text = '<ul style="list-style: none; margin-left: .5rem; margin-right: 4.25rem">' + '\n'; + _this.modalScript.text += '{{#docs}}' + '\n'; + _this.modalScript.text += ' <li>' + '\n'; + _this.modalScript.text += ' <h4 class="result-item"> <a class="link-no-decoration" href="{{url}}" target="_blank">{{title}} · {{tagline}}</a> </h4>' + '\n'; + _this.modalScript.text += ' <p class="result-item-text small text-muted mt-2 mb-0"> <i class="mdi mdi-calendar-blank mdi-18px mr-1"></i>{{displaydate}} </p>' + '\n'; + _this.modalScript.text += ' <p class="result-item-text">{{description}}</p>' + '\n'; + _this.modalScript.text += ' <i class="mdi mdi-tag-text-outline mdi-18px mr-1"></i><span class="sr-categories">{{#categories}} {{.}} · {{/categories}}</span>' + '\n'; + _this.modalScript.text += ' <i class="mdi mdi-tag mdi-18px mr-1 ml-2"></i><span class="sr-tags">{{#tags}} {{.}} · {{/tags}}</span>' + '\n'; + _this.modalScript.text += ' </p>' + '\n'; + _this.modalScript.text += ' </li>' + '\n'; + _this.modalScript.text += '{{/docs}}' + '\n'; + _this.modalScript.text += '<ul>' + '\n'; + {% endraw %} + document.body.append(_this.modalScript); + + }, // END loadDialog // ------------------------------------------------------------------------- // event handler // ------------------------------------------------------------------------- eventHandler: function () {