diff --git a/public/js/filter.js b/public/js/filter.js new file mode 100644 index 0000000..b95bd89 --- /dev/null +++ b/public/js/filter.js @@ -0,0 +1,20 @@ +function filter() { + var children = document.getElementsByClassName("content-grid")[0].children; + var input = document.getElementById("search-input").value.toUpperCase(); + + for (var index in children) { + var child = children[index]; + + if (child.children === undefined) { + break; + } + + var toolName = child.children[0].firstElementChild.innerText; + + if (toolName.toUpperCase().indexOf(input) > -1) { + child.style.display = ""; + } else { + child.style.display = "none"; + } + } +} diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index b719de5..43e2ecb 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -228,6 +228,11 @@ a, a:link, a:visited, a:active { padding: 0.5rem; border-bottom: 1px dashed #FFFFFF; } +.search-bar { + float: right; + margin: 0 0.5rem; + padding: 0.5rem; +} @media only screen and (min-width:640px) and (max-width:99999999px) { .content .random-tool { width: 300px; diff --git a/views/tools.ejs b/views/tools.ejs index f422726..1e01841 100644 --- a/views/tools.ejs +++ b/views/tools.ejs @@ -20,6 +20,7 @@ <% include _sidebar %>
+
<% _u.each(tools, function(tool) { %> <% include _tool %> @@ -40,6 +41,7 @@ gtag('config', 'UA-158624199-1'); +