2020-04-22 19:07:51 +05:30
|
|
|
export default () => {
|
|
|
|
const highlightLineClass = 'hll';
|
|
|
|
const contentBody = document.getElementById('content-body');
|
|
|
|
const searchTerm = contentBody.querySelector('.js-search-input').value.toLowerCase();
|
|
|
|
const blobs = contentBody.querySelectorAll('.blob-result');
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
blobs.forEach((blob) => {
|
2020-04-22 19:07:51 +05:30
|
|
|
const lines = blob.querySelectorAll('.line');
|
2021-03-08 18:12:59 +05:30
|
|
|
lines.forEach((line) => {
|
2020-04-22 19:07:51 +05:30
|
|
|
if (line.textContent.toLowerCase().includes(searchTerm)) {
|
|
|
|
line.classList.add(highlightLineClass);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|