- commit
- b4e6f51dc387dc0af173ffe4ff703996d1e2a4fc
- parent
- 2f02e64253f2a41e0a334cf897094e74b884ce3f
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2023-10-19 06:12
refactor blogsearch.js
Diffstat
M | _templates/blog.html | 2 | +- |
M | build/static/blogsearch.js | 9 | +++++---- |
2 files changed, 6 insertions, 5 deletions
diff --git a/_templates/blog.html b/_templates/blog.html
@@ -8,4 +8,4 @@ 8 8 {{/posts}} 9 9 </ul> 10 1011 -1 <script src="/static/blogsearch.js"></script>-1 11 <script src="/static/blogsearch.js" type="module"></script>
diff --git a/build/static/blogsearch.js b/build/static/blogsearch.js
@@ -1,10 +1,11 @@1 -1 (function() {2 -1 var tag = location.hash.substr(1);-1 1 var tag = location.hash.substr(1); -1 2 -1 3 if (tag) { 3 4 var blog = document.querySelector('.blog'); 4 5 5 6 for (var i = 0; i < blog.children.length; i++) { 6 7 var post = blog.children[i]; 7 8 var tags = post.dataset.tags.trim().split(/\s/);8 -1 post.hidden = tag && !tags.includes(tag);-1 9 post.hidden = !tags.includes(tag); 9 10 }10 -1 })()-1 11 }