1jQuery(function($) { 2 var canBeLoaded = true, // this param allows to initiate the AJAX call only if necessary 3 bottomOffset = 4000; // the distance (in px) from the page bottom when you want to load more posts 4 5 $(window).scroll(function () { 6 var data = { 7 'action': 'loadmore', 8 'query': loadmore_params.posts, 9 'maxPage': loadmore_params.max_page, 10 'page': loadmore_params.current_page 11 }; 12 if ($(document).scrollTop() > ($(document).height() - bottomOffset) && canBeLoaded == true && data.maxPage > data.page) { 13 $.ajax({ 14 url: loadmore_params.ajaxurl, 15 data: data, 16 type: 'POST', 17 beforeSend: function (xhr) { 18 // you can also add your own preloader here 19 // you see, the AJAX call is in process, we shouldn't run it again until complete 20 canBeLoaded = false; 21 }, 22 success: function (data) { 23 if (data) { 24 $('.site-main').find('article:last-of-type').after(data); // where to insert posts 25 canBeLoaded = true; // the ajax is completed, now we can run it again 26 loadmore_params.current_page++; 27 } 28 } 29 }); 30 } 31 }); 32});
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.