Skip to content

Commit 7353cbb

Browse files
committed
custom.js: Factorize
1 parent ea191e5 commit 7353cbb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/js/custom.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,18 @@ $(document).ready(function() {
148148
$('.algolia-docsearch-suggestion--wrapper').each((index, element) => {
149149
const title = $(element).find('.algolia-docsearch-suggestion--title');
150150
const category = $(element).find('.algolia-docsearch-suggestion--subcategory-column-text');
151-
category.append('<span class="aa-suggestion-title-separator" aria-hidden="true"> › </span>');
151+
const separatorText = '›';
152+
const separatorHtml = '<span class="aa-suggestion-title-separator" aria-hidden="true"> '+separatorText+' </span>';
153+
category.append(separatorHtml);
152154
if (title.find('.aa-suggestion-title-separator').length) {
153155
$.each(title.contents(), (i, e) => {
154156
if (title.contents().length > 1) {
155157
$(e).appendTo(category);
156158
}
157159
});
158160
}
159-
if ('›' != category.text().trim().slice(-1)) {
160-
category.append('<span class="aa-suggestion-title-separator" aria-hidden="true"> › </span>');
161+
if (separatorText != category.text().trim().slice(-1)) {
162+
category.append(separatorHtml);
161163
}
162164
const displayedText = $(element).find('.algolia-docsearch-suggestion--text');
163165
if (displayedText.length && displayedText.text() == searchedText+'…') {

0 commit comments

Comments
 (0)