diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-06-13 20:32:21 +0300 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2018-06-13 20:32:21 +0300 |
commit | 76a3678e5305f7c88185665e074d4c206a7eeddc (patch) | |
tree | 2b7c02a3abbf4a177ccedcfcf838e1bc954649cb /js/navigate.js | |
parent | bb81f6ca842c532fec5a599fa567522b3c8bd584 (diff) |
cleaning
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'js/navigate.js')
-rw-r--r-- | js/navigate.js | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/js/navigate.js b/js/navigate.js index 0abff5f..961d665 100644 --- a/js/navigate.js +++ b/js/navigate.js @@ -58,18 +58,19 @@ Navigate.prototype = { elements.divHeader = $('#search_header'); box_elements.searchError = $('#search_error'); - fullTextSearch.setEntryTemplate($('#template_entry'), self); + // fullTextSearch.setEntryTemplate($('#template_entry'), self); fullTextSearch.setResultContainer(elements.search_result); - elements.search_input.on('input', function () { - self.resetSearch(); - if (elements.searchTimeout === null && self.initSearch()) { - elements.searchTimeout = _.delay(function () { - self.initSearch(); - elements.searchTimeout = null; - }, 3000); - } - }); + elements.search_input.on('input', this.navigateTimedSearch); + // function () { + // self.resetSearch(); + // if (elements.searchTimeout === null && self.initSearch()) { + // elements.searchTimeout = _.delay(function () { + // self.initSearch(); + // elements.searchTimeout = null; + // }, 3000); + // } + // }); // // $(document).keypress(function (e) { @@ -82,6 +83,24 @@ Navigate.prototype = { }, + navigateTimedSearch: function () { + + if (curr.lastSearchTimer !== null) { + window.clearTimeout(curr.lastSearchTimer); + } + + curr.lastSearchTimer = window.setTimeout(function () { + OCA.FullTextSearch.navigate.initSearch(); + }, settings.searchEntryTimer); + + if (curr.lastRequestTimer === null) { + curr.lastRequestTimer = window.setTimeout(function () { + OCA.FullTextSearch.navigate.initSearch(); + }, settings.searchRequestTimer); + } + }, + + initPanels: function () { var self = this; @@ -484,11 +503,11 @@ Navigate.prototype = { }; -OCA.FullTextSearch.Example = Navigate; +OCA.FullTextSearch.Navigate = Navigate; $(document).ready(function () { - OCA.FullTextSearch.example = new Navigate(); + OCA.FullTextSearch.navigate = new Navigate(); }); |