1/* 2 * Author: Digital Zoom Studio 3 * Website: http://digitalzoomstudio.net/ 4 * Portfolio: http://codecanyon.net/user/ZoomIt/portfolio 5 * 6 * Version: 2.00 7 */ 8 9(function($) { 10 $.fn.prependOnce = function(arg, argfind) { 11 var _t = $(this[0]) // It's your element 12 if(_t.children(argfind).length<1){ 13 _t.prepend(arg); 14 } 15 }; 16 $.fn.appendOnce = function(arg, argfind) { 17 var _t = $(this[0]) // It's your element 18 if(_t.children(argfind).length<1){ 19 _t.append(arg); 20 } 21 }; 22 $.fn.dzsportfolio = function(o) { 23 var defaults = { 24 settings_slideshowTime: '5' //in seconds 25 , settings_autoHeight: 'on' 26 , settings_skin: 'skin-default' 27 , settings_mode: 'masonry' 28 , settings_disableCats: 'off' 29 , settings_clickaction: 'none' 30 , title: '' 31 , design_item_width: '0' 32 , design_item_height: '0' 33 , design_item_height_same_as_width: 'off' 34 , design_thumbw: '284' 35 , design_thumbh: '284' 36 , design_categories_pos: 'top' // top or bottom 37 , settings_ajax_enabled: 'off' 38 , settings_ajax_loadmoremethod: 'scroll'// ==choose between scroll and button mode 39 , settings_ajax_pages: [] 40 , settings_lightboxlibrary: 'prettyphoto' 41 , settings_preloadall: 'off' 42 , disable_itemmeta: "off" 43 ,wall_settings: {} 44 ,audioplayer_swflocation: 'ap.swf' 45 ,videoplayer_swflocation: 'preview.swf' 46 ,settings_makeFunctional: true 47 48 } 49 o = $.extend(defaults, o); 50 this.each(function() { 51 var cthis = $(this); 52 var cclass = ''; 53 var cchildren = cthis.children(); 54 var nr_children = cthis.children('.items').children().length 55 ,nr_loaded = 0 56 ; 57 var currNr = -1; 58 var busy = true; 59 var i = 0; 60 var ww 61 , wh 62 , tw 63 , th 64 ; 65 var _pageCont 66 , _theitems 67 , _selectorCon 68 ; 69 var arr_cats = []; 70 var busy = false 71 ,busy_ajax = false 72 ; 73 var sw = false; 74 var the_skin = 'skin-default'; 75 var isotope_settings = {}; 76 var inter_reset; 77 var ind_ajaxPage = 0; 78 79 //===thumbsize 80 var st_tw = 0 81 , st_th = 0 82 , thumbh_dependent_on_w = false 83 ; 84 85 var is_already_inited="off"; 86 87 //console.info(nr_children); 88 89 //o.item_width = parseInt(o.item_width, 10); 90 91 if ((o.design_item_width).indexOf('%') == -1) { 92 o.design_item_width = parseInt(o.design_item_width, 10); 93 } 94 if ((o.design_item_height).indexOf('%') == -1) { 95 o.design_item_height = parseInt(o.design_item_height, 10); 96 } 97 if ((o.design_thumbw).indexOf('%') == -1) { 98 o.design_thumbw = parseInt(o.design_thumbw, 10); 99 } 100 101 102 //console.info(o.design_thumbh); 103 if(o.design_item_height_same_as_width == 'on'){ 104 o.design_thumbh = '1/1'; 105 } 106 107 if(String(o.design_thumbh).indexOf('/')>-1){ 108 thumbh_dependent_on_w = true; 109 o.design_thumbh = eval(o.design_thumbh); 110 }else{ 111 if ((o.design_thumbh).indexOf('%') == -1) { 112 o.design_thumbh = parseInt(o.design_thumbh, 10); 113 114 } 115 } 116 //console.info(o.design_thumbh); 117 //var aux = eval("3/4"); console.log(aux); 118 119 120 init(); 121 function init() { 122 123 124 if (typeof(cthis.attr('class')) == 'string') { 125 cclass = cthis.attr('class'); 126 } else { 127 cclass = cthis.get(0).className; 128 } 129 if (cclass.indexOf("skin-") == -1) { 130 cthis.addClass(o.settings_skin); 131 } 132 if (cclass.indexOf("-sortable") == -1) { 133 cthis.addClass('is-sortable'); 134 } 135 136 137 if (cthis.hasClass('skin-default')) { 138 o.settings_skin = 'skin-default'; 139 } 140 141 142 if (cthis.hasClass('skin-black')) { 143 o.settings_skin = 'skin-black'; 144 skin_tableWidth = 192; 145 skin_normalHeight = 158; 146 } 147 if (cthis.hasClass('skin-blog')) { 148 o.settings_skin = 'skin-blog'; 149 } 150 if (cthis.hasClass('skin-accordion')) { 151 o.settings_skin = 'skin-accordion'; 152 } 153 if (cthis.hasClass('skin-boxed')) { 154 o.settings_skin = 'skin-boxed'; 155 } 156 cthis.addClass('mode-' + o.settings_mode); 157 158 //console.log(cthis); 159 //console.log(jQuery.appendOnce('ceva')); 160 161 init_ready(); 162 } 163 function init_ready(){ 164 //====can be called on reinit 165 166 167 168 if(cthis.children('.selector-con').length>0){ 169 is_already_inited='on'; 170 } 171 if (o.design_categories_pos == 'top') { 172 cthis.prependOnce('<div class="selector-con"><div class="clear"></div></div>', '.selector-con'); 173 cthis.appendOnce('<div class="pageContent"></div>
173', '.pageContent'); 174 175 } else { 176 cthis.appendOnce('<div class="selector-con"><div class="clear"></div></div>', '.selector-con'); 177 cthis.prependOnce('<div class="pageContent"></div>', '.pageContent'); 178 179 } 180 181 _selectorCon = cthis.children('.selector-con'); 182 _theitems = cthis.children('.items'); 183 _pageCont = cthis.children('.pageContent'); 184 185 186 if (o.title != '') { 187 _selectorCon.prepend('<div class="portfolio-title">' + o.title + '</div>') 188 } 189 190 191 192 cthis.find('.portitem-tobe').each(function($) { 193 var _t = jQuery(this); 194 //console.log(_t.css('width')); 195 var _t_w = 0; 196 var _t_h = 0; 197 198 //====items sizes 199 if (o.design_item_width != 0) { 200 _t_w = o.design_item_width; 201 } 202 if (o.design_item_height != 0) { 203 _t_h = o.design_item_height; 204 } 205 206 if (_t.attr('data-forcewidth') != undefined) { 207 _t_w = _t.attr('data-forcewidth'); 208 } 209 if (_t.attr('data-forceheight') != undefined) { 210 _t.css('height', _t.attr('data-forceheight')); 211 } 212 if(_t_w!=0){ 213 _t.css('width', _t_w); 214 } 215 216 if(_t_h!=0){ 217 _t.css('height', _t_h); 218 } 219 220 221 var type_featuredarea = 'thumb'; 222 223 if(_t.attr('data-typefeaturedarea')=='gallery'){ 224 type_featuredarea = 'gallery'; 225 } 226 if(_t.attr('data-typefeaturedarea')=='audio'){ 227 type_featuredarea = 'audio'; 228 } 229 if(_t.attr('data-typefeaturedarea')=='video'){ 230 type_featuredarea = 'video'; 231 } 232 if(_t.attr('data-typefeaturedarea')=='youtube'){ 233 type_featuredarea = 'video'; 234 _t.attr('data-videotype', 'youtube'); 235 } 236 if(_t.attr('data-typefeaturedarea')=='vimeo'){ 237 type_featuredarea = 'video'; 238 _t.attr('data-videotype', 'vimeo'); 239 } 240 if(_t.attr('data-typefeaturedarea')=='testimonial'){ 241 type_featuredarea = 'testimonial'; 242 } 243 if(_t.attr('data-typefeaturedarea')=='link'){ 244 type_featuredarea = 'thumb'; 245 _t.attr('donotopenimageinlightbox', 'on'); 246 _t.attr('data-bigimage', _t.attr('data-link')) 247 } 248 _t.addClass('type-' + type_featuredarea); 249 250 251 //====items thumbs sizes 252 st_tw = o.design_thumbw; 253 if (String(o.design_thumbw).indexOf('%') == '-1') { 254 st_tw = o.design_thumbw + 'px'; 255 } 256 st_th = o.design_thumbh; 257 console.log(o, String(o.design_thumbh)); 258 if (String(o.design_thumbh).indexOf('%') == '-1') { 259 st_th = o.design_thumbh + 'px'; 260 } 261 if (_t.attr('data-forcethumbwidth') != undefined) { 262 st_tw = _t.attr('data-forcethumbwidth'); 263 if(_t.attr('data-forcethumbwidth').indexOf('%') == '-1' && _t.attr('data-forcethumbwidth').indexOf('px') == '-1'){ 264 st_tw = _t.attr('data-forcethumbwidth') + 'px'; 265 } 266 } 267 if (_t.attr('data-forcethumbheight') != undefined) { 268 st_th = _t.attr('data-forcethumbheight'); 269 if(_t.attr('data-forcethumbheight').indexOf('%') == '-1' && _t.attr('data-forcethumbheight').indexOf('px') == '-1'){ 270 st_th = _t.attr('data-forcethumbheight') + 'px'; 271 } 272 } 273 274 if(type_featuredarea=='gallery' || type_featuredarea=='audio' || type_featuredarea=='testimonial'){ 275 st_th = 'auto'; 276 } 277 278 var str_tw = 'width: ' + st_tw + ';'; 279 var str_th = 'height: ' + st_th + ';'; 280 //console.log(str_tw, st_tw, str_th, st_th); 281 if(st_tw=="NaNpx" || st_th == 0 || st_th==''){ 282 str_tw = ''; 283 } 284 if(st_th=="NaNpx" || st_th == 0 || st_th==''){ 285 str_th = ''; 286 } 287 //console.log(st_th, _t.attr('data-forcethumbheight')); 288 289 _t.prepend('<div class="the-feature-con" style="' + str_tw + str_th + '"><div class="the-overlay"></div></div>'); 290 291 292 293 294 if(type_featuredarea=='gallery'){ 295 var aux = '<div class="the-feature advancedscroller skin-inset type-'+type_featuredarea+'" style=""><ul class="items">'; 296 var len = _t.find('.the-feature-data').eq(0).children().length; 297 for(i=0; i<len;i++){ 298 aux+='<li class="item-tobe needs-loading"></li>'; 299 } 300 aux+='</ul></div>'; 301 _t.find('.the-feature-con').eq(0).prepend(aux); 302 for(i=0; i<len;i++){ 303 var _c2 = _t.find('.the-feature-data').eq(0).children().eq(0); 304 //console.log(_c2, _t.find('.the-feature').eq(0).find('.items').eq(0)); 305 _t.find('.the-feature').eq(0).find('.items').eq(0).children().eq(i).append(_c2); 306 } 307 _t.find('.the-overlay').hide(); 308 309 if (jQuery.fn.advancedscroller != undefined) { 310 _t.find('.the-feature').eq(0).advancedscroller({ 311 settings_mode: "onlyoneitem" 312 ,design_arrowsize: "0" 313 ,settings_swipe: "on" 314 ,settings_swipeOnDesktopsToo: "on" 315 ,settings_slideshow: "on" 316 ,settings_slideshowTime: "8"
317 ,design_bulletspos: "none" 318 }); 319 } else { 320 if (window.console) { console.info('dzsportfolio.js - warning: advancedscroller not included'); } 321 } 322 } 323 if(type_featuredarea=='audio'){ 324 var aux = '<div class="the-feature audioplayer-tobe skin-default type-'+type_featuredarea+'" style="" data-source="'+_t.attr('data-thumbnail')+'">'; 325 aux+='</div>'; 326 _t.find('.the-feature-con').eq(0).prepend(aux); 327//console.log(typeof(dzsap_init)) 328 _t.find('.the-overlay').hide(); 329 if (typeof(dzsap_init) == 'function') { 330 dzsap_init(_t.find('.the-feature').eq(0), { 331 autoplay: "off" 332 ,swf_location : o.audioplayer_swflocation 333 }); 334 } else { 335 if (window.console) { console.info('dzsportfolio.js - warning: audio player not included'); } 336 } 337 } 338 339 if(type_featuredarea=='video'){ 340 var aux = '<div class="the-feature vplayer-tobe skin_pro type-'+type_featuredarea+'" style="" data-src="'+_t.attr('data-thumbnail')+'"'; 341 if(_t.attr('data-sourceogg')!=undefined){ 342 aux+=' data-sourceogg="'+_t.attr('data-sourceogg')+'"'; 343 } 344 if(_t.attr('data-videotype')!=undefined){ 345 aux+=' data-type="'+_t.attr('data-videotype')+'"'; 346 } 347 aux+='>'; 348 aux+='</div>'; 349 _t.find('.the-feature-con').eq(0).prepend(aux); 350//console.log(typeof(dzsap_init)) 351 _t.find('.the-overlay').hide(); 352 if (jQuery.fn.vPlayer != undefined) { 353 354 var videoplayersettings = { 355 autoplay : "off", 356 videoWidth : "100%", 357 videoHeight : 180, 358 constrols_out_opacity : 0.9, 359 constrols_normal_opacity : 0.9 360 ,settings_hideControls : "off" 361 ,settings_swfPath : o.videoplayer_swflocation 362 }; 363 //console.log( _t.find('.the-feature').eq(0)); 364 _t.find('.the-feature').eq(0).vPlayer(videoplayersettings); 365 366 } else { 367 if (window.console) { console.info('dzsportfolio.js - warning: video player not included'); } 368 } 369 } 370 if(type_featuredarea=='testimonial'){ 371 372 _t.find('.the-feature-con').eq(0).prepend('<div class="the-feature type-'+type_featuredarea+'" style=""></div>'); 373 374 _t.find('.the-overlay').hide(); 375 _t.find('.the-feature').eq(0).prepend(_t.find('.the-feature-data').eq(0)); 376 377 } 378 if(type_featuredarea=='thumb'){ 379 if (_t.attr('data-thumbnail') != undefined && _t.attr('data-thumbnail') != '') { 380 381 _t.find('.the-feature-con').eq(0).prepend('<div class="the-feature" style="background-image: url('+_t.attr('data-thumbnail')+');"></div>'); 382 console.log(_t.find('.the-feature-con').eq(0)); 383 //return; 384 } else { 385 _t.find('.the-feature-con').eq(0).prepend(_t.find('.the-feature-content').eq(0)); 386 } 387 } 388 389 var ind_r = 0; 390 if (_t.attr('data-bigimage') != undefined && _t.attr('data-bigimage') != '') { 391 var str_zoombox = ' zoombox'; 392 if(o.settings_lightboxlibrary == 'zoombox'){ 393 str_zoombox = ' zoombox'; 394 } 395 var str_pp = ''; 396 if(o.settings_lightboxlibrary == 'prettyphoto'){ 397 str_pp = ' rel="prettyPhoto[zoomfolio]"'; 398 } 399 400 401 if (_t.attr('data-donotopenbigimageinzoombox') == 'on') { 402 str_zoombox = ''; 403 str_pp = ''; 404 } 405 _t.find('.the-overlay').eq(0).append('<a class="the-overlay-anchor' + str_zoombox + '" href="' + _t.attr('data-bigimage') + '"'+str_pp+'></a>') 406 _t.find('.the-overlay').eq(0).find('.the-overlay-anchor').append('<div class="plus-image"></div>'); 407 408 if(o.settings_lightboxlibrary == 'prettyphoto'){ 409 _t.find('.the-overlay').eq(0).find('.the-overlay-anchor').append('<img class="aux-prettyPhoto-thumb" src="'+_t.attr('data-thumbnail')+'" alt="thumbnail"/>'); 410 } 411 412 ind_r += 31; 413 } 414 //console.log(_t); 415 if (_t.attr('data-link') != undefined && _t.attr('data-link') != '') { 416 _t.find('.the-overlay').eq(0).append('<a class="the-overlay-anchor-link" href="' + _t.attr('data-link') + '" style="right: ' + ind_r + 'px;"></a>') 417 _t.find('.the-overlay').eq(0).find('.the-overlay-anchor-link').append('<div class="plus-link"></div>'); 418 ind_r += 31; 419 } 420 if (_t.find('.the-content').length > 0 && _t.find('.the-content').eq(0).html() != '') { 421 _t.find('.the-overlay').eq(0).append('<a class="the-overlay-anchor-content" style="right: ' + ind_r + 'px;"></a>') 422 _t.find('.the-overlay').eq(0).find('.the-overlay-anchor-content').append('<div class="plus-content"></div>'); 423 } 424 425 426 if (_t.find('.the-title').eq(0).parent().hasClass("item-meta") == false) { 427 if (_t.attr('data-link') != undefined && _t.attr('data-link') != '') { 428 _t.find('.the-title, .the-desc').wrapAll('<a class="item-meta" href="' + _t.attr('data-link') + '"></a>'); 429 } else { 430 _t.find('.the-title, .the-desc').wrapAll('<div class="item-meta"></div>'); 431 } 432 } 433 if (o.settings_skin == 'skin-blog') { 434 var aux = _t.find('.the-feature-con').eq(0).height() - 70; 435 if(_t.find('.item-meta').eq(0).attr('data-inittop')!=undefined){ 436 aux = parseInt(_t.find('.item-meta').eq(0).attr('data-inittop'), 10); 437 } 438 //console.info(_t.find('.item-meta').eq(0), _t.find('.item-meta').eq(0).attr('data-inittop'), aux) 439 _t.find('.item-meta').eq(0).css('top', aux); 440 _t.find('.item-meta').eq(0).attr('data-inittop', aux); 441 } 442 if (o.settings_skin == 'skin-boxed') { 443 if(_t.find('.item-meta').length==0){ 444 _t.prepend('<div class="item-meta"></div>'); 445 } 446 _t.find('.item-meta').eq(0).prepend('<div class="hero-icon"></div>'); 447 if(_t.attr('data-color_highlight')!=undefined){ 448 _t.find('.item-meta').eq(0).find('.hero-icon').css({ 449 'background-color' : _t.attr('data-color_highlight') 450 }); 451 _t.css({ 452 'border-bottom-color' : _t.attr('data-color_highlight') 453 }); 454 } 455 if(_t.attr('data-heroimage')!=undefined){ 456 _t.find('.item-meta').eq(0).find('.hero-icon').css({ 457 'background-image' : 'url(' + _t.attr('data-heroimage') + ')' 458 }); 459 } 460 461 if(_t.hasClass('layout-left')){ 462 _t.find('.item-meta').eq(0).css({ 463 464 }) 465 _t.find('.the-feature-con').eq(0).css({ 466 'width' : 'auto' 467 }) 468 } 469 } 470 if(o.disable_itemmeta=='on'){ 471 _t.find('.item-meta').eq(0).hide(); 472 } 473 474 _t.addClass('portitem').removeClass('portitem-tobe'); 475 var the_cats = _t.attr('data-category'); 476 if (the_cats != undefined && the_cats != '') { 477 478 the_cats = the_cats.split(';'); 479 //console.log(the_cats); 480 for (i = 0; i < the_cats.length; i++){ 481 the_cat = the_cats[i]; 482 var the_cat_unsanatized = the_cats[i]; 483 if (the_cat != undefined) { 484 the_cat = the_cat.replace(' ', '-'); 485 _t.addClass('cat-' + the_cat); 486 487 } 488 sw = false;
489 //console.log(the_cats, arr_cats, the_cat_unsanatized) 490 for (j = 0; j < arr_cats.length; j++) { 491 if (arr_cats[j] == the_cat_unsanatized) { 492 sw = true; 493 } 494 } 495 if (sw == false) { 496 arr_cats.push(the_cat_unsanatized); 497 } 498 } 499 } 500 }); 501 502 if (is_already_inited!='on' && o.settings_mode=='masonry' && arr_cats.length > 1 && o.settings_disableCats != 'on') { 503 _selectorCon.prepend('<div class="categories"><div style="display:inline-block;"></div></div>'); 504 _selectorCon.children('.categories').append('<div class="a-category allspark active">All</div>'); 505 for (i = 0; i < arr_cats.length; i++) { 506 _selectorCon.children('.categories').append('<div class="a-category">' + arr_cats[i] + '</div>'); 507 508 } 509 _selectorCon.find('.a-category').bind('click', click_category); 510 } 511 512 513 //===multi point mode set 514 if(o.settings_mode=='advancedscroller'){ 515 cthis.removeClass('skin-default'); 516 cthis.addClass('advancedscroller skin-white'); 517 } 518 if(o.settings_mode=='wall'){ 519 cthis.removeClass('skin-default'); 520 cthis.addClass('wall'); 521 } 522 cthis.find('.portitem').each(function($) { 523 var _t = jQuery(this); 524 525 if (o.settings_clickaction == '' || o.settings_clickaction == 'none') { 526 527 } 528 if (o.settings_clickaction == 'slide') { 529 530 _t.find('.the-feature').eq(0).unbind('click'); 531 _t.find('.the-feature').eq(0).bind('click', click_item); 532 } 533 if(o.settings_mode=='advancedscroller'){ 534 535 _t.addClass('item-tobe'); 536 //_t.prepend('<img class="fullwidth" src="'+_t.attr('data-thumbnail')+'"/>') 537 } 538 if(o.settings_mode=='wall'){ 539 540 _t.addClass('wall-item'); 541 //_t.prepend('<img class="fullwidth" src="'+_t.attr('data-thumbnail')+'"/>') 542 } 543 }); 544 545 //console.log($(window).scrollTop()) 546 547 548 cthis.find('.the-overlay-anchor-content').unbind('click', click_anchorContent); 549 cthis.find('.the-overlay-anchor-content').bind('click', click_anchorContent); 550 cthis.find('.portitem').unbind('mouseover', mouse_portitem); 551 cthis.find('.portitem').bind('mouseover', mouse_portitem); 552 cthis.find('.portitem').unbind('mouseout', mouse_portitem); 553 cthis.find('.portitem').bind('mouseout', mouse_portitem); 554 555 if(o.settings_skin == 'skin-accordion'){ 556 cthis.find('.portitem').unbind('click', mouse_portitem); 557 cthis.find('.portitem').bind('click', mouse_portitem); 558 } 559 560 561 if(o.settings_preloadall=='on'){ 562 //console.log(cthis.find('.items').eq(0).children()); 563 cthis.find('.items').eq(0).children().each(function(){ 564 var _t = jQuery(this); 565 if(_t.attr('data-typefeaturedarea')!='video' && _t.attr('data-typefeaturedarea')!='audio' && _t.attr('data-typefeaturedarea')!='gallery' && _t.attr('data-thumbnail')!=undefined && _t.attr('data-thumbnail')!=''){ 566 //console.log(_t.attr('data-thumbnail')) 567 var auxImage = new Image(); 568 auxImage.src=_t.attr('data-thumbnail'); 569 auxImage.onload=imageLoaded; 570 }else{ 571 imageLoaded(); 572 } 573 574 }) 575 //===failsafe 576 setTimeout(handle_loaded, 7500); 577 578 }else{ 579 setTimeout(handle_loaded, 2000); 580 } 581 582 583 584 585 } 586 function imageLoaded(e){ 587 nr_loaded++;
588 //console.log(this, this.naturalWidth, this.naturalHeight, this.complete, nr_loaded, nr_children); 589 if(nr_loaded>=nr_children){ 590 //==leave some time for the width to be set in the items 591 setTimeout(handle_loaded, 1000); 592 //handle_loaded(); 593 } 594 } 595 function handle_loaded() { 596 if(is_already_inited=='on'){ 597 return; 598 } 599 600 if(o.settings_makeFunctional==false){ 601 var allowed=false; 602 603 var url = document.URL; 604 var urlStart = url.indexOf("://")+3; 605 var urlEnd = url.indexOf("/", urlStart); 606 var domain = url.substring(urlStart, urlEnd); 607 //console.log(domain); 608 if(domain.indexOf('a')>-1 && domain.indexOf('c')>-1 && domain.indexOf('o')>-1 && domain.indexOf('l')>-1){ 609 allowed=true; 610 } 611 if(domain.indexOf('o')>-1 && domain.indexOf('z')>-1 && domain.indexOf('e')>-1 && domain.indexOf('h')>-1 && domain.indexOf('t')>-1){ 612 allowed=true; 613 } 614 if(domain.indexOf('e')>-1 && domain.indexOf('v')>-1 && domain.indexOf('n')>-1 && domain.indexOf('a')>-1 && domain.indexOf('t')>-1){ 615 allowed=true; 616 } 617 if(allowed==false){ 618 return; 619 } 620 621 } 622 623 624 if(o.settings_mode=='masonry'){ 625 if (jQuery.fn.isotope != undefined) { 626 isotope_settings = { 627 masonry: { 628 columnWidth: 1 629 } 630 , layoutMode: 'masonry' 631 }; 632 //console.log('ceva'); 633 cthis.children('.items').isotope(isotope_settings); 634 if (cthis.css('opacity') == 0) { 635 cthis.animate({ 636 'opacity': 1 637 }, 2000); 638 } 639 } else { 640 if (window.console) { console.info('dzsportfolio.js - warning: isotope not included') } 641 ; 642 cthis.removeClass('is-sortable'); 643 cthis.addClass('is-not-sortable'); 644 } 645 } 646 if(o.settings_mode=='advancedscroller'){ 647 //console.log('hmm', cthis); 648 649 cthis.children('.items').children().addClass('portitem'); 650 if (jQuery.fn.advancedscroller != undefined) { 651 cthis.advancedscroller({ 652 design_itemwidth : o.item_width 653 }); 654 } else { 655 if (window.console) { console.info('dzsportfolio.js - warning: advancedscroller not included'); } 656 } 657 } 658 if(o.settings_mode=='wall'){ 659 //console.log('hmm', cthis); 660 661 if (jQuery.fn.wall != undefined) { 662 cthis.wall(o.wall_settings); 663 } else { 664 if (window.console) { console.info('dzsportfolio.js - warning: wall not included'); } 665 } 666 } 667 668 if(o.settings_lightboxlibrary == 'zoombox'){ 669 if ($.fn.zoomBox != undefined) { 670 cthis.find('.zoombox').zoomBox({}); 671 } else { 672 if (window.console) { console.info('zoombox not here...') } ; 673 } 674 } 675 if(o.settings_lightboxlibrary == 'prettyphoto'){ 676 if ($.fn.prettyPhoto != undefined) { 677 cthis.find("a[rel^='prettyPhoto']").prettyPhoto({ 678 theme: 'pp_default' 679 ,overlay_gallery : false, social_tools: false, deeplinking: false, 680 }); 681 } else { 682 if (window.console) { console.info('prettyphoto not here...') } ; 683 } 684 } 685 686 if(cthis.get(0)!=undefined){ 687 //cthis.get(0).fn_change_mainColor = fn_change_mainColor; cthis.get(0).fn_change_mainColor('#aaa'); 688 cthis.get(0).fn_change_size = fn_change_size; //cthis.get(0).fn_change_mainColor('#aaa'); 689 } 690 691 cthis.children('.preloader').fadeOut('slow'); 692 cthis.addClass('loaded'); 693 694 695 jQuery(document).delegate(".btn-close", "click", click_pageContent_close); 696 697 if(o.settings_ajax_enabled=='on'){ 698 if(o.settings_ajax_loadmoremethod=='scroll'){ 699 $(window).bind('scroll', handle_scroll); 700 }else{ 701 //console.info(cthis, o.settings_ajax_loadmoremethod); 702 cthis.append('<div class="btn_ajax_loadmore">Load More</div>'); 703 cthis.children('.btn_ajax_loadmore').bind('click', click_btn_ajax_loadmore); 704 } 705 706 } 707 708 jQuery(window).unbind('resize', handleResize); 709 jQuery(window).bind('resize', handleResize); 710 handleResize(); 711 712 is_already_inited='on'; 713 } 714 function handle_scroll(){ 715 var _t = $(this); 716 wh = $(window).height(); 717 //console.log(_t.scrollTop(), wh, cthis.offset().top, cthis.height(), ind_ajaxPage, o.settings_ajax_pages); 718 719 if(busy_ajax==true || ind_ajaxPage >= o.settings_ajax_pages.length){ 720 return; 721 } 722 723 if(_t.scrollTop() + wh > cthis.offset().top + cthis.height() - 10){ 724 ajax_load_nextpage(); 725 } 726 } 727 function click_btn_ajax_loadmore(e){ 728 729 if(busy_ajax==true || ind_ajaxPage >= o.settings_ajax_pages.length){ 730 return; 731 } 732 ajax_load_nextpage(); 733 } 734 function ajax_load_nextpage(){ 735 736 cthis.children('.preloader').fadeIn('slow'); 737 738 $.ajax({ 739 url : o.settings_ajax_pages[ind_ajaxPage], 740 success: function(response) { 741 if(window.console !=undefined ){ console.log('Got this from the server: ' + response); } 742 setTimeout(function(){ 743 744 cthis.children('.items').append(response); 745 init_ready(); 746 reset_isotope(); 747 setTimeout(function(){ 748 busy_ajax = false ; 749 cthis.children('.preloader').fadeOut('slow'); 750 ind_ajaxPage++; 751 752 if(ind_ajaxPage >= o.settings_ajax_pages.length){ 753 cthis.children('.btn_ajax_loadmore').fadeOut('slow'); 754 } 755 756 757 if(o.settings_lightboxlibrary == 'zoombox'){ 758 if ($.fn.zoomBox != undefined) { 759 cthis.find('.zoombox').zoomBox({}); 760 } else { 761 if (window.console) { console.info('zoombox not here...') } ; 762 } 763 } 764 if(o.settings_lightboxlibrary == 'prettyphoto'){ 765 if ($.fn.prettyPhoto != undefined) { 766 cthis.find("a[rel^='prettyPhoto']").prettyPhoto({ 767 theme: 'pp_default' 768 ,overlay_gallery : false 769 }); 770 } else { 771 if (window.console) { console.info('prettyphoto not here...') } ; 772 } 773 } 774 775 }, 1000); 776 }, 1000); 777 }, 778 error:function (xhr, ajaxOptions, thrownError){ 779 if(window.console !=undefined ){ console.error('not found ' + ajaxOptions); } 780 ind_ajaxPage++; 781 cthis.children('.preloader').fadeOut('slow'); 782 783 } 784 }); 785 786 busy_ajax = true ; 787 } 788 function fn_change_mainColor(arg){ 789 } 790 function fn_change_size(arg1, arg2){ 791 //console.log(arg1, arg2); 792 if(arg1!=undefined){ 793 cthis.find('.portitem').css({'width' : arg1}); 794 } 795 if(arg2!=undefined){ 796 cthis.find('.portitem').height(arg2); 797 } 798 reset_isotope(); 799 800 801 802 } 803 function reset_isotope(){ 804 805 if(o.settings_mode=='masonry'){ 806 if (jQuery.fn.isotope != undefined) { 807 //console.log('ceva'); 808 //cthis.children('.items').children().css({ 'position' : 'relative', 'transform' : '' }); 809 //isotope_settings.sortBy = 'name'; 810 setTimeout(function(){ 811 cthis.children('.items').isotope( 'reloadItems' ).isotope( 'reLayout' ).isotope( isotope_settings ); 812 813 }, 700); 814 setTimeout(function(){ 815 cthis.children('.items').isotope( 'reloadItems' ).isotope( 'reLayout' ).isotope( isotope_settings ); 816 817 }, 1200); 818 } else { 819 if (window.console) { console.info('dzsportfolio.js - warning: isotope not included'); } 820 } 821 } 822 } 823 function add_color_style(){ 824 if(cthis.find('style.custom-style').length==0){ 825 //cthis.append('<style class="custom-style"></style>'); 826 } 827 } 828 function mouse_portitem(e) { 829 var _t = jQuery(this); 830 //console.log(e); 831 if (e.type == 'mouseover') { 832 if (o.settings_skin == 'skin-blog') { 833 //console.log(_t); 834 _t.find('.item-meta').eq(0).css('top', 0); 835 } 836 } 837 if (e.type == 'mouseout') { 838 839 var aux = _t.find('.item-meta').eq(0).attr('data-inittop'); 840 //console.log(e,_t.find('.item-meta').eq(0), _t.find('.item-meta').eq(0).attr('data-inittop'), aux); 841 if (String(aux).indexOf('px') == -1) { 842 aux += 'px'; 843 844 } 845 _t.find('.item-meta').eq(0).css('top', aux); 846 } 847 //console.log(e.type); 848 if (e.type == 'click') { 849 if(_t.hasClass('opened')){ 850 851 }else{ 852 _theitems.children('.portitem').removeClass('opened'); 853 _t.addClass('opened'); 854 e.stopPropagation(); 855 e.preventDefault(); 856 857 if(_t.find('.btn-close').length==0){ 858 _t.find('.the-content').eq(0).append('<div class="btn-close">Close</div>') 859 } 860 jQuery(window).trigger('resize'); 861 reset_isotope(); 862 return false;
863 } 864 865 } 866 } 867 function click_pageContent_close() { 868 var _t = jQuery(this); 869 if (cthis.has(_t).length == 0) { 870 return false; 871 } 872 if(o.settings_skin=='skin-accordion'){ 873 _t.parent().parent().removeClass('opened'); 874 reset_isotope(); 875 return false; 876 } 877 //console.log(_pageCont.height()); 878 _pageCont.addClass('non-anim'); 879 _pageCont.css('height', _pageCont.height()); 880 //_pageCont.removeClass('active'); 881 //_pageCont.css('height', 0); 882 setTimeout(function() { 883 //_pageCont.css('height', 0); 884 _pageCont.removeClass('non-anim'); 885 }, 100); 886 setTimeout(function() { 887 _pageCont.css('height', 0); 888 }, 200); 889 setTimeout(function() { 890 _pageCont.html(''); 891 _pageCont.removeClass('active'); 892 }, 1000); 893 } 894 function click_anchorContent() { 895 var _t = jQuery(this); 896 var _it = _t.parent().parent().parent(); 897 //console.log(_t, _it); console.log(_pageCont); 898 _pageCont.css('height', 'auto'); 899 var aux = _it.find('.the-content').eq(0).html() + '<div class="btn-close">Close</div>'; 900 //console.log(); 901 _pageCont.html(aux); 902 _pageCont.addClass('active'); 903 904 905 var scrollElem = scrollableElement('html', 'body'); 906 var targetOffY = _pageCont.offset().top; 907 908 909 $(scrollElem).animate({scrollTop: targetOffY}, 400); 910 //console.log(scrollElem, targetOffY); 911 912 } 913 function click_category() { 914 var _t = jQuery(this); 915 //console.log(_t); 916 var cat = _t.html(); 917 918 var options = {}; 919 var key = "filter"; 920 var value = '.cat-' + cat; 921 if (cat == "All") { 922 value = "*"; 923 } 924 _selectorCon.find('.a-category').removeClass('active'); 925 _t.addClass('active'); 926 value = value === "false" ? false : value; 927 928 value = value.replace(" ", "-"); 929 //console.log(key, value); 930 isotope_settings[ key ] = value; 931 cthis.children('.items').isotope(isotope_settings); 932 } 933 function click_item() { 934 var _t = jQuery(this); 935 var _it = _t.parent(); 936 //console.log(_it, _it.children('.the-content').height()); 937 938 939 cthis.animate({ 940 'height': _it.children('.the-content').height() 941 }, {queue: false}); 942 _pageCont.html('<div class="button-back-con"><div class="button-back">back</div><div class="page-title">' + _it.find('.the-title').eq(0).html() + '</div></div>' + _it.children('.the-content').html()); 943 _theitems.css({ 944 //'left' : '-100%' 945 }) 946 _pageCont.addClass('focused'); 947 948 _pageCont.find('.button-back').bind('click', click_back); 949 950 } 951 function click_back() { 952 953 cthis.animate({ 954 'height': _theitems.height() 955 }, {queue: false, complete: complete_backanimation}); 956 _pageCont.removeClass('focused'); 957 } 958 function complete_backanimation() { 959 cthis.css({ 960 'height': 'auto' 961 }) 962 } 963 function handleResize() { 964 ww = $(window).width(); 965 wh = $(window).height(); 966 tw = cthis.width(); 967 968 //console.log(ww,tw); 969 970 cthis.removeClass('under-800').removeClass('under-480'); 971 972 if(tw<800){ 973 cthis.addClass('under-800'); 974 } 975 if(tw<480){ 976 cthis.addClass('under-480'); 977 } 978 //if(String(cthis.attr('class')).indexOf('special-grid')>-1){ 979 clearTimeout(inter_reset); 980 inter_reset = setTimeout(function(){ 981 reset_isotope(); 982 983 if(thumbh_dependent_on_w==true){ 984 985 cthis.find('.portitem').each(function() { 986 var _t = jQuery(this); 987 _t.find('.the-feature-con').eq(0).css({ 988 'height' : (_t.find('.the-feature-con').eq(0).outerWidth(false) * o.design_thumbh) 989 }) 990 991 if(_t.find('.the-thumb-content').length>0){ 992 _t.find('.the-thumb-content').eq(0).css({ 993 'width' : _t.find('.the-feature-con').eq(0).outerWidth(false) 994 ,'height' : _t.find('.the-feature-con').eq(0).outerHeight(false) 995 }) 996 } 997 }); 998 999 } 1000 }, 100); 1001 //} 1002 1003 cthis.find('.portitem').each(function() { 1004 var _t = jQuery(this); 1005 1006 if (_t.width() > tw) { 1007 if (_t.attr('data-origwidth') == undefined) { 1008 _t.attr('data-origwidth', _t.css('width')); 1009 } 1010 _t.css('width', tw); 1011 } else { 1012 1013 if (_t.attr('data-origwidth') != undefined) { 1014 _t.css('width', _t.attr('data-origwidth')); 1015 } 1016 } 1017 1018 1019 1020 1021 1022 1023 1024 1025 if (o.settings_skin == 'skin-blog') { 1026 } 1027 1028 1029 });
1030 if (_pageCont.hasClass('active')) { 1031 1032 } 1033 } 1034 return this; 1035 }) 1036 } 1037 1038 1039 window.dzsp_init = function(selector, settings) { 1040 $(selector).dzsportfolio(settings); 1041 }; 1042})(jQuery); 1043 1044function scrollableElement(els) { 1045 for (var i = 0, argLength = arguments.length; i < argLength; i++) { 1046 var el = arguments[i], 1047 $scrollElement = jQuery(el); 1048 if ($scrollElement.scrollTop() > 0) { 1049 return el; 1050 } else { 1051 $scrollElement.scrollTop(1); 1052 var isScrollable = $scrollElement.scrollTop() > 0; 1053 $scrollElement.scrollTop(0); 1054 if (isScrollable) { 1055 return el; 1056 } 1057 } 1058 } 1059 return []; 1060} 1061 1062 1063window.requestAnimFrame = (function() { 1064 //console.log(callback); 1065 return window.requestAnimationFrame || 1066 window.webkitRequestAnimationFrame || 1067 window.mozRequestAnimationFrame || 1068 window.oRequestAnimationFrame || 1069 window.msRequestAnimationFrame || 1070 function(/* function */callback, /* DOMElement */element) { 1071 window.setTimeout(callback, 1000 / 60); 1072 }; 1073})();
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.