Clean up search
This commit is contained in:
parent
55ad112924
commit
db121b4fa3
|
@ -234,9 +234,12 @@ if (holder) {
|
|||
}
|
||||
}
|
||||
|
||||
let editor = listEditor(holder, JSON.parse(holder.dataset.input), options);
|
||||
let inputData = JSON.parse(holder.dataset.input)
|
||||
|
||||
$(document).on('click', '.content input[type="checkbox"]', function (event) {
|
||||
let editor = listEditor(holder, inputData, options);
|
||||
holder.$listEditor = editor
|
||||
|
||||
$(holder).on('click', '.content input[type="checkbox"]', function (event) {
|
||||
let that = this
|
||||
let id = $(this).closest('.list-item').data('id')
|
||||
editor.update(id, function (item, prev, next) {
|
||||
|
@ -465,11 +468,7 @@ if (holder) {
|
|||
let timeout = null;
|
||||
let searchInput = document.getElementById('search-input');
|
||||
search(searchInput).then(searcher => {
|
||||
|
||||
$(document).on('keyup', '#search-input', function (event) {
|
||||
clearTimeout(timeout);
|
||||
|
||||
timeout = setTimeout(function () {
|
||||
let showSearch = _.debounce(function (searcher) {
|
||||
let query = $(searchInput).val()
|
||||
if (query === '') {
|
||||
let autocomplete = document.getElementById('autocomplete');
|
||||
|
@ -478,16 +477,12 @@ search(searchInput).then(searcher => {
|
|||
}
|
||||
|
||||
showSearchResultsExtended('#autocomplete', 'result-template', query => searcher.search(query), query, searchInput, query, 'search-result')
|
||||
|
||||
// $('#autocomplete').show()
|
||||
// let result = searcher.search(query)
|
||||
// const newpage = query.replace(/\s+/g, '_')
|
||||
// var template = document.getElementById('result-template').innerHTML;
|
||||
// var rendered = Mustache.render(template, {page: newpage, results: result}, {}, ['[[', ']]']);
|
||||
// let autocomplete = document.getElementById('autocomplete');
|
||||
// autocomplete.innerHTML = rendered;
|
||||
return true;
|
||||
}, 200)
|
||||
|
||||
$(searchInput).on('keyup', function (event) {
|
||||
showSearch.cancel()
|
||||
showSearch(searcher)
|
||||
return true
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user