PageSourceSearch

https://www.kavalier.cz/wp-content/themes/kavalierglass/js/blog-filter.js

js kavalier.cz collected 2026-10-02 12:09:47 UTC 1,414 bytes, 46 lines download raw bytes

1document.addEventListener('DOMContentLoaded', () => {
2  const checkboxes = document.querySelectorAll('.blog-checkboxes input[type="checkbox"]');
3  const posts = document.querySelectorAll('.blog-posts a[data-cats]');
4
5  function filterPosts() {
6	posts.forEach(post => {
7		post.classList.remove('hidden-by-default');
8		post.style.display = '';
9	});
10
11    const allChecked = document.querySelector('.blog-checkboxes input[value="all"]').checked;
12
13    if (allChecked) {
14      checkboxes.forEach(cb => {
15        if (cb.value !== 'all') cb.checked = false;
16      });
17      posts.forEach(post => post.style.display = '');
18      return;
19    }
20
21    const selectedCats = Array.from(checkboxes)
22      .filter(cb => cb.checked && cb.value !== 'all')
23      .map(cb => cb.value);
24
25    posts.forEach(post => {
26      const postCats = post.dataset.cats ? post.dataset.cats.split(' ') : [];
27      const match = selectedCats.some(cat => postCats.includes(cat));
28      post.style.display = match ? '' : 'none';
29    });
30  }
31
32  checkboxes.forEach(cb => cb.addEventListener('change', () => {
33    if (cb.value !== 'all' && cb.checked) {
34      document.querySelector('.blog-checkboxes input[value="all"]').checked = false;
35    }
36    if (cb.value === 'all' && cb.checked) {
37      checkboxes.forEach(otherCb => {
38        if (otherCb.value !== 'all') otherCb.checked = false;
39      });
40    }
41
42    filterPosts();
43  }));
44
45  //filterPosts();
46});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.