Provide the searchTerm as argument to doSearch function
This commit is contained in:
@@ -42,12 +42,11 @@ $(function () {
|
|||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSearch() {
|
function doSearch(searchTerm) {
|
||||||
var value = $(this).val();
|
|
||||||
var $el = $('.navigation');
|
var $el = $('.navigation');
|
||||||
|
|
||||||
if (value && value.length > 1) {
|
if (searchTerm.length > 1) {
|
||||||
var regexp = new RegExp(value, 'i');
|
var regexp = new RegExp(searchTerm, 'i');
|
||||||
$el.find('li, .member-list').hide();
|
$el.find('li, .member-list').hide();
|
||||||
|
|
||||||
$el.find('li').each(function (i, v) {
|
$el.find('li').each(function (i, v) {
|
||||||
@@ -61,7 +60,7 @@ $(function () {
|
|||||||
// Do the weight thing
|
// Do the weight thing
|
||||||
$classEntry.removeData('weight');
|
$classEntry.removeData('weight');
|
||||||
$classEntry.show();
|
$classEntry.show();
|
||||||
const weight = getSearchWeight(value, $classEntry);
|
const weight = getSearchWeight(searchTerm, $classEntry);
|
||||||
$classEntry.data('weight', weight);
|
$classEntry.data('weight', weight);
|
||||||
|
|
||||||
$members.show();
|
$members.show();
|
||||||
@@ -89,7 +88,7 @@ $(function () {
|
|||||||
function queueSearch() {
|
function queueSearch() {
|
||||||
if (!key) {
|
if (!key) {
|
||||||
key = setTimeout(function () {
|
key = setTimeout(function () {
|
||||||
doSearch.call(searchInput);
|
doSearch(searchInput.value);
|
||||||
key = undefined;
|
key = undefined;
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user