PageSourceSearch

https://hacerselacritica.com/wp-content/themes/minimal-grid/assets/thememattic/js/script.js?ver=1.3.0

js hacerselacritica.com collected 2026-10-02 02:53:31 UTC 15,106 bytes, 407 lines download raw bytes

1(function (e) {
2    "use strict";
3    var n = window.MINIMAL_JS || {};
4    var grid;
5    /*Used for ajax loading posts*/
6    var loadType, loadButton, loader, pageNo, loading, morePost, scrollHandling;
7
8    function minimal_grid_is_on_scrn(elem) {
9        // if the element doesn't exist, abort
10        if (elem.length == 0) {
11            return;
12        }
13        var tmtwindow = jQuery(window);
14        var viewport_top = tmtwindow.scrollTop();
15        var viewport_height = tmtwindow.height();
16        var viewport_bottom = viewport_top + viewport_height;
17        var tmtelem = jQuery(elem);
18        var top = tmtelem.offset().top;
19        var height = tmtelem.height();
20        var bottom = top + height;
21        return (top >= viewport_top && top < viewport_bottom) ||
22            (bottom > viewport_top && bottom <= viewport_bottom) ||
23            (height > viewport_height && top <= viewport_top && bottom >= viewport_bottom);
24    }
25
26    n.mobileMenu = {
27        init: function () {
28            this.toggleMenu();
29            this.menuArrow();
30        },
31        toggleMenu: function () {
32            e('.nav-toogle').on('click', function (event) {
33                e('body').toggleClass('extended-menu');
34            });
35            e('.main-navigation').on('click', 'ul.menu a i', function (event) {
36                event.preventDefault();
37                var ethis = e(this),
38                    eparent = ethis.closest('li'),
39                    esub_menu = eparent.find('> .sub-menu');
40                //console.log(esub_menu.css());
41                // if (esub_menu.css('display') == 'none') {
42                //     console.log('aye');
43                //     esub_menu.slideDown('300');
44                    
45                // } 
46                if(ethis.hasClass('active')) {
47                    esub_menu.slideUp('300');
48                    ethis.removeClass('active');
49                } else {
50                    esub_menu.slideDown('300');
51                    ethis.addClass('active');
52                }
53
54                
55                //else if (esub_menu.css('display') == 'block') {
56                //     console.log('aye');
57                //     esub_menu.slideUp('300');
58                //     ethis.removeClass('active');
59                // } 
60                // else {
61                //     //console.log('aye');
62                //     esub_menu.slideDown('300');
63                //     ethis.addClass('active');
64                // }
65                return false;
66            });
67            e('.main-navigation').on('focus', '.menu-item-has-children > a', function(event) {
68                console.log('aye');
69                var ethis = e(this),
70                    eparent = ethis.parent('li'),
71                    esub_menu = eparent.find('> .sub-menu');
72
73                console.log(esub_menu);
74
75                if(ethis.hasClass('active')) {
76                    esub_menu.slideUp('300');
77                    ethis.removeClass('active');
78                } else {
79                    esub_menu.slideDown('300');
80                    ethis.addClass('active');
81                }
82
83                return false;
84            });
85        },
86        menuArrow: function () {
87            if (e('.main-navigation ul.menu').length) {
88                e('.main-navigation ul.menu .sub-menu').parent('li').find('> a').append('<i class="icon-nav-down">');
89            }
90        }
91    };
92    n.ThemematticSearch = function () {
93        e('.icon-search').on('click', function (event) {
94            e('body').toggleClass('reveal-search');
95        });
96        e('.close-popup').on('click', function (event) {
97            e('body').removeClass('reveal-search');
98        });
99    };
100    n.ThemematticPreloader = function () {
101
102            e("body").addClass("page-loaded");
103
104    };
105    n.ThemematticSlider = function () {
106        e(".gallery-columns-1, ul.wp-block-gallery.columns-1, .wp-block-gallery.columns-1 .blocks-gallery-grid").each(function () {
107            e(this).slick({
108                slidesToShow: 1,
109                slidesToScroll: 1,
110                fade: true,
111                autoplay: true,
112                autoplaySpeed: 8000,
113                infinite: true,
114                dots: false,
115                nextArrow: '<i class="navcontrol-icon slide-next ion-ios-arrow-right"></i>',
116                prevArrow: '<i class="navcontrol-icon slide-prev ion-ios-arrow-left"></i>'
117            });
118        });
119    };
120    n.SingleColGallery = function (gal_selector) {
121        if (e.isArray(gal_selector)) {
122            e.each(gal_selector, function (index, value) {
123                e("#" + value).find('.gallery-columns-1, ul.wp-block-gallery.columns-1, .wp-block-gallery.columns-1 .blocks-gallery-grid').slick({
124                    slidesToShow: 1,
125                    slidesToScroll: 1,
126                    dots: false,
127                    infinite: false,
128                    nextArrow: '<i class="navcontrol-icon slide-next ion-ios-arrow-right"></i>',
129                    prevArrow: '<i class="navcontrol-icon slide-prev ion-ios-arrow-left"></i>'
130                });
131            });
132        } else {
133            e("." + gal_selector).slick({
134                slidesToShow: 1,
135                slidesToScroll: 1,
136                dots: false,
137                infinite: false,
138                nextArrow: '<i class="navcontrol-icon slide-next ion-ios-arrow-right"></i>',
139                prevArrow: '<i class="navcontrol-icon slide-prev ion-ios-arrow-left"></i>'
140            });
141        }
142    };
143    n.MagnificPopup = function () {
144        e('.gallery, .wp-block-gallery').each(function () {
145            e(this).magnificPopup({
146                delegate: 'a',
147                type: 'image',
148                gallery: {
149                    enabled: true
150                },
151                zoom: {
152                    enabled: true,
153                    duration: 300,
154                    opener: function (element) {
155                        return element.find('img');
156                    }
157                }
158            });
159        });
160    };
161    n.DataBackground = function () {
162        var pageSection = e(".data-bg");
163        pageSection.each(function (indx) {
164            if (e(this).attr("data-background")) {
165                e(this).css("background-image", "url(" + e(this).data("background") + ")");
166            }
167        });
168        e('.bg-image').each(function () {
169            var src = e(this).children('img').attr('src');
170            e(this).css('background-image', 'url(' + src + ')').children('img').hide();
171        });
172    };
173    n.show_hide_scroll_top = function () {
174        if (e(window).scrollTop() > e(window).height() / 2) {
175            e("#scroll-up").fadeIn(300);
176        } else {
177            e("#scroll-up").fadeOut(300);
178        }
179    };
180    n.scroll_up = function () {
181        e("#scroll-up").on("click", function () {
182            e("html, body").animate({
183                scrollTop: 0
184            }, 800);
185            return false;
186        });
187    };
188    n.toogle_minicart = function () {
189        e(".minicart-title-handle").on("click", function () {
190            e(".minicart-content").slideToggle();
191        });
192    };
193    n.ms_masonry = function () {
194        if (e('.masonry-grid').length > 0) {
195            /*Default masonry animation*/
196            var hidden = 'scale(0.5)';
197            var visible = 'scale(1)';
198            /**/
199            /*Get masonry animation*/
200            if (minimalGridVal.masonry_animation === 'none') {
201                hidden = 'translateY(0)';
202                visible = 'translateY(0)';
203            }
204            if (minimalGridVal.masonry_animation === 'slide-up') {
205                hidden = 'translateY(50px)';
206                visible = 'translateY(0)';
207            }
208            if (minimalGridVal.masonry_animation === 'slide-down') {
209                hidden = 'translateY(-50px)';
210                visible = 'translateY(0)';
211            }
212            if (minimalGridVal.masonry_animation === 'zoom-out') {
213                hidden = 'translateY(-20px) scale(1.25)';
214                visible = 'translateY(0) scale(1)';
215            }
216            /**/
217            grid = e('.masonry-grid').imagesLoaded(function () {
218                //e('.masonry-grid article').fadeIn();
219                grid.masonry({
220                    itemSelector: 'article',
221                    hiddenStyle: {
222                        transform: hidden,
223                        opacity: 0
224                    },
225                    visibleStyle: {
226                        transform: visible,
227                        opacity: 1
228                    }
229                });
230            });
231        }
232    };
233    n.thememattic_matchheight = function () {
234        e('.widget-area').theiaStickySidebar({
235            additionalMarginTop: 30
236        });
237    };
238    n.thememattic_reveal = function () {
239        e('#thememattic-reveal').on('click', function (event) {
240            e('body').toggleClass('reveal-box');
241        });
242        e('.close-popup').on('click', function (event) {
243            e('body').removeClass('reveal-box');
244        });
245    };
246    n.setLoadPostDefaults = function () {
247        if (e('.load-more-posts').length > 0) {
248            loadButton = e('.load-more-posts');
249            loader = e('.load-more-posts .ajax-loader');
250            loadType = loadButton.attr('data-load-type');
251            pageNo = 2;
252            loading = false;
253            morePost = true;
254            scrollHandling = {
255                allow: true,
256                reallow: function () {
257                    scrollHandling.allow = true;
258                },
259                delay: 400
260            };
261        }
262    };
263    n.fetchPostsOnScroll = function () {
264        e(window).scroll(function () {
265            if ( !e('.load-more-posts').hasClass('tmt-no-post') && !e('.load-more-posts').hasClass('tmt-post-loding') && e('.load-more-posts').hasClass('scroll') && minimal_grid_is_on_scrn('.load-more-posts')) {
266
267                e('.load-more-posts').addClass('tmt-post-loding');
268                n.ShowPostsAjax();
269
270            }
271        });
272    };
273    n.fetchPostsOnClick = function () {
274        if (e('.load-more-posts').length > 0 && 'click' === loadType) {
275            e('.load-more-posts a').on('click', function (event) {
276                event.preventDefault();
277                n.ShowPostsAjax();
278            });
279        }
280    };
281    n.masonryOnClickUpdate = function () {
282        setTimeout(function () {
283            e('.masonry-grid').masonry();
284        }, 100);
285    };
286    n.fetchPostsOnMenuClick = function () {
287        e('.trigger-icon-wraper').on('click', function (event) {
288            event.preventDefault();
289            grid = e('.masonry-grid');
290            n.masonryOnClickUpdate();
291        });
292    };
293    n.ShowPostsAjax = function () {
294        e.ajax({
295            type: 'GET',
296            url: minimalGridVal.ajaxurl,
297            data: {
298                action: 'minimal_grid_load_more',
299                nonce: minimalGridVal.nonce,
300                page: pageNo,
301                post_type: minimalGridVal.post_type,
302                search: minimalGridVal.search,
303                cat: minimalGridVal.cat,
304                taxonomy: minimalGridVal.taxonomy,
305                author: minimalGridVal.author,
306                year: minimalGridVal.year,
307                month: minimalGridVal.month,
308                day: minimalGridVal.day
309            },
310            dataType: 'json',
311            beforeSend: function () {
312                loader.addClass('ajax-loader-enabled');
313            },
314            success: function (response) {
315                e('.load-more-posts').removeClass('tmt-post-loding');
316                if (response.success) {
317                    var gallery = true;
318                    var gal_selectors = [];
319                    var content_join = response.data.content.join('');
320                    /*Push the post ids having galleries so that new gallery instance can be created*/
321                    e(content_join).find('.entry-gallery').each(function () {
322                        gal_selectors.push(e(this).closest('article').attr('id'));
323                    });
324                    if (e('.masonry-grid').length > 0) {
325
326                        var content = e(content_join);
327                        content.hide();
328                        grid = e('.masonry-grid');
329                        grid.append(content);
330                        grid.imagesLoaded( function() {
331
332                            content.show();
333                            /*Init new Gallery*/
334                            if (true === gallery) {
335                                n.SingleColGallery(gal_selectors);
336                            }
337                            
338                            var winwidth = e(window).width();
339                            e(window).resize(function() {
340                                winwidth = e(window).width();
341                            });
342
343                            if( winwidth > 990 ){
344                                grid.masonry('appended', content).masonry();
345                            }else{
346                                grid.masonry('appended', content);
347                            }
348                           
349                            loader.removeClass('ajax-loader-enabled');
350
351                        } );
352
353                    }else{
354
355                        e('.minimal-grid-posts-lists').append(response.data.content);
356                        /*Init new Gallery*/
357                        if (true === gallery) {
358                            n.SingleColGallery(gal_selectors);
359                        }
360                        loader.removeClass('ajax-loader-enabled');
361
362                    }
363                    pageNo++;
364                    loading = false;
365                    if (!response.data.more_post) {
366                        morePost = false;
367                        loadButton.fadeOut();
368                    }
369                    /*For audio and video to work properly after ajax load*/
370                    e('video, audio').mediaelementplayer({alwaysShowControls: true});
371                    /**/
372                    /*For Gallery to work*/
373                    n.MagnificPopup();
374                    /**/
375                    loader.removeClass('ajax-loader-enabled');
376                } else {
377                    e('.load-more-posts').addClass('tmt-no-post');
378                    loadButton.fadeOut();
379                }
380            }
381        });
382    };
383    e(document).ready(function () {
384        n.mobileMenu.init();
385        n.ThemematticSearch();
386        n.ThemematticSlider();
387        n.MagnificPopup();
388        n.DataBackground();
389        n.scroll_up();
390        n.thememattic_reveal();
391        n.thememattic_matchheight();
392        n.toogle_minicart();
393        n.ms_masonry();
394        n.setLoadPostDefaults();
395        n.fetchPostsOnClick();
396        n.fetchPostsOnMenuClick();
397    });
398	
399	 e(window).load(function () {
400          n.ThemematticPreloader();
401       });
402		
403    e(window).scroll(function () {
404        n.show_hide_scroll_top();
405        n.fetchPostsOnScroll();
406    });
407})(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.