From 8c3429b67cf1be6e329ee2638131c4218f288dfa Mon Sep 17 00:00:00 2001 From: KatieFrogs <23621460+KatieFrogs@users.noreply.github.com> Date: Mon, 28 Feb 2022 02:51:51 +0300 Subject: [PATCH] Move the highlighted range --- public/src/js/songselect.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 3a2427e..f12d68b 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -3059,9 +3059,12 @@ class SongSelect{ a[0].ranges = this.indexesToRanges(a[0].indexes) if(a[0].indexes.length > 1){ if(a[0].ranges.length > a[0].indexes.length / 2){ - if(a[0].target.indexOf(query) === -1){ + var index = a[0].target.indexOf(query) + if(index === -1){ score0 = -Infinity a[0].ranges = null + }else{ + a[0].ranges = [[index, index + query.length - 1]] } }else if(a[0].ranges.length !== 1){ score0 -= 9000 @@ -3073,9 +3076,12 @@ class SongSelect{ a[1].ranges = this.indexesToRanges(a[1].indexes) if(a[1].indexes.length > 1){ if(a[1].ranges.length > a[1].indexes.length / 2){ - if(a[1].target.indexOf(query) === -1){ + var index = a[1].target.indexOf(query) + if(index === -1){ score1 = -Infinity a[1].ranges = null + }else{ + a[1].ranges = [[index, index + query.length - 1]] } }else if(a[1].ranges.length !== 1){ score1 -= 9000