Removes search functionality (browser in-page search is sufficient)

This commit is contained in:
Dan Leech 2017-01-11 13:12:40 +00:00
parent f41920c8cb
commit 198027d359
3 changed files with 1 additions and 53 deletions

View file

@ -95,11 +95,7 @@ for (var i = 0; i < source.icons.length; i++) {
filePath = "../icons/" + fileName + ".svg";
var fs = require('fs');
var svg = fs.readFileSync(filePath, 'utf8');
var searchTerms = source.icons[i].title.toLowerCase() + " " + source.icons[i].hex.toLowerCase();
if (source.icons[i].title.toLowerCase() != fileName.toLowerCase()) {
searchTerms = searchTerms + " " + fileName.toLowerCase();
}
main += "\n <li class=\"tiles__item\" data-search=\"" + searchTerms + "\" style=\"background-color:#" + source.icons[i].hex + "\"><a href=\"https://simpleicons.org/icons/" + fileName + ".svg\" class=\"icon--link\" title=\"" + source.icons[i].title + "\">" + svg + "<span class=\"tile-name\">" + source.icons[i].title + "</span></a>" + "<span class=\"hex\">#" + source.icons[i].hex + "</span></li>";
main += "\n <li class=\"tiles__item\" style=\"background-color:#" + source.icons[i].hex + "\"><a href=\"https://simpleicons.org/icons/" + fileName + ".svg\" class=\"icon--link\" title=\"" + source.icons[i].title + "\">" + svg + "<span class=\"tile-name\">" + source.icons[i].title + "</span></a>" + "<span class=\"hex\">#" + source.icons[i].hex + "</span></li>";
}
// Put all content together and export to index.html

View file

@ -2,34 +2,6 @@
</ul>
</main>
<script>
var searchField = document.getElementById("search");
searchField.addEventListener('input', function (evt) {
search();
});
hashSearch();
window.addEventListener('hashchange', function (evt) {
hashSearch();
});
function hashSearch() {
var query = window.location.hash.substring(1);
document.getElementById("search").value = query;
search();
}
function search() {
var searchTerm = searchField.value.toLowerCase();
var icons = document.getElementsByClassName("tiles__item");
for (var i = 0; i < icons.length; i++) {
icons[i].style.display = "inline-block";
var index = icons[i].dataset.search.indexOf(searchTerm);
if (index == -1) {
icons[i].style.display = "none";
}
}
}
function toggleNames() {
var list = document.getElementsByClassName("tiles tiles--icons");
if(list.length == 1) {

View file

@ -89,25 +89,6 @@
.button--secondary:focus, .button--secondary:hover {
background-color: #00B0FF;
}
.search-field {
-webkit-appearance: none;
background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTYgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS1taXRlcmxpbWl0PSIxLjQxNCI+PHBhdGggZD0iTTE1LjY4NSAxNC4xODNMMTEuNjIgMTAuMWMuNzUtMS4wNSAxLjE4Mi0yLjMxNyAxLjE4Mi0zLjcgMC0zLjUzMy0yLjg2Ny02LjQtNi40LTYuNC0zLjUzMyAwLTYuNCAyLjg2Ny02LjQgNi40IDAgMy41MzMgMi44NjcgNi40IDYuNCA2LjQgMS4zODMgMCAyLjY1LS40MzMgMy43LTEuMTgzbDQuMDgzIDQuMDY2Yy4yLjIxNy40ODQuMzE3Ljc1LjMxNy4yNjcgMCAuNTUtLjEuNzUtLjMxNy40MTctLjQxNi40MTctMS4wODMgMC0xLjV6bS05LjI4My0yLjc2NmMtMi43NjcgMC01LjAxNy0yLjI1LTUuMDE3LTUuMDE3IDAtMi43NjcgMi4yNS01LjAxNyA1LjAxNy01LjAxNyAyLjc2NyAwIDUuMDE3IDIuMjUgNS4wMTcgNS4wMTcgMCAyLjc2Ny0yLjI1IDUuMDE3LTUuMDE4IDUuMDE3eiIgZmlsbD0iI2QxZDFkMSIgZmlsbC1ydWxlPSJub256ZXJvIi8+PC9zdmc+);
background-position: 0.25rem center;
background-repeat: no-repeat;
background-size: 1rem 1rem;
border: none;
border-bottom: 1px solid #EEE;
box-sizing: border-box;
color: #BDBDBD;
display: block;
font-family: inherit;
font-size: 1rem;
line-height: 1rem;
margin: 1.5rem 0;
outline: 0;
padding: 0.375rem 0.375rem 0.375rem 1.5rem;
width: 100%;
}
.site-main {
width: 100%;
}
@ -275,7 +256,6 @@
<header class="navbar" role="banner">
<div class="block">
<h1 class="title">Simple Icons</h1>
<input type="text" id="search" class="search-field" autofocus>
<p><strong>SVG icons for popular brands.</strong> This project is maintained by <a href="https://twitter.com/bathtype">Dan Leech</a>. Contributions, corrections &amp; requests can be left on <a href="https://github.com/danleech/simple-icons">GitHub</a>. Company logos in icons are copyright of their respective owners.</p>
<p>
<a href="https://github.com/danleech/simple-icons/tree/gh-pages/icons" class="button button--primary">Download</a>