A curated list of libraries & SDKs for the Bluesky API and AT Protocol
at master 33 lines 1.2 kB view raw
1document.addEventListener('DOMContentLoaded', () => { 2 let tagCloud = document.getElementById('tag_cloud'); 3 let tagButtons = Array.from(tagCloud.querySelectorAll('span[data-tag]')); 4 let languageSections = Array.from(document.querySelectorAll('.language')); 5 6 let activeTag = null; 7 8 for (let button of tagButtons) { 9 button.addEventListener('click', (event) => { 10 let tagValue = button.dataset.tag; 11 activeTag = (activeTag === tagValue) ? null : tagValue; 12 13 tagButtons.forEach(button => { 14 button.classList.toggle('selected', button.dataset.tag === activeTag); 15 }); 16 17 languageSections.forEach(section => { 18 let projectItems = Array.from(section.querySelectorAll('.projects > li')); 19 let anyMatched = false; 20 21 for (let project of projectItems) { 22 let projectTags = project.dataset.tags ? project.dataset.tags.split(',') : []; 23 let match = !activeTag || projectTags.includes(activeTag); 24 25 project.style.display = match ? '' : 'none'; 26 anyMatched = anyMatched || match; 27 } 28 29 section.style.display = anyMatched ? '' : 'none'; 30 }); 31 }); 32 } 33});