Rely on fuzzy's case insensitivity, do not trim mode

This commit is contained in:
Jérémie Astori 2017-01-01 21:20:48 -05:00
parent 6a26014b81
commit cfa9da17a7

View File

@ -1068,7 +1068,7 @@ $(function() {
}); });
chat.on("input", ".search", function() { chat.on("input", ".search", function() {
const value = $(this).val().toLowerCase(); const value = $(this).val();
const names = $(this).closest(".users").find(".names"); const names = $(this).closest(".users").find(".names");
names.find(".user").each((i, el) => { names.find(".user").each((i, el) => {
@ -1078,7 +1078,7 @@ $(function() {
const fuzzyOptions = { const fuzzyOptions = {
pre: "<b>", pre: "<b>",
post: "</b>", post: "</b>",
extract: el => $(el).text().toLowerCase().replace(/[+%@~]/, "") extract: el => $(el).text()
}; };
fuzzy.filter( fuzzy.filter(
@ -1086,8 +1086,7 @@ $(function() {
names.find(".user").toArray(), names.find(".user").toArray(),
fuzzyOptions fuzzyOptions
).forEach(el => { ).forEach(el => {
const firstChar = $(el.original).text()[0].replace(/[^+%@~]/, ""); $(el.original).html(el.string).show();
$(el.original).html(firstChar + el.string).show();
}); });
}); });