PageSourceSearch

https://www.theengineroom.org/wp-content/themes/the-engine-room/js/news-load-more.js?ver=1.0.1

js theengineroom.org collected 2026-09-24 08:45:49 UTC 1,773 bytes, 53 lines download raw bytes

1function updateLoadMoreBtnVisibility() {
2    var totalPages = parseInt($(".load-more-btn").data("total-pages"), 10);
3    var currentPage = parseInt($(".load-more-btn").eq(0).data("page"), 10);
4
5    if (currentPage < totalPages) {
6        $(".load-more-btn").show();
7    } else {
8        $(".load-more-btn").hide();
9    }
10}
11
12jQuery(function ($) {
13    function loadPosts(formData, append = false) {
14        $.ajax({
15            url: myAjax.url,
16            type: 'POST',
17            data: formData + '&action=filter_posts',
18            beforeSend: function () {
19                if (!append) {
20                    $('#posts-container').html('<div class="col-md-12">Loading posts...</div>');
21                }
22            },
23            success: function (data) {
24                if (append) {
25                    $('#posts-container').append(data);
26                } else {
27                    $('#posts-container').html(data);
28                }
29                updateLoadMoreBtnVisibility();
30            },
31            error: function () {
32                $('#posts-container').html('<div class="col-md-12">An error occurred.</div>');
33            }
34        });
35    }
36
37    $('#filter-form').on('submit', function (event) {
38        event.preventDefault();
39        $(".load-more-btn").eq(0).data("page", 1);
40        var formData = $(this).serialize();
41        loadPosts(formData);
42    });
43
44    $(".load-more-btn").on("click", function () {
45        var formData = $("#filter-form").serialize();
46        var currentPage = parseInt($(".load-more-btn").eq(0).data("page"), 10);
47        var nextPage = currentPage + 1;
48        $(".load-more-btn").eq(0).data("page", nextPage);
49        loadPosts(formData + '&paged=' + nextPage, true);
50    });
51
52    updateLoadMoreBtnVisibility();
53});

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.