1jQuery(document).ready(function () { 2 3 4 jQuery(window).on("load", function () { 5 /*------------------------------------------------------------------ 6 [ Portfolio items & filtering ] 7 */ 8 9 jQuery(document).on('click', '.blog-block .filter-button-group button:not(.active),.portfolio-block .filter-button-on-side button:not(.active),.portfolio-block .filter-button-group button:not(.active)', function () { 10 var $grid = jQuery(this).parents('.portfolio-block, .blog-block').find('.isotope'); 11 12 if ($grid.length == 0) return; 13 14 jQuery(this).addClass('active').siblings().removeClass('active'); 15 16 var filterValue = jQuery(this).attr('data-filter'); 17 if (jQuery(this).parents('.portfolio-block, .blog-block').find('.loadmore-button').length > 0) { 18 jQuery(this).parents('.portfolio-block, .blog-block').find('.loadmore-button').trigger('click', [false]); 19 } else { 20 $grid.isotope({ 21 filter: filterValue 22 }); 23 } 24 25 jQuery(window).trigger('resize').trigger('scroll'); 26 }); 27 28 29 /*------------------------------------------------------------------ 30 [ Portfolio items & filtering ] 31 */ 32 jQuery('.portfolio-items:not(.disable-iso)').each(function(){ 33 var $grid = jQuery(this).addClass('isotope').isotope({ 34 itemSelector: 'article', 35 horizontalOrder: true, 36 masonry: { 37 columnWidth: '.grid-sizer' 38 } 39 }); 40 }); 41 42 jQuery('.category-items').each(function(){ 43 var $grid = jQuery(this).isotope({ 44 itemSelector: '.item' 45 }); 46 }); 47 48 jQuery('.post-gallery-masonry').each(function(){ 49 var $grid = jQuery(this).isotope({ 50 itemSelector: 'div' 51 }); 52 }); 53 54 /*------------------------------------------------------------------ 55 [ Blog items & filtering ] 56 */ 57 jQuery('.blog-items:not(.disable-iso)').each(function(){ 58 var $grid = jQuery(this).addClass('isotope').isotope({ 59 itemSelector: 'article' 60 }); 61 }); 62 }); 63 64 jQuery('.portfolio-block, .blog-block').YPRMLoadMore(); 65 66}); 67 68(function (jQuery) { 69 "use strict"; 70 jQuery.fn.YPRMLoadMore = function (options) { 71 72 function rebuild_array(src, filt) { 73 var result = []; 74 75 for (let index = 0; index < src.length; index++) { 76 let id = src[index].id, 77 flag = false; 78 for (let index2 = 0; index2 < filt.length; index2++) { 79 let id2 = filt[index2].id; 80 if (id == id2) { 81 flag = true; 82 break; 83 } 84 } 85 if (!flag) { 86 result.push(src[index]); 87 } 88 } 89 90 return JSON.stringify(result); 91 } 92 93 function getFromCategory(array, slug, count, return_type) { 94 var result = [], 95 i = 0; 96 97 for (let index = 0; index < array.length; index++) { 98 let flag = false; 99 100 if(typeof array[index].cat === undefined || typeof array[index].cat === 'undefined') continue; 101 102 for (let index2 = 0; index2 < array[index].cat.length; index2++) { 103 if (array[index].cat[index2] == slug) { 104 flag = true; 105 break; 106 } 107 } 108 if (flag) { 109 i++; 110 result.push(array[index]); 111 } 112 113 if (i == count && !return_type) { 114 break; 115 } 116 } 117 118 if (result == []) { 119 return false; 120 } 121 122 return result; 123 } 124 125 return this.each(function () { 126 var $this = jQuery(this), 127 $button = $this.find('.loadmore-button'), 128 $filter = $this.find('[class^="filter-butt"]'), 129 $items = $this.find('.load-wrap'), 130 type = $button.attr('data-type'), 131 action = 'loadmore_'+$button.attr('data-action'), 132 count = $button.attr('data-count'), 133 style = $button.attr('data-style'); 134 135 $this.append('<div class="load-items-area"></div>'); 136 137 $items.css('min-height', $items.find('article').height()); 138 139 $button.on('click', function (event, loading) { 140 if(typeof loading === undefined || loading === undefined) { 141 loading = true 142 } 143 144 var array = JSON.parse($button.attr('data-array')), 145 atts = JSON.parse($button.attr('data-atts')), 146 load_items = array.slice(0, count), 147 filter_value = '*'; 148 149 if ($filter.length > 0) { 150 var filter_value = $filter.find('.active').attr('data-filter'), 151 slug = filter_value.replace('.category-', ''), 152 current_count = $items.find(filter_value).length; 153 154 if (filter_value != '*') { 155 var cat_full_length = getFromCategory(array, slug, count, true).length, 156 cat_length = getFromCategory(array, slug, count, false).length; 157 158 if (current_count < count && cat_full_length != 0) { 159 load_items = getFromCategory(array, slug, count - current_count, false); 160 loading = true; 161 } else if (loading) { 162 load_items = getFromCategory(array, slug, count, false); 163 } 164 165 if((loading && cat_full_length - load_items.length <= 0) || (!loading && cat_full_length == 0)) { 166 $button.fadeOut(); 167 } else { 168 $button.fadeIn(); 169 } 170 } else { 171 $button.fadeIn(); 172 } 173 174 $items.isotope({ 175 filter: filter_value 176 }); 177 } 178 179 if (!loading) { 180 return false; 181 } 182 183 $button.addClass('loading'); 184 185 jQuery.ajax({ 186 url: yprm_ajax.url, 187 type: "POST", 188 data: { 189 action: action, 190 array: load_items, 191 atts: atts, 192 type: type, 193 style: style, 194 start_index: $this.find('article').length 195 }, 196 success: function (data) { 197 var temp_block = $this.find('.load-items-area').append(data); 198 array = rebuild_array(array, load_items); 199 200 temp_block.imagesLoaded(function () { 201 202 var items = temp_block.find('article'); 203 204 if($items.hasClass('isotope')) { 205 $items.append(items).isotope('appended', items).isotope({ 206 filter: filter_value 207 }).queue(function (next) { 208 jQuery(this).find('.wpb_animate_when_almost_visible:not(.wpb_start_animation)').each(function () { 209 var $el = jQuery(this); 210 211 $el.vcwaypoint(function () { 212 $el.addClass("wpb_start_animation animated") 213 }, { 214 offset: "85%" 215 }); 216 }); 217 next(); 218 }); 219 } else { 220 $items.append(items).queue(function (next) { 221 jQuery(this).find('.wpb_animate_when_almost_visible:not(.wpb_start_animation)').each(function () { 222 var $el = jQuery(this); 223 224 $el.vcwaypoint(function () { 225 $el.addClass("wpb_start_animation animated") 226 }, { 227 offset: "85%" 228 }); 229 }); 230 next(); 231 }); 232 } 233 234 }); 235 236 $button.attr('data-array', array).removeClass('loading'); 237 if (array == '[]') { 238 $button.parent().slideUp(); 239 } 240 }, 241 error: function (errorThrown) { 242 console.log(errorThrown); 243 } 244 }); 245 }); 246 });
247 }; 248 249})(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.