1'use strict'; 2 3(function ($, app) { 4 $(document).ready(function () { 5 initLoadMoreButton(); 6 }); 7 8 function initLoadMoreButton() { 9 var button = $('button.load-more-posts'); 10 var dataBlock = $('.blog--archive-lead').parent(); 11 12 if (button.length < 1 || dataBlock.length < 1) return; 13 14 button.on('click', function () { 15 button.addClass('loading'); 16 var offset = dataBlock.data('post-count'); 17 var postsPerPage = dataBlock.data('posts-per-page'); 18 19 $.ajax({ 20 url: app.ajaxurl, 21 method: 'POST', 22 dataType: 'JSON', 23 data: { 24 action: 'fetch-older-posts', 25 offset: offset, 26 postsPerPage: postsPerPage 27 }, 28 success: function success(response) { 29 if (response.status === 'SUCCESS') { 30 dataBlock.data('post-count', offset + response.returned_posts); 31 $(response.posts).insertBefore('button.load-more-posts'); 32 33 if (!response.more_posts_available) { 34 button.remove(); 35 } 36 } 37 38 if (button.length) { 39 button.removeClass('loading'); 40 } 41 } 42 }); 43 }); 44 } 45})(jQuery, window.libaseApp);
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.