PageSourceSearch

https://www.viola-group.com/wp-content/themes/viola/assets/js/fintech-map.js?ver=1853204969

js viola-group.com collected 2026-09-24 19:38:06 UTC 12,085 bytes, 280 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2    const tabLinks = document.querySelectorAll('.tab-link');
3    const tabContents = document.querySelectorAll('.tab-content');
4
5    tabLinks.forEach(link => {
6        link.addEventListener('click', function () {
7            const tabId = this.getAttribute('data-tab');
8
9            tabLinks.forEach(link => {
10                link.classList.remove('current');
11            });
12            this.classList.add('current');
13
14            tabContents.forEach(content => {
15                content.classList.remove('current');
16            });
17            document.getElementById(tabId).classList.add('current');
18        });
19    });
20
21    function attachPopupListeners() {
22        const popupOpeners = document.querySelectorAll('.popup-opener');
23
24        // Function to show the next popup card
25        function showNextPopup(event) {
26            event.preventDefault();
27            const opener = event.target.closest('.popup-opener');
28            if (!opener) return;
29
30            const nextPopup = opener.nextElementSibling;
31            if (nextPopup && nextPopup.classList.contains('popup-card')) {
32                nextPopup.classList.add('showed');
33            }
34        }
35
36        // Function to hide the current popup card
37        function hidePopup(event) {
38            const closeButton = event.target;
39            const popupCard = closeButton.closest('.popup-card');
40
41            if (popupCard) {
42                popupCard.classList.remove('showed');
43            }
44        }
45
46        popupOpeners.forEach(opener => {
47            opener.addEventListener('click', showNextPopup);
48        });
49
50        document.querySelectorAll('.popup-close').forEach(closeButton => {
51            closeButton.addEventListener('click', hidePopup);
52        });
53
54        document.addEventListener('click', function (event) {
55            document.querySelectorAll('.popup-card.showed').forEach(popupCard => {
56                if (!popupCard.contains(event.target) && !event.target.closest('.popup-opener')) {
57                    popupCard.classList.remove('showed');
58                }
59            });
60        });
61    }
62
63    // Initially attach popup listeners
64    attachPopupListeners();
65
66    const filterOpenButtons = document.querySelectorAll('.filter-open');
67    const filterCloseButtons = document.querySelectorAll('.filter-close');
68    const body = document.querySelector('body');
69
70    filterOpenButtons.forEach(button => {
71        button.addEventListener('click', function () {
72            const tabContentFilter = this.closest('.tab-content').querySelector('.tab-content-filter');
73            if (tabContentFilter) {
74                tabContentFilter.classList.add('active'); // Add the desired class here
75            }
76        });
77    });
78    filterCloseButtons.forEach(button => {
79        button.addEventListener('click', function () {
80            const tabContentFilter = this.closest('.tab-content').querySelector('.tab-content-filter');
81            if (tabContentFilter) {
82                tabContentFilter.classList.remove('active'); // Add the desired class here
83            }
84        });
85    });
86
87    // Attach jQuery document ready function
88    jQuery(document).ready(function($) {
89        jQuery('.tab-content-filter input[type="checkbox"]').on('change', function(e) {
90            e.preventDefault();
91
92            // Get the tab identifier from the closest tab-content
93            let tabSlug = jQuery(this).closest('.tab-content').attr('id').replace('tab-', '');
94
95            // Collect selected filters within the current tab
96            let selectedStatuses = [];
97            let selectedTabs = [];
98            let selectedCategories = [];
99
100            jQuery(`#tab-${tabSlug} input[name="status[]"]:checked`).each(function() {
101                selectedStatuses.push(jQuery(this).val());
102            });
103
104            jQuery(`#tab-${tabSlug} input[name="tabs[]"]:checked`).each(function() {
105                selectedTabs.push(jQuery(this).val());
106            });
107
108            jQuery(`#tab-${tabSlug} input[name="subcategories[]"]:checked`).each(function() {
109                selectedCategories.push(jQuery(this).val());
110            });
111
112            jQuery.ajax({
113                type: 'POST',
114                url: ajax_params.ajax_url,
115                data: {
116                    action: 'filter_posts',
117                    nonce: ajax_params.nonce,
118                    statuses: selectedStatuses,
119                    tabs: selectedTabs,
120                    categories: selectedCategories,
121                    tab_slug: tabSlug // Pass the tab identifier
122                },
123                beforeSend : function ( xhr ) {
124                    jQuery('.the-loader').addClass('loading');
125                    jQuery('.tab-content-list-container').addClass('loading');
126                },
127                success: function(response) {
128                    jQuery('.the-loader').removeClass('loading');
129                    jQuery('.tab-content-list-container').removeClass('loading');
130                    jQuery(`#tab-${tabSlug} .tab-content-list-container`).html(response);
131
132                    // Reattach popup listeners to the newly loaded content
133                    attachPopupListeners();
134
135                    jQuery(`#tab-${tabSlug} .main-category-block`).each(function() {
136                        if ($(this).children().length === 1) {
137                            $(this).remove();
138                        }
139                    });
140                    jQuery(`#tab-${tabSlug} .tab-content-list-container`).each(function() {
141                        const tabContentList = jQuery(this);
142                        const notFoundBlocks = tabContentList.find('.not-found');
143                        const categoryBlocks = tabContentList.find('.category-block');
144                        if (notFoundBlocks.length > 0 && categoryBlocks.length > 0) {
145                            // Remove all .not-found blocks
146                            notFoundBlocks.remove();
147                        } else if(notFoundBlocks.length > 0 && categoryBlocks.length == 0) {
148                            // Leave only one .not-found block
149                            notFoundBlocks.slice(1).remove();
150                        }
151                    });
152                },
153                error: function(xhr, status, error) {
154                    console.error("Failed to fetch posts. Error:", xhr.responseText);
155                }
156            });
157        });
158        jQuery('.clear-filters').on('click', function(e) {
159            e.preventDefault();
160            console.log('clear filters');
161            let tabSlug = jQuery(this).closest('.tab-content').attr('id').replace('tab-', '');
162            //let tabSlug = jQuery(this).data('tab');
163
164            console.log(tabSlug);
165
166            jQuery(`#tab-${tabSlug} input[type="checkbox"]`).prop('checked', false);
167
168            // Optionally trigger the filter change event to refresh the content
169            jQuery(`#tab-${tabSlug} input[type="checkbox"]`).trigger('change');
170        });
171
172        jQuery('#search-component').on('keyup', function() {
173            let query = jQuery(this).val();
174            const clearSearch = jQuery('.clear-search');
175            const filterBox = jQuery('#tab-all .tab-content-filter');
176
177            // Switch to All tab
178            jQuery('.tab-link[data-tab="tab-all"]').click();
179
180            let tabSlug = 'all';
181
182            // Check if input length is greater than 2
183            if (query.length > 2) {
184                jQuery(clearSearch).addClass('showed');
185                jQuery(filterBox).addClass('hidden');
186                jQuery.ajax({
187                    type: 'POST',
188                    url: ajax_params.ajax_url,
189                    data: {
190                        action: 'search_posts',
191                        nonce: ajax_params.nonce,
192                        query: query
193                    },
194                    beforeSend: function() {
195                        jQuery('.the-loader').addClass('loading');
196                        jQuery('.tab-content-list-container').addClass('loading');
197                    },
198                    success: function(response) {
199                        jQuery(`#tab-${tabSlug} .tab-content-list-container`).html(response);
200                        jQuery('.the-loader').removeClass('loading');
201                        jQuery('.tab-content-list-container').removeClass('loading');
202                        jQuery(`#tab-${tabSlug} .main-category-block`).each(function() {
203                            if ($(this).children().length === 1) {
204                                $(this).remove();
205                            }
206                        });
207                        attachPopupListeners();
208                    },
209                    error: function(xhr, status, error) {
210                        console.error("Failed to fetch search results. Error:", xhr.responseText);
211                    }
212                });
213            } else if (query.length == 0) {
214                jQuery(clearSearch).removeClass('showed');
215                jQuery(filterBox).removeClass('hidden');
216                jQuery.ajax({
217                    type: 'POST',
218                    url: ajax_params.ajax_url,
219                    data: {
220                        action: 'search_posts',
221                        nonce: ajax_params.nonce,
222                        query: 'all'
223                    },
224                    beforeSend: function() {
225                        jQuery('.the-loader').addClass('loading');
226                        jQuery('.tab-content-list-container').addClass('loading');
227                    },
228                    success: function(response) {
229                        jQuery(`#tab-${tabSlug} .tab-content-list-container`).html(response);
230                        jQuery('.the-loader').removeClass('loading');
231                        jQuery('.tab-content-list-container').removeClass('loading');
232                        jQuery(`#tab-${tabSlug} .main-category-block`).each(function() {
233                            if ($(this).children().length === 1) {
234                                $(this).remove();
235                            }
236                        });
237                        attachPopupListeners();
238                    },
239                    error: function(xhr, status, error) {
240                        console.error("Failed to fetch search results. Error:", xhr.responseText);
241                    }
242                });
243            }
244        });
245        jQuery('.clear-search').on('click', function (){
246            jQuery(this).removeClass('showed');
247            jQuery('#search-component').val('');
248            let tabSlug = 'all';
249            const filterBox = jQuery('#tab-all .tab-content-filter');
250            jQuery.ajax({
251                type: 'POST',
252                url: ajax_params.ajax_url,
253                data: {
254                    action: 'search_posts',
255                    nonce: ajax_params.nonce,
256                    query: 'all'
257                },
258                beforeSend: function() {
259                    jQuery('.the-loader').addClass('loading');
260                    jQuery('.tab-content-list-container').addClass('loading');
261                },
262                success: function(response) {
263                    jQuery(`#tab-${tabSlug} .tab-content-list-container`).html(response);
264                    jQuery('.the-loader').removeClass('loading');
265                    jQuery('.tab-content-list-container').removeClass('loading');
266                    jQuery(filterBox).removeClass('hidden');
267                    jQuery(`#tab-${tabSlug} .main-category-block`).each(function() {
268                        if ($(this).children().length === 1) {
269                            $(this).remove();
270                        }
271                    });
272                    attachPopupListeners();
273                },
274                error: function(xhr, status, error) {
275                    console.error("Failed to fetch search results. Error:", xhr.responseText);
276                }
277            });
278        });
279    });
280});

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.