PageSourceSearch

https://cvillehabitat.org/wp-content/themes/hfh/js/impact-reports.js?ver=1.0

js cvillehabitat.org collected 2026-09-26 08:53:10 UTC 2,682 bytes, 81 lines download raw bytes

1jQuery(document).ready(function ($) {
2    let grid = $('#impact-reports-grid');
3    let loadMoreBtn = $('.load-more-reports');
4    let loadAllBtn = $('.load-all-reports');
5    let loadLessBtn = $('.load-less-reports');
6    let totalPosts = parseInt($('.impact-reports-wrapper').data('total'));
7    let offset = parseInt(loadMoreBtn.data('offset'));
8    let limit = offset;
9    let ajaxUrl = impactReports.ajax_url; // localized in PHP
10
11    // Smooth scroll helper
12    //function scrollToGrid(element) {
13      //  $('html, #impact-reports-grid').animate({
14        //    scrollTop: element.offset().top - 100 // adjust offset as needed
15        //}, 600, 'swing');
16   // }
17   
18  
19
20
21    // Load More
22    loadMoreBtn.on('click', function () {
23        loadAllBtn.addClass('d-none');
24        $.post(ajaxUrl, {
25            action: 'load_more_impact_reports',
26            offset: offset,
27            limit: limit,
28            type: 'more'
29        }, function (response) {
30            // Fade-in newly loaded posts
31            let newItems = $(response).hide();
32            grid.append(newItems);
33            newItems.fadeIn(400);
34
35            offset += limit;
36            if (offset >= totalPosts) {
37                loadMoreBtn.addClass('d-none');
38                loadAllBtn.addClass('d-none');
39                loadLessBtn.removeClass('d-none');
40            }
41        });
42    });
43
44    // Load All
45    loadAllBtn.on('click', function () {
46        $.post(ajaxUrl, {
47            action: 'load_more_impact_reports',
48            type: 'all'
49        }, function (response) {
50            grid.fadeOut(300, function () {
51                $(this).html(response).fadeIn(400);
52            });
53            loadMoreBtn.addClass('d-none');
54            loadAllBtn.addClass('d-none');
55            loadLessBtn.removeClass('d-none');
56        });
57    });
58
59    // Load Less
60    loadLessBtn.on('click', function () {
61        $.post(ajaxUrl, {
62            action: 'load_more_impact_reports',
63            type: 'less'
64        }, function (response) {
65            grid.fadeOut(300, function () {
66                $(this).html(response).fadeIn(400);
67                // scrollToGrid(grid); // smooth scroll back to grid top
68                // scrollToGrid('impact-reports-grid');
69                var headerHeight = $('#main-header').outerHeight(); 
70
71                    $('html, body').animate({
72                        scrollTop: $('#habitat-report').offset().top - headerHeight - 100
73                    }, 600);
74            });
75            offset = limit;
76            loadMoreBtn.removeClass('d-none');
77            loadAllBtn.removeClass('d-none');
78            loadLessBtn.addClass('d-none');
79        });
80    });
81});

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.