From 16268c12024813b338993d415dfb6fd4b478601b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Fri, 11 May 2018 11:48:24 +0200 Subject: [PATCH] Fixed issue where find-function says it found one element when it didnt --- server/public/assets/js/listeners.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/public/assets/js/listeners.js b/server/public/assets/js/listeners.js index cc27c6cf..3a99d44d 100755 --- a/server/public/assets/js/listeners.js +++ b/server/public/assets/js/listeners.js @@ -1559,8 +1559,14 @@ addListener("submit", "#find_form", function(event){ } } - document.getElementById("num_found").innerText = found_array_index + 1; - document.getElementById("of_total_found").innerText = found_array.length; + if(found_array.length == 0) { + document.getElementById("num_found").innerText = 0; + document.getElementById("of_total_found").innerText = found_array.length; + } else { + document.getElementById("num_found").innerText = found_array_index + 1; + document.getElementById("of_total_found").innerText = found_array.length; + } + if(found_array.length > 0 && found_array[found_array_index] != full_playlist.length - 1){ Helper.removeClass(".highlight", "highlight"); var jump_to_page = Math.floor(found_array[found_array_index] / List.can_fit);