Skip to content

Commit

Permalink
Merge pull request #14 from yohman/main
Browse files Browse the repository at this point in the history
search box add
  • Loading branch information
yohman authored Jul 3, 2024
2 parents 927124c + 64be410 commit f82ea79
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ body, html {
/*overflow: hidden; /* Remove comment to hide overflow */
}

.search {
border: 1px solid #aaa;
padding: 5px;
}

.md-header__button.md-logo img, .md-header__button.md-logo svg {
height: 2.5rem;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
width: 320px;
height: 400px;
background-color: red;
/* cursor: pointer; */
cursor: pointer;
}

.door::before {
Expand Down
22 changes: 22 additions & 0 deletions docs/learn/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ hide:
---

<h1 id="title">Learn</h1>

<!-- add a search box -->
<input type="text" id="search" class="search" onkeyup="search()" placeholder="Search for projects..">

<!-- two buttons to toggle between gallery view and tag view -->
<span class="btn btn-on" onclick="window.location.href = '../'">
gallery view
Expand Down Expand Up @@ -50,6 +54,24 @@ function init(){
});
}

// create the search function
window.search = function() {
let input, filter, ul, li, a, i, txtValue;
input = document.getElementById('search');
filter = input.value.toUpperCase();
li = document.querySelectorAll('.gallery-container');
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName('a')[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = '';
} else {
li[i].style.display = 'none';
}
}
}


}

</script>
22 changes: 22 additions & 0 deletions docs/work/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ hide:
---

<h1 id="title">Work</h1>

<!-- add a search box -->
<input type="text" id="search" class="search" onkeyup="search()" placeholder="Search for projects..">

<!-- two buttons to toggle between gallery view and tag view -->
<span class="btn btn-on" onclick="window.location.href = '../'">
gallery view
Expand Down Expand Up @@ -49,6 +53,24 @@ function init(){
});
}

// create the search function
window.search = function() {
let input, filter, ul, li, a, i, txtValue;
input = document.getElementById('search');
filter = input.value.toUpperCase();
li = document.querySelectorAll('.gallery-container');
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName('a')[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = '';
} else {
li[i].style.display = 'none';
}
}
}


}

</script>
5 changes: 5 additions & 0 deletions site/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ body, html {
/*overflow: hidden; /* Remove comment to hide overflow */
}

.search {
border: 1px solid #aaa;
padding: 5px;
}

.md-header__button.md-logo img, .md-header__button.md-logo svg {
height: 2.5rem;
}
Expand Down
2 changes: 1 addition & 1 deletion site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
width: 320px;
height: 400px;
background-color: red;
/* cursor: pointer; */
cursor: pointer;
}

.door::before {
Expand Down
21 changes: 21 additions & 0 deletions site/learn/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@


<h1 id="title">Learn</h1>

<!-- add a search box -->
<p><input type="text" id="search" class="search" onkeyup="search()" placeholder="Search for projects.."></p>
<!-- two buttons to toggle between gallery view and tag view -->
<p><span class="btn btn-on" onclick="window.location.href = '../'">
gallery view
Expand Down Expand Up @@ -498,6 +501,24 @@ <h1 id="title">Learn</h1>
});
}

// create the search function
window.search = function() {
let input, filter, ul, li, a, i, txtValue;
input = document.getElementById('search');
filter = input.value.toUpperCase();
li = document.querySelectorAll('.gallery-container');
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName('a')[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = '';
} else {
li[i].style.display = 'none';
}
}
}


}

</script>
Expand Down
Binary file modified site/sitemap.xml.gz
Binary file not shown.
21 changes: 21 additions & 0 deletions site/work/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@


<h1 id="title">Work</h1>

<!-- add a search box -->
<p><input type="text" id="search" class="search" onkeyup="search()" placeholder="Search for projects.."></p>
<!-- two buttons to toggle between gallery view and tag view -->
<p><span class="btn btn-on" onclick="window.location.href = '../'">
gallery view
Expand Down Expand Up @@ -496,6 +499,24 @@ <h1 id="title">Work</h1>
});
}

// create the search function
window.search = function() {
let input, filter, ul, li, a, i, txtValue;
input = document.getElementById('search');
filter = input.value.toUpperCase();
li = document.querySelectorAll('.gallery-container');
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName('a')[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = '';
} else {
li[i].style.display = 'none';
}
}
}


}

</script>
Expand Down

0 comments on commit f82ea79

Please sign in to comment.