1jQuery(function($){ 2 // basic sanity log to ensure file loaded 3 console.log('[blog-ajax-numbered] script loaded'); 4 5 function loadBlogs(page) { 6 console.log('[blog-ajax-numbered] loading page:', page); 7 8 $.ajax({ 9 url: (typeof blog_ajax_obj !== 'undefined' && blog_ajax_obj.ajaxurl) ? blog_ajax_obj.ajaxurl : '/wp-admin/admin-ajax.php', 10 type: 'POST', 11 data: { 12 action: 'load_more_blogs_numbered', 13 page: page, 14 nonce: (blog_ajax_obj && blog_ajax_obj.nonce) ? blog_ajax_obj.nonce : '' 15 }, 16 beforeSend: function () { 17 $('#blog-list').html('<p class="text-center">Loading...</p>'); 18 }, 19 success: function (response) { 20 console.log('[blog-ajax-numbered] success response length:', $.trim(response).length); 21 if ($.trim(response) === '') { 22 $('#blog-list').html('<p class="text-center">No posts found.</p>'); 23 } else { 24 $('#blog-list').html(response); 25 } 26 // highlight active 27 $('.pagination li').removeClass('active'); 28 $('.pagination li[data-page="' + page + '"]').addClass('active'); 29 }, 30 error: function (xhr, status, error) { 31 console.error('[blog-ajax-numbered] AJAX error:', status, error, xhr.responseText); 32 $('#blog-list').html('<p class="text-center text-danger">Error loading posts. Check console/network.</p>'); 33 } 34 }); 35 } 36 37 // Delegated click handler: works for dynamic pagination 38 $(document).on('click', '.pagination a', function(e){ 39 e.preventDefault(); 40 var $li = $(this).closest('li'); 41 var page = $li.data('page') || $(this).data('page'); 42 if (!page) { 43 console.warn('[blog-ajax-numbered] clicked pagination item missing data-page'); 44 return; 45 } 46 loadBlogs(page); 47 48 // optional: push history state so back/forward works; comment if not wanted 49 try { 50 history.pushState({page: page}, '', '?paged=' + page); 51 } catch(e){ /* ignore */ } 52 }); 53 54 // handle browser back/forward 55 window.onpopstate = function(e) { 56 if (e.state && e.state.page) loadBlogs(e.state.page); 57 else loadBlogs(1); 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.