1// AJAX POST PAGINATION 2 3 jQuery(function() { 4 5 6 jQuery('.widget .ast_pagenav').each(function(index, element) { 7 if(jQuery(this).data('query-max') >= 10){ 8 jQuery(this).find('.page-numbers:nth-child(1), .page-numbers:nth-child(2), .page-numbers:nth-child(3), .page-numbers:nth-child(1), .page-numbers:nth-child(3), .page-numbers:nth-last-child(3), .page-numbers:nth-last-child(2), .page-numbers:nth-last-child(1)').addClass('pagi_visible'); 9 jQuery( this ).find('.page-numbers:nth-last-child(3)').before('<span class="pagi_dots">....</span>'); 10 }else{ 11 jQuery( this ).find('.page-numbers').addClass('pagi_visible'); 12 } 13 }); 14 15 16 //PAGINATION AJAX BEGIN 17 jQuery( '.widget .ast_pagenav .page-numbers, #nav-below a, .ast_navigation i, .widget .ast_pagenav .pagi_prev, .widget .ast_pagenav .pagi_next' ).on( "click", function(e) { 18 e.preventDefault(); 19 20 //Numbered Pagination Enhancement 21 if(jQuery(this).parent().data('query-max') >= 10){ 22 jQuery( this ).siblings().not('.page-numbers:nth-last-child(3), .page-numbers:nth-last-child(2), .page-numbers:nth-last-child(1)').removeClass('current current-next current-prev pagi_visible'); 23 jQuery( this ).parent().find('.pagi_dots').remove(); 24 jQuery( this ).addClass('current'); 25 jQuery( this ).next('.page-numbers').addClass('current-next pagi_visible'); 26 jQuery( this ).prev('.page-numbers').prev('.page-numbers').addClass('current-prev pagi_visible'); 27 jQuery( this ).prev('.page-numbers').addClass('current-prev pagi_visible'); 28 jQuery( this ).next('.page-numbers').after('<span class="pagi_dots">....</span>'); 29 30 if(jQuery( this ).is('.page-numbers:nth-last-child(1), .page-numbers:nth-last-child(2), .page-numbers:nth-last-child(3), .page-numbers:nth-last-child(4), .page-numbers:nth-last-child(5)')){ 31 jQuery( this ).siblings().removeClass('current'); 32 jQuery( this ).addClass('current'); 33 jQuery( this ).parent().find('.pagi_dots').remove(); 34 jQuery( this ).parent().find('.page-numbers:nth-last-child(4)').before('<span class="pagi_dots">....</span>'); 35 } 36 if(jQuery( this ).is('.page-numbers:nth-last-child(1), .page-numbers:nth-last-child(2)')){ 37 jQuery( this ).siblings().removeClass('current current-next current-prev pagi_visible'); 38 jQuery( this ).parent().find('.pagi_dots').remove(); 39 jQuery( this ).addClass('current'); 40 jQuery( this ).next('.page-numbers').addClass('current-next pagi_visible'); 41 jQuery( this ).prev('.page-numbers').addClass('current-prev pagi_visible'); 42 jQuery( this ).prev('.page-numbers').prev('.page-numbers').prev('.page-numbers').prev('.page-numbers').addClass('current-prev pagi_visible'); 43 jQuery( this ).prev('.page-numbers').prev('.page-numbers').prev('.page-numbers').addClass('current-prev pagi_visible'); 44 jQuery( this ).prev('.page-numbers').prev('.page-numbers').addClass('current-prev pagi_visible'); 45 jQuery( this ).parent().find('.page-numbers:nth-last-child(3)').before('<span class="pagi_dots">....</span>'); 46 } 47 }else{ 48 jQuery( this ).siblings().removeClass('current'); 49 jQuery( this ).addClass('current'); 50 } 51 52 53 //Ajax Loading Animation 54 jQuery(this).parentsUntil('.optimposts').find('.hentry, .type-product').animate({"opacity":"0.4"}); 55 56 57 var pagi = jQuery(this).parentsUntil('.optimposts').parent(); 58 var ajaxurl = postsq.ajaxurl; 59 var layout= pagi.data('post-layout'); 60 var type= pagi.data('post-type'); 61 var count= pagi.data('post-count'); 62 var pages= pagi.data('post-pages'); 63 var category= pagi.data('post-category'); 64 var product_category= pagi.data('product-category'); 65 var previewbtn= pagi.data('post-previewbtn'); 66 var linkbtn= pagi.data('post-linkbtn'); 67 var navigation= pagi.data('post-navigation'); 68 69 if(navigation =='numbered'){ 70 var nextpage= jQuery(this).text(); 71 } 72 73 74 if(navigation =='infscroll' || navigation =='infscroll_auto'){ 75 var nextpage= jQuery(this).parent().parent().data('infinte-next'); 76 } 77 78 if(navigation =='oldnew'){ 79 var nextpage = jQuery(this).parent().parent().data('query-count'); 80 //If Next Button is clicked 81 if(jQuery(this).hasClass('fa-angle-right')){ 82 if(nextpage == jQuery(this).parent().parent().data('query-max')){}else{ 83 var nextpage = nextpage + 1 ; 84 } 85 } 86 //If Previous Button is clicked 87 if(jQuery(this).hasClass('fa-angle-left')){ 88 if(nextpage == 1){}else{ 89 var nextpage = nextpage -1 ; 90 } 91 } 92 } 93 94 var value = jQuery.ajax({ 95 96 type: "POST", 97 url: ajaxurl,
98 context: this, 99 data:{ 100 "layout": layout, 101 "type": type, 102 "count": count, 103 "pages": pages, 104 "category": category, 105 "product_category": product_category, 106 "previewbtn": previewbtn, 107 "previewbtn": previewbtn, 108 "nextpage": nextpage, 109 action: "optimizer_posts", 110 beforeSend: function(){ 111 if(navigation =='infscroll_auto'){ 112 jQuery('div[data-post-navigation="infscroll_auto"] #nav-below').addClass('infscroll--loading'); 113 } 114 } 115 } 116 117 }) 118 .fail(function(r,status,jqXHR) { 119 console.log("failed"); 120 if(navigation =='infscroll_auto'){ 121 jQuery('div[data-post-navigation="infscroll_auto"] #nav-below').removeClass('infscroll--loading'); 122 } 123 }) 124 .done(function(response,status,jqXHR) { 125 //console.log(navigation); 126 console.log(product_category); 127 //console.log(response); 128 var ajaxsource = jQuery('<div>' + response + '</div>'); 129 var newappend = ajaxsource.find('.lay'+layout+'_wrap_ajax').html(); 130 131 if(navigation =='numbered'){ 132 jQuery(this).parentsUntil('.optimposts').find('.lay'+layout+'_wrap_ajax').html(newappend); 133 //console.log(response); 134 //console.log(newappend); 135 //jQuery('html, body').animate({scrollTop: jQuery(this).parentsUntil('.optimposts').offset().top -100}, 'medium'); 136 } 137 if(navigation =='infscroll' || navigation =='infscroll_auto'){ 138 var currentpage = jQuery(this).parent().parent().data('infinte-next'); 139 jQuery(this).parent().parent().data('infinte-next', currentpage + 1); 140 //jQuery('html, body').animate({scrollTop: jQuery(this).offset().top -300}, 'medium'); 141 if(layout !== '3'){ 142 jQuery(this).parentsUntil('.optimposts').find('.lay'+layout+'_wrap_ajax').append(newappend); 143 } 144 var postoucnt = jQuery(this).parentsUntil('.optimposts').find('.lay'+layout+'_wrap_ajax .hentry').length; 145 146 if(postoucnt >= jQuery(this).parent().parent().data('infinite-max') ){ 147 jQuery(this).parent().parent().addClass('infloaded'); 148 } 149 } 150 //} 151 if(navigation =='infscroll_auto'){ 152 jQuery('div[data-post-navigation="infscroll_auto"] #nav-below').removeClass('infscroll--loading'); 153 } 154 155 if(navigation =='oldnew'){ 156 jQuery(this).parentsUntil('.optimposts').find('.lay'+layout+'_wrap_ajax').html(newappend); 157 jQuery(this).parent().parent().data('query-count', nextpage); 158 if(nextpage == jQuery(this).parent().parent().data('query-max')){ 159 jQuery(this).parent().parent().find('.fa-angle-right').addClass('nav_maxed'); 160 }else{jQuery(this).parent().parent().find('.fa-angle-right').removeClass('nav_maxed');} 161 if(nextpage == 1){ 162 jQuery(this).parent().parent().find('.fa-angle-left').addClass('nav_maxed'); 163 }else{jQuery(this).parent().parent().find('.fa-angle-left').removeClass('nav_maxed');} 164 } 165 166 //Layout1 Animation 167 jQuery(".lay1").each(function(index, element) { 168 var divs = jQuery(this).find(".hentry"); 169 for(var i = 0; i < divs.length; i+=3) { 170 divs.slice(i, i+3).wrapAll("<div class='ast_row'></div>"); 171 } 172 if (jQuery(window).width() < 1200) { 173 var flaywidth = jQuery(this).find(".hentry").width(); 174 jQuery(this).find('.post_image').css({"maxHeight":(flaywidth * 66)/100}); 175 } 176 }); 177 178 jQuery('.lay1.optimposts, .lay2.optimposts, .lay4.optimposts').each(function(index, element) { jQuery(this).waitForImages(function() { jQuery(this).find('.type-product').matchHeight({ property: 'min-height'}); }); }); 179 jQuery('.lay1.optimposts .type-product').each(function(index, element) { 180 jQuery(this).find('.button.add_to_cart_button').prependTo(jQuery(this).find('.imgwrap')); 181 jQuery(this).find('span.price').prependTo(jQuery(this).find('.post_image ')); 182 }); 183 184 //FrontPage Post Image Zoom 185 186 if (typeof magnificPopup !== 'undefined' ) { 187 jQuery(".imgzoom[href$='.jpg'], .imgzoom[href$='.png'], .imgzoom[href$='.gif']").magnificPopup({type:'image',image: {titleSrc: 'data-title'}}
187); 188 } 189 190 191 //LAYOUT 3 MASONRY 192 if(layout == 3 && ( navigation == 'numbered' || navigation == 'oldnew')){ 193 var container = jQuery(this).parentsUntil('.optimposts').find('.lay3_wrap_ajax'); 194 console.log(container); 195 //Layout3 Masonry 196 var msnry; 197 imagesLoaded( container, function() { 198 container.masonry({ 199 // options 200 itemSelector: '.hentry' 201 }); 202 }); 203 } 204 //LAYOUT 3 MASONRY with Infinite Scroll 205 if(layout == 3 && navigation == 'infscroll' || layout == 3 && navigation == 'infscroll_auto'){ 206 var container = jQuery(this).parentsUntil('.optimposts').find('.lay3_wrap_ajax'); 207 imagesLoaded( container, function() { 208 container.masonry({ 209 // options 210 itemSelector: '.hentry' 211 }); 212 }); 213 jQuery(this).parentsUntil('.optimposts').find('.lay3_wrap').css({"height":"auto"}); 214 container.masonry('reloadItems'); 215 } 216 217 218 }); 219 220 //Ajax Loading Animation 221 jQuery(this).parentsUntil('.optimposts').find('.hentry, .type-product').animate({"opacity":"1"}); 222 223 }); 224 225 document.addEventListener("scroll", function(evt){ 226 var infnsCrollContainer = jQuery('div[data-post-navigation="infscroll_auto"] #nav-below'); 227 if( infnsCrollContainer ){ 228 infnsCrollContainer.each(function(index, element) { 229 if(optimizer_is_in_view(infnsCrollContainer[0]) && !infnsCrollContainer.hasClass('infscroll--loading')){ 230 var postoucnt = jQuery(this).parentsUntil('.optimposts').find('.hentry').length; 231 if(postoucnt >= jQuery(this).data('infinite-max') ){ 232 jQuery(this).addClass('infloaded'); 233 jQuery(this).find('a').html('<i class="fa fa-smile-o"></i> Loading Complete'); 234 }else{ 235 jQuery(this).find('a').html('<i class="fa fa-circle-o-notch fa-spin"></i> Loading..'); 236 jQuery(this).find('a').click(); 237 } 238 } 239 240 }); 241 } 242 }); 243 244 });
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.