1/* 2 Filename: ajax-scroll.js 3 Description: js file for tags, author, news, etc. etc. 4 5*/ 6 7jQuery(document).ready(function($) { 8 9 var footer_offset = $('.news-module').offset().top; 10 11 // console.log(noMoreLeft); 12 // console.log(footer_offset); 13 14 // AJAX Scroll... 15 $(window).scroll(function() { 16 scrollDistance = $(window).scrollTop() + $(window).height(); 17 footerDistance = footer_offset; // $('#bottom').offset().top; 18 19 // console.log(scrollDistance); 20 21 if (scrollDistance >= footerDistance && !noMoreLeft) { 22 23 // Temporarily LOCK out this function from being hit again and again... 24 noMoreLeft = true; 25 // console.log('scroll detected'); 26 27 var $wrapper = $('#posts-section'), 28 $start = $('.post-item').length, 29 $args = $('input#args').length ? $('input#args').val() : '', 30 $args_val = $args !== '' ? $('input#' + $args).val() : ''; 31 32 $.ajax({ 33 url: Scroll.ajax_url, 34 type: 'post', 35 data: { 36 action: 'metro_posts_scroll', 37 security: Scroll.scroll_posts_nonce, 38 start: $start, 39 arg: $args, 40 arg_val: $args_val 41 }, 42 dataType: 'json' 43 }).done(function(response) { 44 console.log(response); 45 if (response.hasOwnProperty('error')) 46 alert(response['error']); 47 else if (response.hasOwnProperty('posts')) { 48 $wrapper.append(response['posts']); 49 50 // reset the footer_offset... 51 footer_offset = $('.news-module').offset().top; 52 noMoreLeft = !response['has_more']; 53 } 54 }).fail(function(response) { 55 alert('An Error Occurred.'); 56 }); 57 } 58 }); 59});
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.