PageSourceSearch

https://tapestrycapital.ca/wp-content/themes/bb-theme-child/components/post-grids/post-grids.js?ver=447500276

js tapestrycapital.ca collected 2026-09-25 04:53:46 UTC 12,345 bytes, 344 lines download raw bytes

1jQuery(document).ready(function ($) {
2    console.log('post-grids.js ready');
3    
4    
5    
6    $(".post-content img").attr("srcset","")
7    
8    
9    
10    
11    
12    
13    
14    
15    
16    
17    
18    
19    
20    // Post Grid + Filter //
21    /*************/
22    /* Post Ajax */
23    /*************/
24    $('.cat-list_item').on('click', function() {
25        $('.cat-list_item').removeClass('active');
26        $(this).addClass('active');
27        //console.log($(this).data('slug'));
28        $.ajax({
29          type: 'POST',
30          url: '/wp-admin/admin-ajax.php',
31          dataType: 'html',
32          data: {
33            action: 'filter_projects',
34            category: $(this).data('slug'),
35          },
36          success: function(res) {
37            $('.project-tiles').html(res);
38            console.log(res);
39          }
40        })
41    });
42    $('.category-filters--go button').on('click', function(event) {
43        event.preventDefault();
44        var catString = '';
45        var txtString = '';
46        $(this).parents('.filter-form--content').find("input:checked").each(function( index ) {
47            //console.log($( this ).attr("value") );
48            //console.log($( this ).attr("data-taxonomy") );
49            catString += $( this ).attr("data-taxonomy") + ":" + $( this ).attr("value") + "&";
50        });
51        var gridType = '';
52        if($(".posts").hasClass("list")){
53            gridType = "list";
54        }else if($(".posts").hasClass("card")){
55            gridType = "card";
56        }else{
57            gridType = "grid";
58        }
59        console.log("==>"+gridType);
60        var readmore = $(".posts-container").data('readmore');
61        var numberperpage = $(".posts-container").data('numberperpage');
62        var postType = $(".posts-container").data('post');
63        txtString = "text" + ":" + $(this).parents('.filter-form--content').find("input[type=text]").val();
64        $.ajax({
65            type: 'POST',
66            url: '/wp-admin/admin-ajax.php',
67            dataType: 'html',
68            data: {
69              action: 'filter_projects',
70              category: catString,
71              text: txtString,
72              grid: gridType,
73              postType: postType,
74              numberperpage: numberperpage,
75              readmore: readmore
76            },
77            beforeSend: function() {
78                $('.posts-container').css("opacity", 0);
79                $('.posts-container').css("max-height","0px");
80
81                $('.loading').css("display", "block").delay( 500 ).queue(function(next){
82                    $('.loading').css("opacity","1");
83                    next();
84                });
85                $(".category-filters--go button").addClass("disable");
86                $(".filter_taxo_item_input").prop("disabled", true);
87            },
88            complete:function() {
89                $('.loading').css({
90                    "opacity":"0",
91                    "height":"0",
92                    "display":"none"
93                });
94              },
95            success: function(res) {
96                console.log("success");
97              $(".category-filters--go button").removeClass("disable");
98              $('.posts-container').css("max-height","5000px");
99              $('.posts-container').html(res);
100              $('.posts-container').css("opacity", 1);
101              $(".filter_taxo_item_input").prop("disabled", false);
102              $(".loadMore").each(
103                function(){
104                    if($(this).siblings(".posts").children(".active").length==$(this).siblings(".posts").children().length){
105                        $(this).hide();
106                    }
107                }
108            );
109              window.history.pushState("string1", "Title", window.location.pathname+'?'+catString+txtString);
110            }
111          })
112    });
113    $('.postsFilterForm input').on('change', function(event) {
114        event.preventDefault();
115        var catString = '';
116        var txtString = '';
117        $(this).parents('.filter-form--content').find("input:checked").each(function( index ) {
118            //console.log($( this ).attr("value") );
119            //console.log($( this ).attr("data-taxonomy") );
120            catString += $( this ).attr("data-taxonomy") + ":" + $( this ).attr("value") + "&";
121        });
122        var gridType = '';
123        if($(".posts").hasClass("list")){
124            gridType = "list";
125        }else if($(".posts").hasClass("card")){
126            gridType = "card";
127        }else{
128            gridType = "grid";
129        }
130        
131        var readmore = $(".posts-container").data('readmore');
132        var numberperpage = $(".posts-container").data('numberperpage');
133        var postType = $(".posts-container").data('post');
134        txtString = "text" + ":" + $(this).parents('.filter-form--content').find("input[type=text]").val();
135
136        $.ajax({
137            type: 'POST',
138            url: '/wp-admin/admin-ajax.php',
139            dataType: 'html',
140            data: {
141              action: 'filter_projects',
142              category: catString,
143              text: txtString,
144              grid: gridType,
145              postType: postType,
146              numberperpage: numberperpage,
147              readmore: readmore
148            },
149            beforeSend: function() {
150                $('.posts-container').css("opacity", 0);
151                $('.posts-container').css("max-height","0px");
152                $('.loading').css("display", "block").delay( 500 ).queue(function(next){
153                    $('.loading').css("opacity","1");
154                    next();
155                });
156                $(".category-filters--go button").addClass("disable");
157                $(".filter_taxo_item_input").prop("disabled", true);
158            },
159            complete:function() {
160                $('.loading').css({
161                    "opacity":"0",
162                    "height":"0",
163                    "display":"none"
164                });
165              },
166            success: function(res) {
167                console.log("success");
168              $(".category-filters--go button").removeClass("disable");
169              $('.posts-container').css("max-height","5000px");
170              $('.posts-container').html(res);
171              $('.posts-container').css("opacity", 1);
172              $(".filter_taxo_item_input").prop("disabled", false);
173              $(".loadMore").each(
174                function(){
175                    if($(this).siblings(".posts").children(".active").length==$(this).siblings(".posts").children().length){
176                        $(this).hide();
177                    }
178                }
179            );
180              window.history.pushState("string1", "Title", window.location.pathname+'?'+catString+txtString);
181            }
182        })
183    });
184
185    ///////////////////////////
186    // Toggle Filter Options //
187    ///////////////////////////
188    
189    function filter_toggle() {
190        $('.fl-archive--filter-refine').find('svg').toggleClass("active");
191        if($('.filter-form--content').hasClass('hidden')){
192            $('.filter-form--content').toggleClass('hidden');
193            setTimeout(function(){$('.filter-form--content').toggleClass('visible')},20);
194        }else{
195            $('.filter-form--content').toggleClass('visible');
196            setTimeout(function(){$('.filter-form--content').toggleClass('hidden')},520);
197        }
198        $(".fl-archive--filter").toggleClass("closed");
199    }
200    
201    $('.fl-archive--filter-refine').on({
202        click : function() {filter_toggle()},
203        keypress : function(e) {if (e.which == 13) filter_toggle()}
204        
205    });
206
207    $(document).on('keypress',function(e) {
208        if(e.which == 13) {
209            if ($(".fl-archive--filter-search input").is(":focus")) {
210                e.preventDefault();
211                $(".category-filters--go button").trigger("click")
212            }
213        }
214    });
215
216    $(document).on('keypress',function(e) {
217        if(e.which == 13) {
218            if ($(".fl-archive--filter-items ul li label").is(":focus")) {
219                e.preventDefault();
220                $(".fl-archive--filter-items ul li label:focus input").trigger("click")
221            }
222        }
223    });
224
225    function filter_items_toggle(che) {
226        if(che.siblings().hasClass('visible')){
227            che.parent().toggleClass('visible');
228            setTimeout(function(){che.siblings().toggleClass('visible')},20);
229        }else{
230            che.siblings().toggleClass('visible');
231            setTimeout(function(){che.parent().toggleClass('visible')},20);
232        }
233    }
234    
235    $('.unfoldable .filter-item--label-title').on({
236        click : function() {filter_items_toggle($(this))},
237        keypress : function(e) {if (e.which == 13) filter_items_toggle($(this))}
238    }); 
239
240   /*
241    $(".filter_taxo_item_input").on("click", function(){
242        $(this).parents(".filter_taxo_item").toggleClass("active");
243    })
244    */
245
246    //Load more Btn
247    $("body").on('click', ".loadMore_btn", function (e) {
248        var perpage = $(this).attr("class").split("perpage_")[1].split(" ")[0];
249        
250        $(this).parents(".posts-container").find(".post:not(.active)").each(function(){
251            if(perpage>0){
252                $(this).addClass("active").delay(50).queue(function(next){$('.post.active').addClass('visual');next();})
253            }
254            perpage--;
255        });
256        if($(this).parent().siblings(".posts-list, .posts").children(".active").length==$(this).parent().siblings(".posts-list, .posts").children().length){
257            $(this).parent().hide();
258        }
259    });
260
261    //Load more Btn hidden on fully loaded
262    $(".loadMore").each(
263        function(){
264            if($(this).siblings(".posts-list, .posts").children(".active").length==$(this).siblings(".posts-list, .posts").children().length){
265                $(this).hide();
266            }
267        }
268    );
269    //page button clickable
270    $("body").on("click", ".page_btn.list",
271        function () {
272            $(this).parent().siblings().children(".post-list.active").removeClass("active");
273            $(this).parent().siblings().children(".post-list.page_" + $(this).text()).addClass("active");
274            $(".page_btn").removeClass("active");
275            $(this).addClass("active");
276        }
277    );
278
279    $("body").on("click", ".page_btn:not(.list)",
280        function () {
281            $(this).parent().siblings().children(".post.active").removeClass("active");
282            $(this).parent().siblings().children(".post.page_" + $(this).text()).addClass("active");
283            $(".page_btn").removeClass("active");
284            $(this).addClass("active");
285        }
286    );
287
288    // Post Grid + Filter //
289    // Clear Updates Filter Selection (Resources)
290        $('.fl-archive--filter-clear span').click(function() {
291            $('.postsFilterForm input:checkbox').prop("checked", false);
292            $('.postsFilterForm input:text').val("");
293            setTimeout(() => {
294                $('.category-filters--go button').click();
295            }, 1000);
296            
297            //window.location.href=window.location.origin+window.location.pathname+'?clearAll=true';
298    });
299    $('.fl-archive--filter-clear span').on("keypress",function (e) {
300            if (e.which == 13) {
301                $('.postsFilterForm input:checkbox').prop("checked", false);
302                $('.postsFilterForm input:text').val("");
303                setTimeout(() => {
304                    $('.category-filters--go button').trigger("click");
305                }, 500);
306            }
307    });
308
309
310
311
312    // Search Results //
313    $(".search_results_item .fl-post-image").on("click",function(){
314        location.href = $(this).parent().find(".fl-post-text .fl-post-title-link").attr("href");
315    })
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330    ///////////////////
331    // WINDOW RESIZE //
332    ///////////////////
333    $(window).on( "resize", function() {
334        
335    });
336
337
338    ///////////////////
339    // WINDOW SCROLL //
340    ///////////////////
341    $(window).on( "scroll", function() {
342    
343    });
344})

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.