mirror of
https://github.com/simple-icons/simple-icons.git
synced 2024-12-16 01:10:30 +02:00
Implement search logic
This commit is contained in:
parent
ea951c0e51
commit
408b8e119a
19
index.html
19
index.html
@ -424,9 +424,22 @@
|
||||
{% capture allIconNames %}{{ allIconNames }}"{{ iconArray[1] }}"{% unless forloop.last %},{% endunless %}{% endcapture %}
|
||||
{% endfor %}
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var icons = [{{ allIconNames }}];
|
||||
})();
|
||||
(function(document) {
|
||||
var icons = [{{ allIconNames }}],
|
||||
$icons = document.querySelectorAll('.grid > .grid-item:not(.grid-item--ad)');
|
||||
|
||||
function search(value) {
|
||||
value = value.toLowerCase();
|
||||
|
||||
icons.forEach(function(e, i) {
|
||||
if (e.indexOf(value) > -1) {
|
||||
$icons[i].classList.remove('hidden');
|
||||
} else {
|
||||
$icons[i].classList.add('hidden');
|
||||
}
|
||||
})
|
||||
};
|
||||
})( document );
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user