1(function () { 2 'use strict'; 3 4 /* âââââââââââââââââââââââââââââââââââââââââââ 5 Filter buttons 6 âââââââââââââââââââââââââââââââââââââââââââ */ 7 function initFilters() { 8 var wrapper = document.querySelector('.scw-all-searches'); 9 if (!wrapper) return; 10 11 var bar = wrapper.querySelector('.scw-all-searches__filter-bar'); 12 var cards = wrapper.querySelectorAll('.scw-search-card'); 13 var noMsg = wrapper.querySelector('.scw-all-searches__no-results'); 14 if (!bar || !cards.length) return; 15 16 bar.addEventListener('click', function (e) { 17 var btn = e.target.closest('.scw-all-searches__filter-btn'); 18 if (!btn) return; 19 20 bar.querySelectorAll('.scw-all-searches__filter-btn').forEach(function (b) { 21 b.classList.remove('is-active'); 22 }); 23 btn.classList.add('is-active'); 24 25 var tag = btn.getAttribute('data-filter'); 26 var visible = 0; 27 28 cards.forEach(function (card) { 29 if (tag === 'all' || card.getAttribute('data-tag') === tag) { 30 card.classList.remove('is-hidden'); 31 visible++; 32 } else { 33 card.classList.add('is-hidden'); 34 } 35 }); 36 37 if (noMsg) { 38 noMsg.hidden = visible > 0; 39 } 40 }); 41 } 42 43 /* âââââââââââââââââââââââââââââââââââââââââââ 44 Scroll-in animations (IntersectionObserver) 45 âââââââââââââââââââââââââââââââââââââââââââ */ 46 function initScrollAnimations() { 47 var cards = document.querySelectorAll('.scw-search-card'); 48 if (!cards.length || !('IntersectionObserver' in window)) { 49 cards.forEach(function (c) { c.classList.add('is-visible'); }); 50 return; 51 } 52 53 var observer = new IntersectionObserver(function (entries) { 54 entries.forEach(function (entry) { 55 if (entry.isIntersecting) { 56 var el = entry.target; 57 var index = Array.prototype.indexOf.call(cards, el); 58 var delay = Math.min(index, 8) * 60; 59 60 setTimeout(function () { 61 el.classList.add('is-visible'); 62 }, delay); 63 64 observer.unobserve(el); 65 } 66 }); 67 }, { threshold: 0.1 }); 68 69 cards.forEach(function (card) { observer.observe(card); }); 70 } 71 72 /* âââââââââââââââââââââââââââââââââââââââââââ 73 Bootstrap 74 âââââââââââââââââââââââââââââââââââââââââââ */ 75 function init() { 76 initFilters(); 77 initScrollAnimations(); 78 } 79 80 if (document.readyState === 'loading') { 81 document.addEventListener('DOMContentLoaded', init); 82 } else { 83 init(); 84 } 85 86 // Re-init when Elementor editor loads widgets in preview 87 if (typeof jQuery !== 'undefined') { 88 jQuery(window).on('elementor/frontend/init', function () { 89 if (window.elementorFrontend && window.elementorFrontend.hooks) { 90 window.elementorFrontend.hooks.addAction( 91 'frontend/element_ready/scw_all_searches.default', 92 function () { init(); } 93 ); 94 } 95 }); 96 } 97})();
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.