diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-01-30 18:27:20 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-01-30 18:27:20 +0100 |
commit | 6edf8919a7ea9718405d3ccd0fed2e93ce1e54cc (patch) | |
tree | c23422c676ce5d7f8017a4691c56e3467ca3adb6 /public/javascripts/search.js | |
parent | 344504782ac628b15229cafada34a9f32d595624 (diff) |
Refactor item to user
While item is technically more correct, I still prefer user as i think
it makes the code easier to understand.
Diffstat (limited to 'public/javascripts/search.js')
-rw-r--r-- | public/javascripts/search.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/public/javascripts/search.js b/public/javascripts/search.js index e6cf3a9..96413b0 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -13,25 +13,25 @@ self._nodes = { } self.submit = function () { - const selectedItem = autocomplete.getSelectedItem() - if (selectedItem == null) return + const selectedUser = autocomplete.getSelectedUser() + if (selectedUser == null) return - console.log(selectedItem) + console.log(selectedUser) self._nodes.input.blur() document.body.classList.remove('week-selector-not-visible') // Safari bug - self.emit('search', selectedItem) + self.emit('search', selectedUser) } -self.updateDom = function (selectedItem) { - if (selectedItem == null) { +self.updateDom = function (selectedUser) { + if (selectedUser == null) { self._nodes.input.value = '' autocomplete.removeAllItems() document.body.classList.add('no-input') document.body.classList.remove('searched') } else { - self._nodes.input.value = selectedItem.value + self._nodes.input.value = selectedUser.value autocomplete.removeAllItems() document.body.classList.remove('no-input') document.body.classList.add('searched') @@ -49,7 +49,7 @@ self._handleSubmit = function (event) { self._calculate = function (searchTerm) { const allResults = fuzzy.filter(searchTerm, USERS, { - extract: function (item) { return item.value } + extract: function (user) { return user.value } }) const firstResults = allResults.slice(0, 7) |