aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/main.js')
-rw-r--r--public/javascripts/main.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js
index 37e9677..55bf054 100644
--- a/public/javascripts/main.js
+++ b/public/javascripts/main.js
@@ -29,7 +29,7 @@ if (window.location.href.split('?')[1] !== 'nfd') { // nfd = no feature detectio
let selectedResult = -1
let selectedUser
-let results
+let results = []
let offset = 0
function getUsers () {
@@ -88,7 +88,7 @@ function updateWeekText () {
updateWeekText()
searchNode.addEventListener('keydown', function (e) {
- if (results && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
+ if ((results.length !== 0) && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
e.preventDefault()
if (document.querySelector('.selected')) document.querySelector('.selected').classList.remove('selected')
@@ -122,7 +122,7 @@ searchNode.addEventListener('submit', submitForm)
function submitForm (e) {
if (e) e.preventDefault()
- if (results != null) {
+ if (results.length !== 0) {
const indexInResult = selectedResult === -1 ? 0 : selectedResult
selectedUser = users[results[indexInResult].index]
}