PageSourceSearch

https://www.plutonotdabratt.com/wp-content/plugins/umg-grand-royal…/web-components/wc-filter.js?ver=3.5.9

js plutonotdabratt.com collected 2026-09-29 00:50:04 UTC 14,023 bytes, 255 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    // FILTER - News
5    document.addEventListener('DOMContentLoaded', function() {       
6        // Function to handle the custom event
7        function handleCustomFilterEvent(event) {
8            if(
9                event.detail
10                && event.detail.fieldName
11                && event.detail.fieldName === 'newsFilter') {
12                var getURL = event.detail.value;
13
14                // check if we want to do AJAX load or page reload
15                if ('1' === UMGGR_WC_Filter.newsAJAXCatLoad) {
16                    var setContentPanelID = 'news-content';
17                    var getContentPanelHeight = $('#' + setContentPanelID).height();
18
19                    $('#' + setContentPanelID).height(getContentPanelHeight);
20                    $('#' + setContentPanelID).empty().html('<div id="filterPreloader"><svg class="preloader__button__spinner" width="32" height="32" xmlns="http://www.w3.org/2000/svg" focusable="false" role="presentation" aria-hidden="true" viewBox="0 0 512 512"><path d="M463.9 376c7.6 4.4 17.5 1.8 21.4-6.1c17.1-34.3 26.7-73 26.7-113.9C512 120 405.9 8.8 272 .5c-8.8-.5-16 6.7-16 15.5v0c0 8.8 7.2 15.9 16 16.6C388.2 40.8 480 137.7 480 256c0 35.1-8.1 68.3-22.5 97.9c-3.9 8-1.3 17.7 6.4 22.2v0z"></path></svg></div>');
21
22                    // Define the starting position based on whether the site uses HTTPS or HTTP
23                    var startPos = getURL.indexOf('://') !== -1 ? getURL.indexOf('/', 8) : getURL.indexOf('/');
24
25                    // Remove the protocol and domain
26                    var path = getURL.substring(startPos);
27
28                    // Update the URL in the browser
29                    history.pushState(null, null, path);
30
31                    // Set the filter meta value (should be last part of the url)                
32                    // Split the path by '/'
33                    var segments = path.split('/').filter(function(segment) {
34                        return segment !== ''; // Filter out empty segments
35                    });
36
37                    // Get the last segment
38                    var getNewsArtist = segments.pop();
39                    
40                    jQuery.ajax({
41                        url: UMGGR_WC_Filter.ajaxurl + '?action=wc_artistid_from_slug&nonce=' + UMGGR_WC_Filter.nonce + '&artistSlug=' + encodeURIComponent(getNewsArtist),
42                        type: 'GET',
43                        success: function(response) {
44                            if (false !== response.data.status) {
45                                var setNewsArtistID = (0 !== response.data.artistID ? response.data.artistID : ''); 
46
47                                // Perform a POST request to the AJAX endpoint
48                                jQuery.ajax({
49                                    url: UMGGR_WC_Filter.ajaxurl + '?action=wc_news_filter&nonce=' + UMGGR_WC_Filter.nonce + '&artistID=' + encodeURIComponent(setNewsArtistID),
50                                    type: 'GET',
51                                    success: function(response) {
52                                        if (false !== response.data.status) {
53                                            $('#' + setContentPanelID).attr('style', '');
54                                            $('#preloader').hide();
55                                            
56                                            // set the content
57                                            $('#' + setContentPanelID).html(response.data.msg);
58
59                                            // re-init the pagination settings if pagination is available
60                                            if ($('#umggr-wc-pagination-load-more').length > 0) {
61                                                $.initPagination(
62                                                    '',
63                                                    0,
64                                                    'news_artists',
65                                                    setNewsArtistID
66                                                );
67                                            }
68
69                                        } else {
70                                            console.log('' + response.data.msg + '');
71                                        }
72                                    },
73                                    error: function(xhr, status, error) {
74                                        console.error(error);
75                                    }
76                                });
77                            } else {
78                                return 'ERROR: ' + response.data.artistID;
79                            }
80                        },
81                        error: function(xhr, status, error) {
82                            return error;
83                        }
84                    });
85                } else {
86                    location.href = getURL;
87                }            
88            }
89
90            if(event &&
91               event.detail &&
92               event.detail.fieldName === 'artistDiscoDecadeFilter') {
93                var getURL = event.detail.value;
94                // check if we want to do AJAX load or page reload
95                if ('1' === UMGGR_WC_Filter.artistAJAXDiscLoad) {
96                    var setContentParentPanelID = 'section-artist-music';
97                    var setContentPanelID = 'section-artist-music-section-blk-two';
98                    var getContentPanelHeight = $('umg-section#' + setContentParentPanelID).height();
99                    var getPageId = $('umg-select#artistDiscoDecadeFilter1').data('page-id');
100                    var setInverseSpinnerColor = $('umg-select#artistDiscoDecadeFilter1').data('inverse-spinner-color');
101
102                    var setFilterPreloaderID = "filterPreloader";
103                    if ('yes' === setInverseSpinnerColor) {
104                        setFilterPreloaderID = "filterPreloaderInverse";
105                    }
106
107                    $('umg-section#' + setContentParentPanelID).css('min-height', getContentPanelHeight + 'px');
108                    $('umg-section-block#' + setContentPanelID).empty().html('<div id="' + setFilterPreloaderID + '"><svg class="preloader__button__spinner" width="32" height="32" xmlns="http://www.w3.org/2000/svg" focusable="false" role="presentation" aria-hidden="true" viewBox="0 0 512 512"><path d="M463.9 376c7.6 4.4 17.5 1.8 21.4-6.1c17.1-34.3 26.7-73 26.7-113.9C512 120 405.9 8.8 272 .5c-8.8-.5-16 6.7-16 15.5v0c0 8.8 7.2 15.9 16 16.6C388.2 40.8 480 137.7 480 256c0 35.1-8.1 68.3-22.5 97.9c-3.9 8-1.3 17.7 6.4 22.2v0z"></path></svg></div>');
109
110                    // Define the starting position based on whether the site uses HTTPS or HTTP
111                    var startPos = getURL.indexOf('://') !== -1 ? getURL.indexOf('/', 8) : getURL.indexOf('/');
112
113                    // Remove the protocol and domain
114                    var path = getURL.substring(startPos);
115
116                    // Update the URL in the browser
117                    history.pushState(null, null, path);
118
119                    // Set the filter meta value (should be last part of the url)                
120                    // Split the path by '/'
121                    var segments = path.split('/').filter(function(segment) {
122                        return segment !== ''; // Filter out empty segments
123                    });
124
125                    // Get the last segment
126                    var getDecade = parseInt(segments.pop());
127
128                    // If getDeade isn't a number e.g. All then set to blank string
129                    if (isNaN(parseInt(getDecade))) {
130                        getDecade = '';
131                    }
132
133                    // Perform a GET request to the AJAX endpoint
134                    jQuery.ajax({
135                        url: UMGGR_WC_Filter.ajaxurl + '?action=wc_artist_disco_filter&nonce=' + UMGGR_WC_Filter.nonce + '&pageId=' + encodeURIComponent(getPageId) + '&decade=' + encodeURIComponent(getDecade),
136                        type: 'GET',
137                        success: function(response) {
138                            if (false !== response.data.status) {
139                                $('umg-section#' + setContentParentPanelID).attr('style', '');
140                                //$('#preloader').hide();
141                                
142                                // set the content
143                                $('umg-section-block#' + setContentPanelID).html(response.data.msg);
144                            } else {
145                                console.log('' + response.data.msg + '');
146                            }
147                        },
148                        error: function(xhr, status, error) {
149                            console.error(error);
150                        }
151                    });
152                } else{
153                    location.href = getURL;
154                }
155            }
156        }
157
158        // Add event listener for the custom event
159        window.addEventListener('change', handleCustomFilterEvent);
160    });
161
162    // FILTER - Artists
163    $('.ajax-artists-cat-filter').on('click', function(){
164        var parentUmgLinkGroup = $(this).closest('umg-link-group');
165        parentUmgLinkGroup.find('umg-link').removeAttr('underline');
166        $(this).attr('underline', 'true');
167        var setContentPanelID = $(this).data('section-content-id');
168        var getContentPanelHeight = $('#' + setContentPanelID).height();
169        var getFilterName = $(this).data('filter');
170        var getTaxonomy = $(this).data('taxonomy');
171        var getCategoryID = $(this).data('term-id');
172
173        $('#' + setContentPanelID).height(getContentPanelHeight);
174        $('#' + setContentPanelID).empty().html('<div id="filterPreloader"><svg class="preloader__button__spinner" width="32" height="32" xmlns="http://www.w3.org/2000/svg" focusable="false" role="presentation" aria-hidden="true" viewBox="0 0 512 512"><path d="M463.9 376c7.6 4.4 17.5 1.8 21.4-6.1c17.1-34.3 26.7-73 26.7-113.9C512 120 405.9 8.8 272 .5c-8.8-.5-16 6.7-16 15.5v0c0 8.8 7.2 15.9 16 16.6C388.2 40.8 480 137.7 480 256c0 35.1-8.1 68.3-22.5 97.9c-3.9 8-1.3 17.7 6.4 22.2v0z"></path></svg></div>');
175
176        // Remove the '.' from the beginning of filterValue
177        if (getFilterName.charAt(0) === '.') {
178            getFilterName = getFilterName.substring(1);
179        }
180        
181        // Update the browser's URL using pushState
182        if ('*' === getFilterName) {
183            history.pushState(null, null, '/artists/');
184        } else {
185            history.pushState(null, null, '/artists/' + getFilterName);
186        }
187        
188        // Perform a POST request to the AJAX endpoint
189        jQuery.ajax({
190            url: UMGGR_WC_Filter.ajaxurl + '?action=wc_artists_filter&nonce=' + UMGGR_WC_Filter.nonce + '&artistsCategoryTerm=' + encodeURIComponent(getFilterName),
191            type: 'GET',
192            success: function(response) {
193                if (false !== response.data.status) {
194                    $('#' + setContentPanelID).attr('style', '');
195                    $('#preloader').hide();
196                    
197                    // set the content
198                    $('#' + setContentPanelID).html(response.data.msg);
199
200                    // re-init the pagination settings if pagination is available
201                    if ($('#umggr-wc-pagination-load-more').length > 0) {
202                        $.initPagination(
203                            getTaxonomy,
204                            getCategoryID
205                        );
206                    }
207
208                } else {
209                    console.log('' + response.data.msg + '');
210                }
211            },
212            error: function(xhr, status, error) {
213                console.error(error);
214            }
215        });
216    });
217
218    // FILTER - History
219    $('.ajax-history-cat-filter').on('click', function(){
220        var setDecade = $(this).data('history-decade');
221        var setParentContentPanelID = $(this).data('history-parent-content-panel-id');
222        var setContentPanelID = $(this).data('history-content-panel-id');
223        var getContentPanelHeight = $('#' + setParentContentPanelID).height();
224
225        $('#' + setParentContentPanelID).css('min-height', getContentPanelHeight);
226        $('#' + setContentPanelID).empty().html('<umg-vertical-stack slot="content" id="filterPreloader"><svg class="preloader__button__spinner" width="32" height="32" xmlns="http://www.w3.org/2000/svg" focusable="false" role="presentation" aria-hidden="true" viewBox="0 0 512 512"><path d="M463.9 376c7.6 4.4 17.5 1.8 21.4-6.1c17.1-34.3 26.7-73 26.7-113.9C512 120 405.9 8.8 272 .5c-8.8-.5-16 6.7-16 15.5v0c0 8.8 7.2 15.9 16 16.6C388.2 40.8 480 137.7 480 256c0 35.1-8.1 68.3-22.5 97.9c-3.9 8-1.3 17.7 6.4 22.2v0z"></path></svg></umg-vertical-stack>');
227
228        // Update the browser's URL using pushState
229        if ('' === setDecade) {
230            history.pushState(null, null, '/history/');
231        } else {
232            history.pushState(null, null, '/history/decade/' + setDecade);
233        }
234
235        // Perform a POST request to the AJAX endpoint
236        jQuery.ajax({
237            url: UMGGR_WC_Filter.ajaxurl + '?action=wc_history_filter&nonce=' + UMGGR_WC_Filter.nonce + '&decade=' + encodeURIComponent(setDecade),
238            type: 'GET',
239            success: function(response) {
240                if (false !== response.data.status) {
241                    $('#' + setContentPanelID).attr('style', '');
242                    $('#preloader').hide();
243                    // set the content
244                    $('#' + setContentPanelID).html(response.data.msg);
245                    $('#' + setParentContentPanelID).attr('style', ''); //  remove any styling
246                } else {
247                    console.log('' + response.data.msg + '');
248                }
249            },
250            error: function(xhr, status, error) {
251                console.error(error);
252            }
253        });
254    });
255})(jQuery);

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.