|
|
|
@ -118,25 +118,25 @@ define('forum/search', ['search', 'autocomplete'], function(searchModule, autoco
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
var regexStr = searchQuery.replace(/^"/, '').replace(/"$/, '').trim().split(' ').join('|');
|
|
|
|
|
var regex = new RegExp('(' + regexStr + ')', 'gi');
|
|
|
|
|
|
|
|
|
|
$('.search-result-text').each(function() {
|
|
|
|
|
var result = $(this);
|
|
|
|
|
var regexStr = searchQuery.replace(/^"/, '').replace(/"$/, '').trim().split(' ').join('|');
|
|
|
|
|
var regex = new RegExp('(' + regexStr + ')', 'gi');
|
|
|
|
|
|
|
|
|
|
var text = result.html().replace(regex, '<strong>$1</strong>');
|
|
|
|
|
result.html(text).find('img:not(.not-responsive)').addClass('img-responsive').each(function() {
|
|
|
|
|
$(this).attr('src', $(this).attr('src').replace(/<strong>([\s\S]*?)<\/strong>/gi, '$1'));
|
|
|
|
|
});
|
|
|
|
|
$('.search-result-text p, .search-result-text h4').each(function() {
|
|
|
|
|
var result = $(this), nested = [];
|
|
|
|
|
|
|
|
|
|
result.find('a').each(function() {
|
|
|
|
|
$(this).attr('href', $(this).attr('href').replace(/<strong>([\s\S]*?)<\/strong>/gi, '$1'));
|
|
|
|
|
});
|
|
|
|
|
result.find('*').each(function() {
|
|
|
|
|
$(this).after('<!-- ' + nested.length + ' -->');
|
|
|
|
|
nested.push($('<div />').append($(this)));
|
|
|
|
|
});
|
|
|
|
|
} catch(e) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.html(result.html().replace(regex, '<strong>$1</strong>'));
|
|
|
|
|
|
|
|
|
|
for (var i = 0, ii = nested.length; i < ii; i++) {
|
|
|
|
|
result.html(result.html().replace('<!-- ' + i + ' -->', nested[i].html()));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.search-result-text').find('img:not(.not-responsive)').addClass('img-responsive');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleSavePreferences() {
|
|
|
|
|