1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-11-16 00:59:07 +02:00

Implement search logic

This commit is contained in:
nietonfir 2017-05-25 22:56:33 +02:00
parent ea951c0e51
commit 408b8e119a

View File

@ -424,9 +424,22 @@
{% capture allIconNames %}{{ allIconNames }}"{{ iconArray[1] }}"{% unless forloop.last %},{% endunless %}{% endcapture %} {% capture allIconNames %}{{ allIconNames }}"{{ iconArray[1] }}"{% unless forloop.last %},{% endunless %}{% endcapture %}
{% endfor %} {% endfor %}
<script type="text/javascript"> <script type="text/javascript">
(function() { (function(document) {
var icons = [{{ allIconNames }}]; 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> </script>
</body> </body>
</html> </html>