1(function($){ 2 3 $('.bam-block').on('click', '.bmajax-btn', function() { 4 5 var clickedBtn = $(this), 6 direction = clickedBtn.data('bmnextprev'), 7 currentBlock = clickedBtn.closest('.bam-block'), 8 blockInner = currentBlock.find('.bam-block-inner'), 9 dataContainer = clickedBtn.closest('.bmp-pagination-data'), 10 blockuid = dataContainer.data('blockuid'), 11 blockObj = window[blockuid], 12 excerptLength = parseInt(blockObj.excerpt_length), 13 currentPage = parseInt(blockObj.parameters.paged), 14 maxPages = parseInt(blockObj.max_pages); 15 16 var loader = $(currentBlock).prev('.bmw-spinner'); 17 18 $(clickedBtn).attr("disabled", true); 19 $(blockInner).css('opacity', '0.1'); 20 $(loader).css('display', 'inline-block'); 21 22 if ( direction == "next" ) { 23 currentPage = currentPage+1; 24 25 // Enable prev button disabled originally 26 prevBtn = clickedBtn.prev('.prev'); 27 $(prevBtn).attr("disabled", false); 28 29 } else if( direction == "prev" ) { 30 31 // If next button is disabled, enable it. 32 nextBtn = clickedBtn.next('.next'); 33 $(nextBtn).attr("disabled", false); 34 35 if( currentPage == 1 ) { 36 $(blockInner).css('opacity', '1'); 37 $(loader).css('display', 'none'); 38 } else { 39 currentPage = currentPage-1; 40 } 41 } 42 43 blockObj.parameters.paged = currentPage; 44 45 var params = JSON.stringify( blockObj.parameters ); 46 47 $.ajax({ 48 type: 'POST', 49 url: blockObj.ajaxurl, 50 data: { 51 action: 'bam_get_wp_query', 52 block_uid: blockuid, 53 parameters: params, 54 excerpt_length: excerptLength 55 }, 56 success: function(data, textStatus, XMLHttpRequest) { 57 $(blockInner).html(''); 58 $(blockInner).append(data); 59 $(blockInner).css('opacity', '1'); 60 $(loader).css('display', 'none'); 61 62 if ( direction == "next" && currentPage >= maxPages ) { 63 $(clickedBtn).attr("disabled", true); 64 } else if ( direction == "prev" && currentPage == 1 ) { 65 $(clickedBtn).attr("disabled", true); 66 } else { 67 $(clickedBtn).attr("disabled", false); 68 } 69 }, 70 error: function(MLHttpRequest, textStatus, errorThrown) { 71 console.log(errorThrown); 72 } 73 }); 74 75 }); 76 77})(jQuery);
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.