simple tag search with js/css
This commit is contained in:
parent
cd09c12826
commit
f8560eddd9
@ -180,9 +180,9 @@ div.maincontent{
|
|||||||
margin: 1px;
|
margin: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tags .searched {
|
.searched {
|
||||||
background: #fff600;
|
background: #fff600 !important;
|
||||||
color: black;
|
color: black !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tooltip .tooltiptext {
|
.tooltip .tooltiptext {
|
||||||
|
@ -64,5 +64,20 @@ searchInput.addEventListener('keyup', function (e) {
|
|||||||
// Make a new timeout set to go off in 1000ms (1 second)
|
// Make a new timeout set to go off in 1000ms (1 second)
|
||||||
timeout = setTimeout(function () {
|
timeout = setTimeout(function () {
|
||||||
console.log('Input Value:', searchInput.value);
|
console.log('Input Value:', searchInput.value);
|
||||||
|
searchTags(searchInput.value);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function searchTags(searchInput) {
|
||||||
|
var tag_ele = document.getElementsByClassName('tags');
|
||||||
|
for (var i = 0; i < tag_ele.length; ++i) {
|
||||||
|
let searchText = searchInput.toLowerCase();
|
||||||
|
let tagtext = tag_ele[i].innerText.toLowerCase();
|
||||||
|
if(searchText.includes(tagtext) || tagtext.includes(searchText)) {
|
||||||
|
addClass(tag_ele[i], "searched");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
removeClass(tag_ele[i], "searched");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user