1(function(){ 2 // Save current page 3 if(typeof sns.query_vars !== 'undefined'){ 4 _current_page = sns.query_vars.paged; 5 }else{ 6 _current_page = -1; 7 } 8 if(_current_page == 0) _current_page = 1; 9 // Flag to check if an ajax is executing 10 _ajax_loading = false; 11 12 function snshadona_do_ajax($blog_layout){ 13 if( jQuery('#navigation-ajax').length > 0 ){ 14 jQuery('#navigation-ajax').on('click', function(e){ 15 e.preventDefault(); 16 jQuery(this).addClass('snsnav-active'); 17 if( _current_page > -1 && !_ajax_loading){ 18 item_template = jQuery(this).attr('data-template'); 19 20 data = { 21 action: 'load_more', 22 page: _current_page, 23 template: item_template, 24 snshadona_blog_layout: $blog_layout, 25 vars: sns.query_vars, 26 }; 27 28 content_div = jQuery(this).attr('data-target'); 29 30 _ajax_loading = true; 31 jQuery.ajax({ 32 type: 'POST', 33 url: sns.ajaxurl, 34 cache: false, 35 data: data, 36 success: function(data, textStatus, XMLHttpRequest){ 37 if(data !=''){ 38 // Do something fancy before appending data 39 jQuery('#navigation-ajax').removeClass('snsnav-active'); 40 // Then append data 41 42 // blog masonry 43 if(jQuery('.sns-grid-masonry').length > 0){ 44 var newItems = jQuery(data).appendTo(content_div); 45 jQuery(content_div).masonry('appended', newItems); 46 47 var ImagesLoaded = imagesLoaded( document.querySelector(content_div) ); 48 ImagesLoaded.on( 'done', function(instance){ 49 jQuery('.sns-grid-masonry').masonry({ 50 // options 51 itemSelector: '.sns-grid-item', 52 }); 53 }); 54 }else{ 55 jQuery(content_div).append(data); 56 } 57 58 // increase current page 59 _current_page = _current_page + 1; 60 // Hide button load more if no posts 61 if( jQuery('#sns-load-more-no-posts').length > 0 ){ 62 jQuery('.navigation-ajax').hide(); 63 } 64 }else{ 65 _current_page = -1; 66 // Do something else when there is no more results 67 jQuery('.navigation-ajax').hide(); 68 } 69 70 _ajax_loading = false; 71 }, 72 error: function(MLHttpRequest, textStatus, errorThrown){ 73 alert(errorThrown); 74 _ajax_loading = false; 75 } 76 }); 77 } 78 }); 79 } 80 } 81 82 jQuery(document).ready(function($){ 83 var $snshadona_blog_layout = $('input[name="hidden_snshadona_blog_layout"]').val(); 84 snshadona_do_ajax($snshadona_blog_layout); 85 }); 86 87})();
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.