From 3f5a72c289e6fd46b983cb62191faccd329a20d5 Mon Sep 17 00:00:00 2001 From: agusmakmun <summon.agus@gmail.com> Date: Fri, 22 Apr 2016 03:26:07 +0700 Subject: [PATCH] Fixing Match all strings input to lowercase --- static/js/super-search.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/super-search.js b/static/js/super-search.js index d3d7704..1476612 100644 --- a/static/js/super-search.js +++ b/static/js/super-search.js @@ -102,7 +102,7 @@ searchInputEl.addEventListener('input', function onInputChange() { var currentResultHash, d; - currentInputValue = searchInputEl.value; + currentInputValue = (searchInputEl.value + '').toLowerCase(); if (!currentInputValue || currentInputValue.length < 3) { lastSearchResultHash = ''; searchResultsEl.classList.add('is-hidden'); @@ -111,7 +111,7 @@ searchResultsEl.style.offsetWidth; var matchingPosts = posts.filter(function (post) { - if (post.title.indexOf(currentInputValue) !== -1 || post.description.indexOf(currentInputValue) !== -1) { + if ((post.title + '').toLowerCase().indexOf(currentInputValue) !== -1 || (post.description + '').toLowerCase().indexOf(currentInputValue) !== -1) { return true; } }); -- GitLab