diff --git a/collections.html b/collections.html index 2dc28bf0..4d4e1dc9 100644 --- a/collections.html +++ b/collections.html @@ -19,7 +19,6 @@

Collections

-

@@ -42,24 +41,4 @@

Collections

{% endfor %} - \ No newline at end of file + diff --git a/features.html b/features.html index 9e87fe4f..fb1219cc 100644 --- a/features.html +++ b/features.html @@ -35,7 +35,7 @@

Available Dev Container Featur Reference Latest Version - + {% for c in site.data.devcontainer-index.collections %} {% for f in c.features %} {% if f.deprecated != true %} @@ -48,28 +48,8 @@

Available Dev Container Featur {% endif %} {% endfor %} - + {% endfor %} - \ No newline at end of file + diff --git a/js/search.js b/js/search.js new file mode 100644 index 00000000..c3c8efad --- /dev/null +++ b/js/search.js @@ -0,0 +1,44 @@ +function updateSearchResults(searchValue, rows) { + for (let i = 1; i < rows.length; i++) { + const cells = rows[i].getElementsByTagName('td'); + let match = false; + for (let j = 0; j < cells.length; j++) { + if (cells[j].textContent.toLowerCase().includes(searchValue)) { + match = true; + break; + } + } + rows[i].style.display = match ? '' : 'none'; + } +} + +function getSearchParameter() { + const params = new URLSearchParams(window.location.search); + return params.get('search') || ''; +} + +function setSearchParameter(value) { + const params = new URLSearchParams(window.location.search); + if (value) { + params.set('search', value); + } else { + params.delete('search'); + } + window.history.replaceState({}, '', `${window.location.pathname}?${params.toString()}`); +} + +document.addEventListener('DOMContentLoaded', function () { + const searchInput = document.getElementById('searchInput'); + const collectionTable = document.getElementById('collectionTable'); + const rows = collectionTable.getElementsByTagName('tr'); + + const searchValue = getSearchParameter(); + searchInput.value = searchValue; + updateSearchResults(searchValue, rows); + + searchInput.addEventListener('input', function () { + const searchValue = searchInput.value.toLowerCase(); + setSearchParameter(searchValue); + updateSearchResults(searchValue, rows); + }); +}); diff --git a/templates.html b/templates.html index a33d1702..2dcd6fac 100644 --- a/templates.html +++ b/templates.html @@ -6,10 +6,12 @@

Available Dev Container Templates

- This table contains all official and community-supported Dev Container Templates - known at the time of crawling each registered collection. This list is continuously - updated with the latest available Template information. See the - Template quick start repository to add your own! + This table contains all official and community-supported Dev Container + Templates + known at the time of crawling each registered collection. This list is continuously + updated with the latest available Template information. See the + Template quick start repository to add your own!

Templates listed here will be presented in the UX of supporting tools.

@@ -33,7 +35,7 @@

Available Dev Container Templa Reference Latest Version - + {% for c in site.data.devcontainer-index.collections %} {% for f in c.templates %} @@ -44,27 +46,8 @@

Available Dev Container Templa {{ f.version | strip_html }} {% endfor %} - + {% endfor %} - \ No newline at end of file +