mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-06-19 23:30:35 +00:00
search: open expand if it contains search term #80
This commit is contained in:
parent
1c6d9538a3
commit
d53fc18c2b
3 changed files with 51 additions and 10 deletions
static/js
|
@ -276,18 +276,22 @@ jQuery(function() {
|
|||
$('ul.topics').removeClass('searched');
|
||||
items.css('display', 'block');
|
||||
sessionStorage.removeItem('search-value');
|
||||
$("mark").parents(".expand-marked").removeClass("expand-marked");
|
||||
$(".highlightable").unhighlight({ element: 'mark' })
|
||||
return;
|
||||
}
|
||||
|
||||
sessionStorage.setItem('search-value', value);
|
||||
$("mark").parents(".expand-marked").removeClass("expand-marked");
|
||||
$(".highlightable").unhighlight({ element: 'mark' }).highlight(value, { element: 'mark' });
|
||||
$("mark").parents(".expand").addClass("expand-marked");
|
||||
|
||||
if (ajax && ajax.abort) ajax.abort();
|
||||
|
||||
jQuery('[data-search-clear]').on('click', function() {
|
||||
jQuery('[data-search-input]').val('').trigger('input');
|
||||
sessionStorage.removeItem('search-input');
|
||||
$("mark").parents(".expand-marked").removeClass("expand-marked");
|
||||
$(".highlightable").unhighlight({ element: 'mark' })
|
||||
});
|
||||
});
|
||||
|
@ -314,6 +318,7 @@ jQuery(function() {
|
|||
}
|
||||
|
||||
$(".highlightable").highlight(sessionStorage.getItem('search-value'), { element: 'mark' });
|
||||
$("mark").parents(".expand").addClass("expand-marked");
|
||||
|
||||
// clipboard
|
||||
var clipInit = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue