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 that = this
|
||||||
let id = $(this).closest('.list-item').data('id')
|
let id = $(this).closest('.list-item').data('id')
|
||||||
editor.update(id, function (item, prev, next) {
|
editor.update(id, function (item, prev, next) {
|
||||||
|
@ -465,11 +468,7 @@ if (holder) {
|
||||||
let timeout = null;
|
let timeout = null;
|
||||||
let searchInput = document.getElementById('search-input');
|
let searchInput = document.getElementById('search-input');
|
||||||
search(searchInput).then(searcher => {
|
search(searchInput).then(searcher => {
|
||||||
|
let showSearch = _.debounce(function (searcher) {
|
||||||
$(document).on('keyup', '#search-input', function (event) {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
|
|
||||||
timeout = setTimeout(function () {
|
|
||||||
let query = $(searchInput).val()
|
let query = $(searchInput).val()
|
||||||
if (query === '') {
|
if (query === '') {
|
||||||
let autocomplete = document.getElementById('autocomplete');
|
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')
|
showSearchResultsExtended('#autocomplete', 'result-template', query => searcher.search(query), query, searchInput, query, 'search-result')
|
||||||
|
return true;
|
||||||
// $('#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;
|
|
||||||
}, 200)
|
}, 200)
|
||||||
|
|
||||||
|
$(searchInput).on('keyup', function (event) {
|
||||||
|
showSearch.cancel()
|
||||||
|
showSearch(searcher)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user