PageSourceSearch

https://mgiri.org/wp-content/plugins/ova-project/assets/js/elementor/ajax-filter.js

js mgiri.org collected 2026-09-25 01:21:10 UTC 6,147 bytes, 167 lines download raw bytes

1(function($){
2    "use strict";
3
4    $(window).on('elementor/frontend/init', function () {
5
6        /* ajax project filter  */
7        elementorFrontend.hooks.addAction('frontend/element_ready/ova_elementor_project_filter_ajax.default', function(){
8
9            $('.ova-project-filter-ajax').each( function(){
10
11                var that    = $(this);
12                var btn     = that.find('.project-filter-button');
13                
14                var template       = that.data('template');
15                var posts_per_page = that.data('posts_per_page');
16                var orderby        = that.data('orderby');
17                var order          = that.data('order');
18
19                //load init
20                load_ajax('all',template,posts_per_page,orderby,order);
21                
22                btn.each( function() {
23                    $(this).on('click', function() {
24
25                        that.find(".project-filter-button").removeClass("active-category");
26                        $(this).addClass("active-category");
27
28                        var term = $(this).attr( "data-slug" );
29                        load_ajax(term,template,posts_per_page,orderby,order);
30
31                    });
32                });  
33
34            });
35
36        });
37    
38        function project_filter_ajax_slide () {
39
40            $(".ova-project-filter-ajax .slide-project").each(function(){
41
42                var owlsl     = $(this);
43                var owlsl_ops = owlsl.data('options') ? owlsl.data('options') : {};
44
45                var responsive_value = {
46                    0:{
47                        items:1,
48                        stagePadding : 0,
49                    },
50                    767:{
51                        items:2,
52                    },
53                    1024:{
54                        items:owlsl_ops.items 
55                    }
56                };
57              
58                owlsl.owlCarousel({
59                    rtl:false,
60                    margin: owlsl_ops.margin,
61                    stagePadding : owlsl_ops.stagePadding,
62                    items: owlsl_ops.items,
63                    loop: owlsl_ops.loop,
64                    autoplay: owlsl_ops.autoplay,
65                    autoplayTimeout: owlsl_ops.autoplayTimeout,
66                    center: false,
67                    nav: false,
68                    dots: owlsl_ops.dots,
69                    thumbs: owlsl_ops.thumbs,
70                    autoplayHoverPause: owlsl_ops.autoplayHoverPause,
71                    slideBy: owlsl_ops.slideBy,
72                    smartSpeed: owlsl_ops.smartSpeed,
73                    responsive: responsive_value,
74                });
75
76                /* Fixed WCAG */
77                owlsl.find(".owl-dots button").attr("title", "Dots");
78
79                /*****First Load ( add class )********/
80                owlsl.find('.owl-item.active').each( function(i) {
81                    if ( i === 0 ) {
82                        $(this).addClass('first-active');
83                    }
84                });
85                /*****On Changed********/
86                owlsl.on('changed.owl.carousel', function(event) {
87                    var that = $(this);
88                    that.find('.owl-item').removeClass('first-active');
89                    var index = event.item.index;
90                    that.find('.owl-item').each( function(i) {
91                        if ( i === index ) {
92                            $(this).addClass('first-active');
93                        }
94                    });
95                });
96                /*****On Dragged********/
97                owlsl.on('dragged.owl.carousel', function(event) {
98                    var that = $(this);
99                    that.find('.owl-item').removeClass('first-active');
100                    that.find('.owl-item.active:first').addClass('first-active');
101                }); 
102
103            });
104
105        }
106
107        function photo_gallery(){
108
109            $('.ova-project-filter-ajax .content-item').each( function(){
110                var that = $(this);
111                var photo = that.find('.button-gallery');
112                
113                photo.on('click', function(){
114                
115                    $('[data-fancybox="preview-data"]').fancybox({
116                        
117                        buttons : [
118                            'zoom',
119                            'download',
120                            'close'
121                        ],
122
123                        afterLoad : function(instance, current) {
124                            var current_index = current.index;
125                            $(".owl-item").removeClass('active');
126                            $( ".owl-item:nth-child("+ current_index +")" ).addClass('active');    
127                        },
128                        afterShow: function(instance, current) {
129                            var current_index = current.index;
130                            $('.slide-project').trigger('to.owl.carousel', current.index);
131                        }
132
133                    });
134                });
135            });
136        }
137
138        function load_ajax(term,template,posts_per_page,orderby,order){
139            
140            $.ajax({
141               url: ajax_object.ajax_url,
142               type: 'POST',
143               data: ({
144                   action: 'ova_load_project_filter',
145                   term: term,
146                   template: template,
147                   posts_per_page: posts_per_page,
148                   orderby: orderby,
149                   order : order
150                }),
151                success: function(data){
152                    if ( data != '' ){
153                        
154                        $('.ova-project-filter-ajax .content-item').empty();
155                        $('.ova-project-filter-ajax .content-item').append(data).fadeIn(300);
156                        $('.ova-project-filter-ajax .content-item').trigger('destroy.owl.carousel');
157                         
158                        project_filter_ajax_slide();
159                        photo_gallery();
160                    }
161                }
162            });
163        }         
164         
165    });
166
167})(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.