1(function($) { 2 "use strict"; 3 $(document).ready(function(){ 4 $( '.ya-portfolio' ).each(function(){ 5 var $this = $(this); 6 var $id = this.id; 7 var $pf_id = ('#' + this.id ); 8 var $ajax_url = ya_portfolio.ajax_url; 9 var $ya_style = $this.data('style'); 10 var $categories = $this.data('categories'); 11 var $max_page = $this.data('max_page'); 12 var $attributes = $this.data('attributes'); 13 var $number = $this.data('number'); 14 var $offset = $this.data('offset'); 15 var $orderby = $this.data('orderby'); 16 var $order = $this.data('order'); 17 var $container_id = $('#container_'+ $id); 18 var $tab_id = $('#tab_'+ $id); 19 var $container = $container_id; //The ID for the list with all the blog posts 20 if( $ya_style == 'fitRows' ){ 21 $container.imagesLoaded().progress( function() { 22 $container.isotope({ //Isotope options, 'item' matches the class in the PHP 23 layoutMode : 'fitRows' 24 }); 25 }); 26 }else{ 27 $container.imagesLoaded().progress( function() { 28 $container.isotope({ //Isotope options, 'item' matches the class in the PHP 29 layoutMode : 'masonry', 30 percentPosition: true, 31 masonry: { 32 columnWidth: '.portfolio-item' 33 } 34 }); 35 }); 36 } 37 38 //Add the class selected to the item that is clicked, and remove from the others 39 var $optionSets = $tab_id, 40 $optionLinks = $optionSets.find('li'); 41 $optionLinks.click(function(){ 42 var $this = $(this); 43 // don't proceed if already selected 44 if ( $this.hasClass('selected') ) { 45 return false; 46 } 47 var $optionSet = $this.parents($tab_id); 48 $optionSets.find('.selected').removeClass('selected'); 49 $this.addClass('selected'); 50 51 //When an item is clicked, sort the items. 52 var selector = $(this).attr('data-portfolio-filter'); 53 $container.isotope({ filter: selector }); 54 return false; 55 }); 56 var $page = 1; 57 var $btn_loadmore = $($pf_id + ' .btn-loadmore'); 58 $btn_loadmore.on("click", function(){ 59 if( $page >= $max_page ){ 60 return false; 61 } 62 $(this).addClass('btn-loading'); 63 jQuery.ajax({ 64 type: "POST", 65 url: $ajax_url, 66 data: ({ 67 action : "sw_portfolio_ajax", 68 catid : $categories, 69 numb : $number, 70 orderby: $orderby, 71 order : $order, 72 page : $page, 73 style : $ya_style, 74 attributes: $attributes 75 }), 76 success: function(data) { 77 console.log( data ); 78 var $newItems = $(data); 79 if( $newItems.length > 0 ){ 80 $newItems.imagesLoaded( function(){ 81 setTimeout(function(){ 82 $container_id.isotope('reloadItems').isotope("insert",$newItems); 83 }, 500); 84 }); 85 $btn_loadmore.removeClass('btn-loading'); 86 $page = $page + 1; 87 if( $newItems.length < $number ){ 88 $btn_loadmore.addClass( 'btn-loaded' ); 89 } 90 if( $page >= $max_page ){ 91 $btn_loadmore.addClass( 'btn-loaded' ); 92 } 93 94 95 }else{ 96 $btn_loadmore.removeClass('btn-loading').addClass( 'btn-loaded' ); 97 } 98 } 99 }); 100 }); 101 }); 102 $( '.item-popup' ).fancybox({ 103 helpers : { 104 title : { 105 type : 'over' 106 } 107 } 108 }); 109 }); 110})(jQuery); 111 112
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.