1/** 2 * Ajax frontend 3 * 4 * @package Fluida 5 */ 6 7 jQuery( document ).ready( function($) { 8 /* The number of the next page to load (/page/x/). */ 9 var page_number_next = parseInt( cryout_ajax_more.page_number_next ); 10 11 /* The maximum number of pages the current query can return. */ 12 var page_number_max = parseInt( cryout_ajax_more.page_number_max ); 13 14 /* The link of the next page of posts. */ 15 var page_link_model = cryout_ajax_more.page_link_model; 16 /** 17 * Replace the traditional navigation with our own, 18 * but only if there is at least one page of new posts to load. 19 */ 20 if( page_number_next <= page_number_max ) { 21 /* Insert the "More Posts" link. */ 22 $( cryout_ajax_more.content_css_selector ) 23 .append( '<div id="cryout_ajax_more_trigger"><span>{loadmore}</span></div>'.replace('{loadmore}', cryout_ajax_more.load_more_str ) ); 24 25 /* Remove the traditional navigation. */ 26 $( cryout_ajax_more.pagination_css_selector ).remove(); 27 } 28 29 /** 30 * Load new posts when the link is clicked. 31 */ 32 $( '#cryout_ajax_more_trigger' ).click( function() { 33 /* Loading gif */ 34 $( this ).addClass( 'cryout_click_loading' ); 35 36 if( page_number_next <= page_number_max ) { 37 38 /* Get the link for the next page to load */ 39 var next_link = page_link_model.replace(/9999999/, page_number_next); 40 41 /* Load the next page - only .post class */ 42 $( '<div>' ).load( next_link + ' .post', 43 function() { 44 $data = $( this ).find( 'article.post' ); 45 46 /* Add articles one by one */ 47 $data.each( function() { 48 $( this ).css( 'opacity', '0' ).appendTo( '#content-masonry' ); 49 }); 50 51 // If masonry enabled and magazine layout active 52 if ( ( fluida_settings.masonry == 1 ) && ( fluida_settings.magazine != 1 ) ) { 53 /* Add articles one by one */ 54 $data.each( function() { 55 $( this ).css( 'opacity', '0' ).appendTo( '#content-masonry' ); 56 }); 57 58 /* Load fitvids, masonry and animate scroll only after images have loaded */ 59 $( '#content-masonry' ).imagesLoaded( function() { 60 if ( fluida_settings.fitvids == 1 ) { $( '#content-masonry' ).fitVids().masonry( 'appended', $data ); } 61 else { $( '#content-masonry' ).masonry( 'appended', $data ); } 62 63 /* If an article animation is set, animate the new articles */ 64 if ( fluida_settings.articleanimation ) { animateScroll( $data ) }; 65 66 /* Removal of loading gif */ 67 $( '#cryout_ajax_more_trigger' ).removeClass( 'cryout_click_loading' ); 68 }); 69 } 70 71 else { // if not masonry 72 $data.each( function() { 73 $( this ).css( {'opacity': '1', 'transform': 'none', '-webkit-transform': 'none'} ).appendTo( '#content-masonry' ); 74 }); 75 if ( fluida_settings.fitvids == 1 ) { $( this ).fitVids(); } 76 if ( fluida_settings.articleanimation ) { animateScroll( $data ) }; 77 $( '#cryout_ajax_more_trigger' ).removeClass( 'cryout_click_loading' ); 78 } 79 /* Update page number and next_link. */ 80 page_number_next++; 81 82 /* Hide more posts button if there are no more pages to load */ 83 if( page_number_next > page_number_max ) { 84 $( '#cryout_ajax_more_trigger' ).remove(); 85 } 86 } 87 ); 88 89 } 90 return false; 91 }); 92});
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.