1jQuery(document).ready(function($){ 2 "use strict"; 3 4 if ($('div.portfolio').length) { 5 $('div.portfolio').each(function(){ 6 7 'use strict'; 8 9 var portfolio=$(this); 10 11 var getPortMasonry=function(mod){ 12 'use strict'; 13 14 var $container=$('.portfolio-container',mod),modwidth=$container.outerWidth(true),$gutter=($container.data('type')=='vcimage' || $container.data('type')=='imagefull' || $container.data('type')=='imagefixheightfull')?0:30, 15 masonryCol=($container.data('col'))?$container.data('col'):2; 16 17 18 19 if($(window).width() >= 992 && $(window).width() < 1024){ 20 21 masonryCol=($container.data('col'))?$container.data('col')-1:2; 22 23 }else if($(window).width() >= 768 && $(window).width() < 992){ 24 masonryCol=($container.data('col')==6)?4: ($container.data('col')==5)?3:($container.data('col')==4)?2:2; 25 26 }else if($(window).width() >= 480 && $(window).width() < 768){ 27 28 masonryCol=2; 29 30 }else if($(window).width() < 480){ 31 masonryCol=1; 32 } 33 34 35 function adjustItem(element,gap,modwidth){ 36 37 38 for (var index = 0; index < element.length; ++index) { 39 40 41 var targetWidth=$(element[index]).data('width') + (gap/modwidth*$(element[index]).data('width')); 42 targetWidth=Math.floor(targetWidth*10)/10; 43 $(element[index]).width(targetWidth); 44 45 } 46 47 } 48 49 masonryCol=Math.floor((modwidth-($gutter*(masonryCol - 1)))/masonryCol); 50 51 var someRow=[],curWidth=0; 52 53 $(".portfolio-item",$container) 54 .each(function(i,el){ 55 if($container.data('type')=='text'){ 56 $(this).width(masonryCol).height(masonryCol+30); 57 $('.post-image-container',$(this)).height(masonryCol/2); 58 } 59 else if($container.data('type')=='imagefixheightfull'){ 60 61 62 var img=$('.post-image img',$(el)),imgWidth=img.data('width'),imgHeight=img.data('height'),gap=modwidth - curWidth; 63 64 if(gap > imgWidth){ 65 66 curWidth=curWidth+imgWidth; 67 someRow.push(img); 68 } 69 else{ 70 71 if(gap >= imgWidth/2){ 72 73 someRow.push(img); 74 curWidth=curWidth+imgWidth; 75 adjustItem(someRow,modwidth-curWidth,curWidth); 76 someRow=[]; 77 curWidth=0; 78 79 } 80 else{ 81 82 adjustItem(someRow,gap,(someRow.length > 1)?curWidth:someRow[0].data('width')); 83 someRow=[img]; 84 curWidth=imgWidth; 85 } 86 } 87 } 88 else{ 89 $('img',$(this)).width(masonryCol); 90 $('.top-image',$(this)).height(masonryCol); 91 $('figcaption',$(this)).outerHeight(masonryCol); 92 $(this).width(masonryCol).height(masonryCol); 93 } 94 }); 95 96 97 var reloadMore=function($el){ 98 'use strict'; 99 100 $('.portfolio-navigation .more-post',$el.parents('.portfolio')).unbind('click').click(function(e){ 101 e.preventDefault(); 102 103 var scriptUrl=$(this).attr('href'),hashChanged=true,removeItem = $(this), 104 $preloader=$('<div class="portfolio_loader"></div>'),$navigation_container=$(this).parents('.portfolio-navigation'); 105 $navigation_container.append($preloader); 106 $(this).remove(); 107 108 109 $.ajax({ 110 url: scriptUrl+'&t='+$.now()+'&type='+$el.data('type')+'&col='+$el.data('col'), 111 type: 'get', 112 dataType: 'html', 113 async: true, 114 success: function(html) { 115 116 var filtered=$(html).find('.portfolio-item'); 117 var navigation=$(html).find('.portfolio-navigation .more-post'); 118 119 filtered.each(function(i,el){ 120 121 if($el.data('type')=='text'){ 122 123 124 $(el).width(masonryCol).height(masonryCol); 125 $('.post-image-container',$(el)).height(masonryCol/2); 126 } 127 else if($el.data('type')=='imagefixheightfull'){ 128 129 var img=$('.post-image img',$(el)),imgWidth=img.data('width'),imgHeight=img.data('height'),gap=modwidth - curWidth; 130 131 if(gap > imgWidth){ 132 133 curWidth=curWidth+imgWidth; 134 someRow.push(img); 135 } 136 else{ 137 138 if(gap >= imgWidth/2){ 139 140 someRow.push(img); 141 curWidth=curWidth+imgWidth; 142 adjustItem(someRow,modwidth-curWidth,curWidth); 143 someRow=[]; 144 curWidth=0; 145 146 } 147 else{ 148 149 adjustItem(someRow,gap,(someRow.length > 1)?curWidth:someRow[0].data('width')); 150 someRow=[img]; 151 curWidth=imgWidth; 152 } 153 } 154 155 } 156 else{ 157 158 $('img',$(el)).width(masonryCol); 159 $(el).width(masonryCol).height(masonryCol); 160 } 161 162 $el.isotope('insert',$(el)).isotope('reloadItems'); 163 164 }); 165 166 $('.popup-gallery',$('<div>'+html+'</div>')).each(function(i,el){ 167 168 $(el).insertBefore('.md-overlay'); 169 170 }); 171 172 $navigation_container.append(navigation.css('display','inline-block')); 173 $preloader.remove(); 174 175 176 initModal(); 177 reloadMore($el); 178 hashChanged=false; 179 $(window).resize(); 180 181 } 182 183 184 }); 185 }); 186 }, 187 initModal=function () {
188 var overlay = document.querySelector( '.md-overlay' ); 189 [].slice.call( document.querySelectorAll( '.md-trigger' ) ).forEach( function( el, i ) { 190 var modal = document.querySelector( '#' + el.getAttribute( 'data-modal' ) ), 191 close = modal.querySelector( '.md-close' ); 192 function removeModal( hasPerspective ) { 193 classie.remove( modal, 'md-show' ); 194 if( hasPerspective ) { 195 classie.remove( document.documentElement, 'md-perspective' ); 196 } 197 } 198 function removeModalHandler() { 199 removeModal( classie.has( el, 'md-setperspective' ) ); 200 } 201 el.addEventListener( 'click', function( ev ) { 202 203 if(!$('.modal_preloader').length){ 204 $('body').prepend("<div class='modal_preloader'><div class='modal_spinner-container'><div class='modal_loader'></div></div></div>"); 205 } 206 207 if(!modal.loaded){ 208 $('.modal_loader').fadeIn('slow'); 209 $('.modal_preloader').delay(350).fadeIn('slow'); 210 211 if($('img',modal).length){ 212 213 var all=$('img',modal).length,elDone=1,timeout = null; 214 215 216 $('img',modal).each(function(i,e){ 217 218 var im=$(this).attr('rel'), 219 img = new Image(); 220 $(this).attr('src',im); 221 img.src = im; 222 img.onload=function() { 223 timeout = setTimeout(function() { 224 if (img.complete) { 225 $('.modal_loader').fadeOut('slow'); 226 $('.modal_preloader').delay(350).fadeOut('slow'); 227 modal.loaded=true; 228 classie.add( modal, 'md-show' ); 229 clearTimeout(timeout); 230 } 231 },1000); 232 elDone=elDone+1; 233 }; 234 235 if(all=elDone){ 236// modal.loaded=true; 237// classie.add( modal, 'md-show' ); 238 } 239 }); 240 241 } 242 else{ 243 modal.loaded=true; 244 } 245 } 246 247 if(modal.loaded){ 248 classie.add( modal, 'md-show' ); 249 } 250 251 overlay.removeEventListener( 'click', removeModalHandler ); 252 overlay.addEventListener( 'click', removeModalHandler ); 253 if( classie.has( el, 'md-setperspective' ) ) { 254 setTimeout( function() { 255 classie.add( document.documentElement, 'md-perspective' ); 256 }, 25 ); 257 } 258 }); 259 close.addEventListener( 'click', function( ev ) { 260 ev.stopPropagation(); 261 removeModalHandler(); 262 }); 263 }); 264 }; 265 266 267 try{ 268 269 if($container.data('type')=='imagefixheightfull'){ 270 271 272 $container.isotope({ 273 itemSelector: '.portfolio-item', 274 layoutMode: 'fitRows' 275 }); 276 277 var filter=$('.dt-featured-filter a',mod),$navigation=$('.portfolio-navigation'); 278 279 if(filter.length && $('.portfolio-item',$container).length){ 280 281 filter.click(function(e){ 282 var selector = $(this).data('filter'); 283 if(selector!==undefined){ 284 e.preventDefault(); 285 $('.more-post',$navigation).hide(); 286 if(selector=='*'){ 287 $container.isotope( {filter:'*'}).isotope('reloadItems'); 288 289 290 }else{ 291 $container.isotope({filter:selector}); 292 $navigation.find(selector).css('display','inline-block'); 293 } 294 } 295 $(this).parents('ul').find('a,li').removeClass('active'); 296 $(this).addClass('active').parent().addClass('active'); 297 return false;
298 299 }); 300 301 302 } 303 304 } 305 else{ 306 307 $container.isotope({ 308 itemSelector: '.portfolio-item', 309 layoutMode:'masonry', 310 masonry: { 311 columnWidth: masonryCol, 312 gutter:$gutter 313 } 314 }); 315 316 var filter=$('.dt-featured-filter a',mod),$navigation=$('.portfolio-navigation'); 317 318 if(filter.length && $('.portfolio-item',$container).length){ 319 320 filter.click(function(e){ 321 var selector = $(this).data('filter'); 322 if(selector!==undefined){ 323 e.preventDefault(); 324 $('.more-post',$navigation).hide(); 325 if(selector=='*'){ 326 $container.isotope( {filter:'*'}).isotope('reloadItems'); 327 328 329 }else{ 330 $container.isotope({filter:selector}); 331 $navigation.find(selector).css('display','inline-block'); 332 } 333 } 334 $(this).parents('ul').find('a,li').removeClass('active'); 335 $(this).addClass('active').parent().addClass('active'); 336 return false; 337 338 }); 339 340 341 } 342 else{ 343 $('.more-post',mod).show(); 344 } 345 } 346 347 348 reloadMore($container); 349 } 350 catch(err){} 351 352 353 354 } 355 356 getPortMasonry(portfolio); 357 358 $(window).smartresize(function(){ 359 getPortMasonry(portfolio); 360 }) 361 362 }); 363 } 364 365}); 366
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.