handle quoted strings

v1.18.x
Barış Soner Uşaklı 6 years ago
parent b8c08a5417
commit 5c48793543

@ -136,9 +136,8 @@ define('forum/search', ['search', 'autocomplete', 'storage'], function (searchMo
if (!searchQuery) { if (!searchQuery) {
return; return;
} }
searchQuery = utils.escapeHTML(searchQuery); searchQuery = utils.escapeHTML(searchQuery.replace(/^"/, '').replace(/"$/, '').trim());
var regexStr = searchQuery.replace(/^"/, '').replace(/"$/, '').trim().split(' ') var regexStr = searchQuery.split(' ').join('|');
.join('|');
var regex = new RegExp('(' + regexStr + ')', 'gi'); var regex = new RegExp('(' + regexStr + ')', 'gi');
$('.search-result-text p, .search-result-text h4').each(function () { $('.search-result-text p, .search-result-text h4').each(function () {
@ -151,7 +150,7 @@ define('forum/search', ['search', 'autocomplete', 'storage'], function (searchMo
}); });
result.html(result.html().replace(regex, function (match, p1) { result.html(result.html().replace(regex, function (match, p1) {
return '<strong>' + p1 + '</strong>'; return '<strong class="search-match">' + p1 + '</strong>';
})); }));
nested.forEach(function (nestedEl, i) { nested.forEach(function (nestedEl, i) {

Loading…
Cancel
Save