1/* -------------------------------------------------------------------------------- / 2 3 Plugin Name: Go Portfolio - WordPress Responsive Portfolio 4 Author: Granth 5 Version: 1.6.4 6 7 +----------------------------------------------------+ 8 TABLE OF CONTENTS 9 +----------------------------------------------------+ 10 11 [1] SETUP 12 [2] AJAX PAGINATION 13 [2.1] LOAD MORE 14 [3] SLIDER 15 [4] POPUP 16 [5] ISOTOPE 17 [6] EFFECTS 18 [7] DEEP LINKING 19 [8] OTHERS 20 21/ -------------------------------------------------------------------------------- */ 22 23(function ($, undefined) { 24 "use strict"; 25 26 $(function () { 27 28 /* -------------------------------------------------------------------------------- / 29 [1] SETUP 30 / -------------------------------------------------------------------------------- */ 31 32 /* Detect IE & Chrome */ 33 var isIE = document.documentMode != undefined && document.documentMode >5 ? document.documentMode : false, 34 isChrome = !!window.chrome && !!window.chrome.webstore; 35 36 /* Detect touch devices */ 37 function isTouchDevice() { return 'ontouchstart' in window || navigator.msMaxTouchPoints; }; 38 var isTouchDevice = isTouchDevice(); 39 40 /* Detect orintationchange */ 41 function supportsOrientationchange() { return 'onorientationchange' in window }; 42 var supportsOrientationchange = supportsOrientationchange(); 43 44 /* Detect CSS transition support */ 45 function supportsTransitions() { 46 var s = document.createElement('p').style; 47 return 'transition' in s || 'WebkitTransition' in s || 'MozTransition' in s || 'msTransition' in s || 'OTransition' in s; 48 } 49 var supportsTransitions = supportsTransitions(); 50 51 /* Detect retina screens */ 52 function isRetina() { 53 var retinaMediaQuery = '(-webkit-min-device-pixel-ratio: 2),(min--moz-device-pixel-ratio: 2),(-o-min-device-pixel-ratio: 2/1),(min-device-pixel-ratio: 2),(min-resolution: 2dppx)'; 54 if (window.matchMedia && window.matchMedia(retinaMediaQuery).matches) { 55 return true; 56 } else { 57 return false; 58 }; 59 }; 60 61 var isRetina = isRetina(), 62 retinaImageList = []; 63 64 function loadRetinaImages() { 65 var $retinaReadyImages = $portfolio.find('.gw-gopf-retina'), 66 retinaReadyImageList = []; 67 68 $retinaReadyImages.each(function(index, element) { 69 retinaReadyImageList.push(this.src); 70 }); 71 72 retinaReadyImageList = $.grep(retinaReadyImageList, function(v, k){ 73 return $.inArray(v ,retinaReadyImageList) === k; 74 }); 75 76 var ImgsLoadedInterval = setInterval(function(){ 77 $retinaReadyImages.filter(':not(.gw-gopf-loaded)').each(function(index, element) { 78 if (this.naturalWidth>0) { 79 $(this).addClass('gw-gopf-loaded'); 80 this.style.width=this.naturalWidth+'px'; 81 this.style.height=this.naturalHeight+'px'; 82 }; 83 }); 84 if (!$retinaReadyImages.filter(':not(.gw-gopf-loaded)').length) { 85 clearInterval(ImgsLoadedInterval); 86 for (var x=0;x<retinaReadyImageList.length;x++) { 87 var RetinaImageFileName=retinaReadyImageList[x].substr(0,retinaReadyImageList[x].lastIndexOf('.')), 88 RetinaImageFileExt=retinaReadyImageList[x].substr(retinaReadyImageList[x].lastIndexOf('.')); 89 90 if ($.inArray(RetinaImageFileName+'@2x'+RetinaImageFileExt ,retinaImageList)>-1) { 91 retinaImageList.push(RetinaImageFileName+'@2x'+RetinaImageFileExt); 92 $retinaReadyImages.each(function(index, element) { 93 $(this).removeClass('gw-gopf-retina'); 94 if (this.src==RetinaImageFileName+RetinaImageFileExt) { 95 this.src=RetinaImageFileName+'@2x'+RetinaImageFileExt; 96 }; 97 }); 98 } else { 99 var http = new XMLHttpRequest(); 100 http.open('HEAD', RetinaImageFileName+'@2x'+RetinaImageFileExt, false); 101 http.onreadystatechange = function() { 102 if (http.readyState==4 && http.status==200) { 103 retinaImageList.push(RetinaImageFileName+'@2x'+RetinaImageFileExt); 104 $retinaReadyImages.each(function(index, element) { 105 $(this).removeClass('gw-gopf-retina'); 106 if (this.src==RetinaImageFileName+RetinaImageFileExt) {
107 this.src=RetinaImageFileName+'@2x'+RetinaImageFileExt; 108 }; 109 }); 110 }; 111 }; 112 http.send(); 113 }; 114 }; 115 }; 116 }, 100); 117 }; 118 119 var $portfolio=$('.gw-gopf'), 120 $portfolioFilter=$portfolio.filter('.gw-gopf-grid-type').find('.gw-gopf-filter'), 121 $portfolioPosts=$portfolio.filter('.gw-gopf-grid-type').find('.gw-gopf-posts'), 122 $sliders = $portfolio.filter('.gw-gopf-slider-type').find('.gw-gopf-posts'); 123 124 /* Add CSS correction for chrome */ 125 if (isChrome) $portfolio.addClass('gw-gopf-chrome'); 126 127 /* Add 'gw-gopf-touch' class for touch devices */ 128 if (isTouchDevice) { $portfolio.addClass('gw-gopf-touch'); }; 129 130 if (isRetina) { loadRetinaImages() }; 131 132 /* Fix iframe hover */ 133 if (isIE) { 134 $portfolio.find('.gw-gopf-post iframe').delegate(this, 'mouseenter mouseleave', function (event) { 135 var $this = $(this); 136 if (event.type == 'mouseenter') { 137 $this.closest('.gw-gopf-post').trigger('mouseenter').addClass('gw-gopf-current'); 138 $this.closest('.gw-gopf-col-wrap').css('zIndex',3); 139 } else { 140 /* This is not required, just in case 141 $this.closest('.gw-gopf-post').trigger('mouseleave').removeClass('gw-gopf-current'); 142 $this.closest('.gw-gopf-col-wrap').css('zIndex',2);*/ 143 }; 144 }); 145 }; 146 147 /* Add show wrappers in sliders */ 148 $portfolio.filter('.gw-gopf-slider-type').find('.gw-gopf-col-wrap').css({'display' : 'block', 'visibility' : 'visible' }); 149 150 /* -------------------------------------------------------------------------------- / 151 [2] AJAX PAGINATION 152 / -------------------------------------------------------------------------------- */ 153 154 /* -------------------------------------------------------------------------------- / 155 [2.1] LOAD MORE 156 / -------------------------------------------------------------------------------- */ 157 158 function PortfolioInit() { 159 var loaded=[]; 160 var images=[]; 161 var $imgelems=[]; 162 var portfolioReadyCnt=0; 163 var portfolioCnt=$portfolio.length; 164 165 $portfolio.each(function(index, element) { 166 var $this=$(this), 167 portfolioID=$this.data('id'), 168 cols = $this.find('.gw-gopf-posts').data('col'); 169 if ($this.hasClass('gw-gopf-slider-type')) { 170 $imgelems[portfolioID] = $this.find('.gw-gopf-post-media-wrap img').slice(0, cols) 171 images[portfolioID] = $imgelems[portfolioID].length; 172 } else { 173 images[portfolioID] = $this.find('.gw-gopf-post-media-wrap img').length; 174 $imgelems[portfolioID] = $this.find('.gw-gopf-post-media-wrap img'); 175 } 176 177 loaded[portfolioID]=0; 178 var interval = setInterval(function(){ 179 if (loaded[portfolioID]==images[portfolioID]) { 180 if (!$this.hasClass('gw-gopf-slider-type')) { 181 $this.removeClass('gw-gopf-isotope-ready').find('.gw-gopf-posts').callIsotope('*'); 182 $this.addClass('gw-gopf-isotope-ready') 183 } else { 184 $(window).resize(); 185 } 186 portfolioReadyCnt++; 187 if (portfolioReadyCnt==portfolioCnt) { 188 if (supportsOrientationchange) { 189 if (gw_go_portfolio_settings.mobileTransition=='enabled') { 190 $('.gw-gopf-no-trans').removeClass('gw-gopf-no-trans'); 191 }; 192 } else { 193 $('.gw-gopf-no-trans').removeClass('gw-gopf-no-trans'); 194 }; 195 } 196 clearInterval(interval); 197 } else { 198 $imgelems[portfolioID].filter(':not(.gw-gopf-loaded)').each(function(index, element) { 199 if (this.naturalWidth>0) { 200 201 $(this).addClass('gw-gopf-loaded'); 202 if (!$this.hasClass('gw-gopf-slider-type')) { 203 $this.removeClass('gw-gopf-isotope-ready').find('.gw-gopf-posts').callIsotope('*'); 204 } else { 205 $(window).resize(); 206 } 207 loaded[portfolioID]++; 208 } 209 210 this.onerror = function() { 211 $(this).addClass('gw-gopf-loaded'); 212 $(this).closest('.gw-gopf-post-media-wrap').css('display','none'); 213 if (!$this.hasClass('gw-gopf-slider-type')) { 214 $this.removeClass('gw-gopf-isotope-ready').find('.gw-gopf-posts').callIsotope('*'); 215 } else { 216 $(window).resize(); 217 } 218 loaded[portfolioID]++; 219 }; 220 });
221 } 222 }, 100); 223 }); 224 }; 225 PortfolioInit(); 226 227 $portfolio.on('click', '.gw-gopf-pagination-load-more:not(.gw-gopf-disabled)', function() { 228 var $this=$(this), 229 $wrapper = $this.closest('.gw-gopf-pagination-wrapper'), 230 $currentPortfolio = $this.closest('.gw-gopf'); 231 $wrapper.data('current-page', $wrapper.data('current-page')+1); 232 $.ajax({ 233 type: 'post', 234 url: gw_go_portfolio_settings.ajaxurl, 235 data: jQuery.param({ 236 action : 'go_portfolio_ajax_load_portfolio', 237 portfolio_id : $currentPortfolio.parent().attr('id').split('gw_go_portfolio_')[1], 238 current_page : $wrapper.data('current-page'), 239 current_id : $wrapper.data('current-id'), 240 loaded_ids : $wrapper.data('loaded'), 241 taxonomy : $wrapper.data('tax'), 242 term_slug : $wrapper.data('term'), 243 post_per_page : $wrapper.data('posts-per-page') 244 }), 245 beforeSend: function () { 246 $this.html($this.data('modified')); 247 $this.addClass('gw-gopf-disabled'); 248 } 249 }).always(function() { 250 $this.html($this.data('original')); 251 $this.removeClass('gw-gopf-disabled'); 252 if (parseInt($wrapper.data('current-page')) == parseInt($wrapper.data('pages'))) { 253 $wrapper.stop().fadeTo(550, 0, function() { 254 $wrapper.stop().slideUp(); 255 }); 256 }; 257 }).fail(function(jqXHR, textStatus) { 258 if (textStatus!='abort') { alert('Ajax error!'); }; 259 }).done(function(data) { 260 var $ajaxResponse=$('<div />', { 'class':'ajax-response', 'html' : data }), 261 $ajaxResult=$ajaxResponse.find('.gw-gopf-posts'), 262 $newPosts=$ajaxResponse.find('.gw-gopf-col-wrap'), 263 newPostsLength=$newPosts.length; 264 var currentPostsIds = ($currentPortfolio.find('.gw-gopf-pagination-wrapper').data('loaded')+'').split(','); 265 currentPostsIds = $.grep(currentPostsIds,function(n){ return(n) }); 266 if ($ajaxResponse.find('.gw-gopf-pagination-wrapper').length) { 267 var loadedPostsIds = ($ajaxResponse.find('.gw-gopf-pagination-wrapper').data('loaded')+'').split(','); 268 loadedPostsIds = $.grep(loadedPostsIds,function(n){ return(n) }); 269 $currentPortfolio.find('.gw-gopf-pagination-wrapper').data('loaded', loadedPostsIds.concat(currentPostsIds).join(',')); 270 } 271 var images = $newPosts.find('.gw-gopf-post-media-wrap img:not(.gw-gopf-loaded)').length; 272 var $imgelems = $newPosts.find('.gw-gopf-post-media-wrap img:not(.gw-gopf-loaded)'); 273 var loaded=0; 274 var interval = setInterval(function(){ 275 if (loaded==images) { 276 $currentPortfolio.removeClass('gw-gopf-isotope-ready').addClass('gw-gopf-isotope-new-added').find('.gw-gopf-posts').GWisotope( 'insert', $newPosts, function() { 277 $currentPortfolio.addClass('gw-gopf-isotope-ready'); 278 $currentPortfolio.removeClass('gw-gopf-isotope-new-added'); 279 $currentPortfolio.find('.gw-gopf-cats .gw-gopf-hidden').each(function(index, element) { 280 var $this = $(this); 281 if ($newPosts.filter('[data-filter~="'+$this.data('filter')+'"]').length) { $this.removeClass('gw-gopf-hidden'); }; 282 });
283 if (isRetina) { loadRetinaImages() }; 284 DoMagnificPopup(); 285 updatePopupGallery($currentPortfolio.data('id')); 286 }); 287 var $currentFilter = $currentPortfolio.find('.gw-gopf-filter .gw-gopf-current'); 288 $currentPortfolio.find('.gw-gopf-posts').callIsotope('*'); 289 if ($currentFilter.data('filter')!=undefined) { 290 $currentPortfolio.find('.gw-gopf-posts').GWisotope('reLayout', function(){ 291 $currentPortfolio.find('.gw-gopf-posts').callIsotope('[data-filter~="'+$currentFilter.data('filter')+'"]'); 292 setTimeout(function(){ 293 $currentPortfolio.addClass('gw-gopf-isotope-ready'); 294 },5); 295 }); 296 }; 297 clearInterval(interval); 298 } else { 299 $imgelems.filter(':not(.gw-gopf-loaded)').each(function(index, element) { 300 if (this.naturalWidth>0) { 301 $(this).addClass('gw-gopf-loaded'); 302 loaded++; 303 } 304 this.onerror = function() { 305 306 $(this).addClass('gw-gopf-loaded'); 307 $(this).closest('.gw-gopf-post-media-wrap').css('display','none'); 308 loaded++; 309 }; 310 }); 311 } 312 }, 100); 313 314 }); 315 return false; 316 }); 317 318 /* -------------------------------------------------------------------------------- / 319 [3] SLIDER - CarouFredSel Slider 320 / -------------------------------------------------------------------------------- */ 321 322 if (jQuery().carouFredSel && $sliders.length) { 323 324 var $scrollOverlay = $('<div class="gw-gopf-posts-wrap-inner-overlay">').appendTo('.gw-gopf-posts-wrap-inner').css({ 325 'position' : 'absolute', 326 'top' : 0, 327 'z-index' : '2', 328 'width' : '100%', 329 'height' : '100%', 330 'display' : 'none' 331 }); 332 333 $sliders.each(function(index, element) { 334 var $this=$(this); 335 if ($this.closest('.gw-gopf').hasClass('gw-gopf-rtl')) { 336 $this.find('.gw-gopf-col-wrap').each(function(index, element) { 337 $(this).prependTo($this); 338 }); 339 }; 340 var startIndex = 0; 341 if ($this.closest('.gw-gopf').hasClass('gw-gopf-rtl')) { 342 startIndex = ($this.find('.gw-gopf-col-wrap').length-$this.data('col'))>0 ? $this.find('.gw-gopf-col-wrap').length-$this.data('col') : 0; 343 } 344 $this.addClass('gw-gopf-slider').data('sliderDefaults', { 345 responsive : true, 346 height : 'variable', 347 width : '100%', 348 next : { 349 button : $this.closest('.gw-gopf-posts-wrap').find('.gw-gopf-slider-controls-wrap').find('.gw-gopf-control-next'), 350 onAfter : function(data) { 351 $this.find('.gw-gopf-col-wrap').css('pointer-events','auto'); 352 if ($this.css('letterSpacing')=='30px' || $this.css('letterSpacing')=='20px') { 353 var id=0; 354 } else if ($this.css('letterSpacing')=='10px') { 355 var id=$this.data('col') == 1 ? 0 : 1; 356 } else { 357 var id=$this.data('col')-1; 358 }; 359 360 $this.closest('.gw-gopf-posts-wrap').css('overflow', 'visible'); 361 var items = $this.triggerHandler('currentVisible'); 362 $this.find('.gw-gopf-col-wrap').css({ 363 'opacity' : 0, 364 'z-index' : 0, 365 'position': 'absolute', 366 'visibility' : 'hidden', 367 'left': 0 368 }).eq(id).css({ 369 'position' : 'relative', 370 'left' : '0', 371 'z-index' : 'auto' 372 }); 373 items.each(function(index, element) { 374 $(element).css({ 'visibility' : 'visible', 'opacity' : 1, 'position': 'relative', 'z-index' : 'auto' }); 375 }); 376 $this.closest('.gw-gopf-posts-wrap-inner').find('.gw-gopf-posts-wrap-inner-overlay').hide(); 377 } 378 }, 379 prev : { 380 button : $this.closest('.gw-gopf-posts-wrap').find('.gw-gopf-slider-controls-wrap').find('.gw-gopf-control-prev'), 381 onAfter : function(data) { 382 $this.find('.gw-gopf-col-wrap').css('pointer-events','auto'); 383 if ($this.css('letterSpacing')=='30px' || $this.css('letterSpacing')=='20px') { 384 var id=1; 385 } else if ($this.css('letterSpacing')=='10px') { 386 var id=2; 387 } else { 388 var id=$this.data('col'); 389 }; 390 $this.closest('.gw-gopf-posts-wrap').css('overflow', 'visible'); 391 var items = $this.triggerHandler('currentVisible'); 392 $this.find('.gw-gopf-col-wrap').css({ 393 'opacity' : 0, 394 'z-index' : 0, 395 'position': 'absolute', 396 'visibility' : 'hidden', 397 'left': 0 398 }).eq(id).css({ 399 'position' : 'relative', 400 'left': '0', 401 'z-index' : 'auto' 402 }); 403 items.each(function(index, element) { 404 $(element).css({ 'visibility' : 'visible', 'opacity' : 1, 'position': 'relative', 'z-index' : 'auto' });
405 }); 406 $this.closest('.gw-gopf-posts-wrap-inner').find('.gw-gopf-posts-wrap-inner-overlay').hide(); 407 } 408 }, 409 scroll : { 410 queue : true, 411 items: 1, 412 onBefore : function(data) { 413 var items = $this.triggerHandler('currentVisible'); 414 $this.find('.gw-gopf-col-wrap').css('pointer-events','none'); 415 $portfolio.find('.gw-gopf-current.gw-gopf-post').removeClass('gw-gopf-current').trigger('tapOff'); 416 417 if ($this.css('letterSpacing')=='30px' || $this.css('letterSpacing')=='20px') { 418 var id=1; 419 } else if ($this.css('letterSpacing')=='10px') { 420 var id=$this.data('col') == 1 ? 1 : 2; 421 } else { 422 var id=$this.data('col'); 423 }; 424 425 $this.closest('.gw-gopf-posts-wrap').css('overflow', 'hidden'); 426 var items = $this.triggerHandler('currentVisible'); 427 $this.find('.gw-gopf-col-wrap').css({ 428 'visibility' : 'hidden', 429 'position': 'relative', 430 'opacity' : 0, 431 'zIndex' : 0 432 }).eq(id).css({ 433 'position' : 'absolute', 434 'left' : $this.closest('.caroufredsel_wrapper').width()+'px', 435 'z-index' : '200', 436 'visibility' : 'visible', 437 'opacity' : 1, 438 'zIndex' : 'auto' 439 }); 440 items.each(function(index, element) { 441 $(element).css({ 'visibility' : 'visible', 'opacity' : 1, 'position': 'relative', 'z-index' : 'auto' }); 442 }); 443 444 $this.closest('.gw-gopf-posts-wrap-inner').find('.gw-gopf-posts-wrap-inner-overlay').show(); 445 $this.trigger('resume'); 446 }, 447 onAfter : function(data) { 448 var direction = $this.triggerHandler('configuration', 'direction'); 449 $this.find('.gw-gopf-col-wrap').css('pointer-events','auto'); 450 451 /* Scrolling left */ 452 if (direction=='left') { 453 if ($this.css('letterSpacing')=='30px' || $this.css('letterSpacing')=='20px') { 454 var id=0; 455 } else if ($this.css('letterSpacing')=='10px') { 456 var id=1; 457 } else { 458 var id=$this.data('col')-1; 459 }; 460 461 $this.closest('.gw-gopf-posts-wrap').css('overflow', 'visible'); 462 var items = $this.triggerHandler('currentVisible'); 463 $this.find('.gw-gopf-col-wrap').css({ 464 'opacity' : 0, 465 'z-index' : 0, 466 'position': 'absolute', 467 'visibility' : 'hidden', 468 'left': 0 469 }).eq(id).css({ 470 'position' : 'relative', 471 'left' : '0', 472 'z-index' : 'auto' 473 });
474 items.each(function(index, element) { 475 $(element).css({ 'visibility' : 'visible', 'opacity' : 1, 'position': 'relative', 'z-index' : 'auto' }); 476 }); 477 $this.closest('.gw-gopf-posts-wrap-inner').find('.gw-gopf-posts-wrap-inner-overlay').hide(); 478 } 479 480 /* Scrolling right */ 481 if (direction=='right') { 482 if ($this.css('letterSpacing')=='30px' || $this.css('letterSpacing')=='20px') { 483 var id=1; 484 } else if ($this.css('letterSpacing')=='10px') { 485 var id=2; 486 } else { 487 var id=$this.data('col'); 488 } 489 490 $this.closest('.gw-gopf-posts-wrap').css('overflow', 'visible'); 491 var items = $this.triggerHandler('currentVisible'); 492 $this.find('.gw-gopf-col-wrap').css({ 493 'opacity' : 0, 494 'z-index' : 0, 495 'position': 'absolute', 496 'visibility' : 'hidden', 497 'left': 0 498 }).eq(id).css({ 499 'position' : 'relative', 500 'left' : '0', 501 'z-index' : 'auto' 502 }); 503 items.each(function(index, element) { 504 $(element).css({ 'visibility' : 'visible', 'opacity' : 1, 'position': 'relative', 'z-index' : 'auto' }); 505 }); 506 $this.closest('.gw-gopf-posts-wrap-inner').find('.gw-gopf-posts-wrap-inner-overlay').hide(); 507 } 508 } 509 }, 510 swipe : { 511 onMouse : true 512 }, 513 items : { 514 height : 'variable', 515 visible : { 516 min : 1, 517 max : $this.data('col') 518 }, 519 start: startIndex 520 521 }, 522 onCreate : function (data) { 523 $this.closest('.gw-gopf-posts-wrap').css('overflow', 'visible'); 524 var items = $this.triggerHandler('currentVisible'); 525 $this.find('.gw-gopf-col-wrap').css({ 526 'visibility' : 'hidden', 527 'position': 'absolute', 528 'opacity' : 0 529 }); 530 items.each(function(index, element) { 531 $(element).css({ 'visibility' : 'visible', 'opacity' : 1, 'position': 'relative' }); 532 }); 533 534 $(window).on('resize', function(){ 535 var paused = $this.triggerHandler('isPaused'); 536 if ($this.css('letterSpacing')=='30px' || $this.css('letterSpacing')=='20px') { 537 $this.trigger('configuration', ['items.visible', 1]); 538 } else if ($this.css('letterSpacing')=='10px') { 539 $this.trigger('configuration', ['items.visible', $this.data('col')==1 ? 1 : 2 ]); 540 } else { 541 $this.trigger('configuration', ['items.visible', $this.data('col')]); 542 543 }; 544 if (paused) { $this.trigger('pause', true); } 545 546 var items = $this.triggerHandler('currentVisible'); 547 $this.find('.gw-gopf-col-wrap').css({ 548 'visibility' : 'hidden', 549 'position': 'absolute', 550 'opacity' : 0 551 }); 552 items.each(function(index, element) { 553 $(element).css({ 'visibility' : 'visible', 'opacity' : 1, 'position': 'relative' }); 554 }); 555 }).resize(); 556 } 557 }); 558 559 /* Call slider */ 560 $this.carouFredSel(jQuery.extend($this.data('slider'), $this.data('sliderDefaults'))); 561 }); 562 563 }; 564 565 /* -------------------------------------------------------------------------------- / 566 [4] POPUP - Magnific Popup 567 / -------------------------------------------------------------------------------- */ 568 569 var portfolioGallery = [], portfolioGalleryO = [], mfpOpened=false; 570 function DoMagnificPopup() { 571 if (jQuery().magnificPopup) { 572 $portfolio.each(function(index, element) { 573 var $this = $(this); 574 if ( $this.data('lbenabled') ) { 575 $this.find('.gw-gopf-magnific-popup[href!=""], .gw-gopf-magnific-popup-html[href!=""]').attr('href','#'); 576 portfolioGallery[$this.data('id')] = $this.find('.gw-gopf-magnific-popup[data-mfp-src!="#"][data-mfp-src!=""], .gw-gopf-magnific-popup-html[data-mfp-src!="#"][data-mfp-src!=""]').magnificPopup({ 577 type : 'image', 578 closeOnContentClick : true, 579 removalDelay : 300, 580 mainClass : 'my-mfp-slide-bottom', 581 closeMarkup : '<a title="%title%" class="gw-gopf-mfp-close"></a>', 582 titleSrc: 'title',
583 gallery : { 584 enabled : $this.data('lbgallery'), 585 arrowMarkup: '<a title="%title%" class="gw-gopf-mfp-arrow mfp-arrow mfp-arrow-%dir%"></a>' 586 }, 587 image : { 588 markup: '<div class="mfp-figure">'+ 589 '<div class="mfp-close"></div>'+ 590 '<div class="mfp-img"></div>'+ 591 '<div class="mfp-bottom-bar">'+ 592 '<div class="gw-gopf-mfp-title mfp-title"></div>'+ 593 '<div class="gw-gopf-mfp-counter mfp-counter"></div>'+ 594 '</div>'+ 595 '</div>' 596 }, 597 iframe : { 598 patterns : { 599 vimeo : { 600 index: 'vimeo.com/', 601 id: '/', 602 src: '//player.vimeo.com/video/%id%&autoplay=1' 603 }, 604 dailymotion : { 605 index : 'dailymotion.com/', 606 id : '/', 607 src :'//dailymotion.com/embed/video/%id%?autoPlay=1' 608 }, 609 metacafe : { 610 index : 'metacafe.com/', 611 id : '/', 612 src : 'http://www.metacafe.com/embed/%id%?ap=1' 613 }, 614 soundcloud : { 615 index : 'soundcloud.com', 616 id : null, 617 src : '%id%' 618 }, 619 mixcloud : { 620 index : 'mixcloud.com', 621 id: null, 622 src: '%id%' 623 }, 624 beatport : { 625 index : 'beatport.com', 626 id : null, 627 src : '%id%' 628 } 629 }, 630 markup : '<div class="mfp-iframe-scaler">'+ 631 '<div class="mfp-close"></div>'+ 632 '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+ 633 '<div class="mfp-bottom-bar" style="margin-top:4px;"><div class="gw-gopf-mfp-title mfp-title"></div><div class="gw-gopf-mfp-counter mfp-counter"></div></div>'+ 634 '</div>' 635 }, 636 callbacks : { 637 elementParse : function(item) { 638 if ($(item.el).hasClass('gw-gopf-magnific-popup-html')) { 639 item.type = 'iframe' 640 }; 641 }, 642 change : function() { 643 var $currentItem = $(this.currItem.el); 644 if ($currentItem.hasClass('gw-gopf-magnific-popup-html')) { 645 setTimeout(function(){ 646 $('.mfp-title').html($currentItem.attr('title')) 647 },5); 648 } 649 650 /* Deep linking */ 651 if ($this.data('deepLinking')) { 652 mfpOpened = $(this.currItem.el); 653 if(history.pushState) { 654 location.hash = '#mpf-popup@'+$currentItem.attr('data-mfp-src')+'|'+$currentItem.data('id').split('_')[0]+'|'+$currentItem.data('id').split('_')[1]; 655 if (history.state==$currentItem.data('id')) { 656 history.pushState($currentItem.data('id'), null, window.location.href.replace(window.location.origin,'').split('#')[0]+'#mpf-popup@'+$currentItem.attr('href')+'|'+$currentItem.data('id').split('_')[0]+'|'+$currentItem.data('id').split('_')[1]); 657 }; 658 } else { 659 location.hash = '#mpf-popup@'+$currentItem.attr('href')+'|'+$currentItem.data('id').split('_')[0]+'|'+$currentItem.data('id').split('_')[1]; 660 }; 661 }; 662 663 var forcedHeight = $(this.currItem.el).data('height'); 664 665 if (forcedHeight != undefined) { 666 setTimeout(function(){ 667 $('.mfp-iframe-scaler').css({ 668 'paddingTop' : 0, 669 'display' : 'table-cell', 670 'verticalAlign' : 'middle', 671 'height' : forcedHeight 672 }); 673 },5); 674 } else { 675 setTimeout(function(){ 676 $('.mfp-iframe-scaler').css({ 677 'padding-top': '56.25%', 678 'display' : 'block', 679 'verticalAlign' : 'baseline', 680 'height' : 0 681 }); 682 },5); 683 }; 684 }, 685 beforeClose : function() { 686 if ($this.data('deepLinking')) { 687 if (history.pushState) 688 history.pushState('', null, window.location.pathname + window.location.search); 689 else { 690 var scrollPosX = document.body.scrollTop; 691 var scrollPosY = document.body.scrollLeft; 692 window.location.hash = ''; 693 document.body.scrollTop = scrollPosX; 694 document.body.scrollLeft = scrollPosY; 695 }; 696 }; 697 if ($(this.currItem.el).hasClass('gw-gopf-magnific-popup-html')) { 698 $('.mfp-wrap').css('display','none'); 699 }; 700 mfpOpened=false; 701 }, 702 afterClose : function() { 703 if (this.items[this.index].type == 'iframe') { 704 /* Firefox bug fix - force to redraw thumbnail */ 705 var timer=setInterval(function() { 706 if ($('.mfp-bg').length==0) { 707 clearInterval(timer); 708 $portfolio.find('.gw-gopf-post').css('opacity','0.99'); 709 setTimeout(function(){ $portfolio.find('.gw-gopf-post').css('opacity','1'); },20) 710 } 711 },50); 712 }; 713 } 714 } 715 });
716 } else { 717 $this.delegate('.gw-gopf-magnific-popup, .gw-gopf-magnific-popup-html','click', function(e) { 718 e.preventDefault(); 719 }); 720 }; 721 722 }); 723 }; 724 }; 725 726 DoMagnificPopup(); 727 728 function updatePopupGallery( portfolioId ) { 729 if ($portfolio.filter('[data-id="'+portfolioId+'"]').data('lbenabled')) { 730 var $galleryItems = $portfolio.filter('[data-id="'+portfolioId+'"]').find('.gw-gopf-magnific-popup[data-mfp-src!="#"][data-mfp-src!=""], .gw-gopf-magnific-popup-html[data-mfp-src!="#"][data-mfp-src!=""]'); 731 portfolioGallery[portfolioId].splice(0, $galleryItems.length); 732 $galleryItems.each(function(index, element) { 733 if (!$(this).closest('.gw-gopf-isotope-hidden').length) { 734 portfolioGallery[portfolioId].push(this); 735 }; 736 }); 737 }; 738 }; 739 740 $portfolio.find('.gw-gopf-magnific-popup, .gw-gopf-magnific-popup-html').on('mfpOpen', function(e) { 741 if (jQuery().carouFredSel && $sliders.length) { 742 $portfolio.find('.gw-gopf-posts-wrap-inner-overlay').show(); 743 setTimeout(function() { 744 $sliders.each(function(index, element) { 745 var $this = $(this); 746 $this.trigger('pause', true); 747 }); 748 }, 10); 749 } 750 }); 751 752 $portfolio.find('.gw-gopf-magnific-popup, .gw-gopf-magnific-popup-html').on('mfpAfterClose', function(e) { 753 if (jQuery().carouFredSel && $sliders.length) { 754 $portfolio.find('.gw-gopf-posts-wrap-inner-overlay').hide(); 755 setTimeout(function() { 756 $sliders.each(function(index, element) { 757 var $this = $(this); 758 $this.trigger('resume'); 759 }); 760 }, 10); 761 } 762 }); 763 764 /* -------------------------------------------------------------------------------- / 765 [5] ISOTOPE 766 / -------------------------------------------------------------------------------- */ 767 768 /* Isotope */ 769 770 if (jQuery().GWisotope) { 771 772 /* Call Isotope plugin */ 773 $.fn.callIsotope = function ( filter ) { 774 var $this = $(this); 775 filter = $this.closest('.gw-gopf').data('filter-type')==undefined || $this.closest('.gw-gopf').data('filter-type')=='opacity' ? '*' : filter; 776 $this.GWisotope({
777 filter : filter, 778 transformsEnabled: $this.closest('.gw-gopf').data('transenabled') ? true : false, 779 animationEngine: isIE && isIE == 8 ? 'css' : 'best-available', 780 containerClass : 'gw-gopf-isotope', 781 hiddenClass : 'gw-gopf-isotope-hidden', 782 itemClass : 'gw-gopf-isotope-item', 783 layoutMode : 'masonry', 784 onLayout: function( $elems, instance ) { 785 if (instance.element.closest('.gw-gopf').data('id')!=undefined) { 786 updatePopupGallery(instance.element.closest('.gw-gopf').data('id')); 787 }; 788 instance.element.css('marginBottom',0).closest('.gw-gopf-posts-wrap-inner').css('marginTop',0).end().find('.gw-gopf-post-col').css('marginTop',0); 789 790 791 } 792 }, 793 function( $elems, instance ) { 794 795 /* auto load on filtering */ 796 if (instance.element.closest('.gw-gopf').hasClass('gw-gopf-pagination')) { 797 var visibleItems = !instance.element.closest('.gw-gopf').hasClass('gw-gopf-filter-opacity') ? instance.$filteredAtoms.length : instance.element.closest('.gw-gopf').find('.gw-gopf-col-wrap').filter(':not(.gw-gopf-disabled)').length; 798 var visibleItemsTerm = instance.element.closest('.gw-gopf').find('.gw-gopf-cats .gw-gopf-current').data('count'); 799 var postsCount = instance.element.closest('.gw-gopf').find('.gw-gopf-pagination-wrapper').data('posts'); 800 var pagesCount = instance.element.closest('.gw-gopf').find('.gw-gopf-pagination-wrapper').data('pages'); 801 if (postsCount>0) { 802 var itemsPerPage = Math.ceil(postsCount/pagesCount); 803 } 804 if (visibleItems<itemsPerPage) { 805 instance.element.closest('.gw-gopf').find('.gw-gopf-pagination-wrapper').data('posts-per-page', itemsPerPage-visibleItems); 806 } else { 807 itemsPerPage = instance.element.closest('.gw-gopf').find('.gw-gopf-pagination-wrapper').data('posts-per-page', itemsPerPage); 808 } 809 if (instance.element.closest('.gw-gopf').find('.gw-gopf-cats .gw-gopf-current').data('filter')!=undefined) { 810 $(instance.element.closest('.gw-gopf')).find('.gw-gopf-pagination-wrapper').data('tax', instance.element.closest('.gw-gopf').find('.gw-gopf-filter').data('tax')); 811 $(instance.element.closest('.gw-gopf')).find('.gw-gopf-pagination-wrapper').data('term', instance.element.closest('.gw-gopf').find('.gw-gopf-cats .gw-gopf-current').data('filter')); 812 } else { 813 $(instance.element.closest('.gw-gopf')).find('.gw-gopf-pagination-wrapper').removeData('tax'); 814 $(instance.element.closest('.gw-gopf')).find('.gw-gopf-pagination-wrapper').removeData('term'); 815 } 816 if (itemsPerPage>-1 && itemsPerPage>visibleItems && visibleItemsTerm>visibleItems) { 817 $(instance.element.closest('.gw-gopf')).find('.gw-gopf-pagination-load-more').trigger('click'); 818 } 819 if (visibleItemsTerm==visibleItems) { 820 if (instance.element.closest('.gw-gopf').find('.gw-gopf-pagination-wrapper').is(':visible')) { 821 instance.element.closest('.gw-gopf').find('.gw-gopf-pagination-wrapper').stop().fadeTo(550, 0, function() { 822 instance.element.closest('.gw-gopf').find('.gw-gopf-pagination-wrapper').stop().slideUp(); 823 }); 824 }; 825 } else { 826 if (!instance.element.closest('.gw-gopf').find('.gw-gopf-pagination-wrapper').is(':visible')) { 827 instance.element.closest('.gw-gopf').find('.gw-gopf-pagination-wrapper').stop().fadeTo(550, 1, function() { 828 instance.element.closest('.gw-gopf').find('.gw-gopf-pagination-wrapper').stop().slideDown(); 829 }); 830 }; 831 }; 832 }; 833 } 834 ); 835 }; 836 837 /* Extend the plugin to hack change column number if required */ 838 $.extend( $.GWIsotope.prototype, { 839 _masonryReset : function() { 840 // layout-specific props 841 this.masonry = {}; 842 843 // FIXME shouldn't have to call this again 844 this._getSegments(); 845 846 /* Hack - set col number manually */ 847 if (this.element.hasClass('gw-gopf-posts')) { 848 if (this.element.css('letterSpacing')=='30px' || this.element.css('letterSpacing')=='20px') { 849 this.masonry.cols = 1; 850 } else if (this.element.css('letterSpacing')=='10px') { 851 if (this.element.data('col')!=1) { 852 this.masonry.cols = 2; 853 } else { 854 this.masonry.cols = 1; 855 } 856 } else { 857 this.masonry.cols = this.element.data('col'); 858 }; 859 var i = this.masonry.cols; 860 861 }; 862 /* end of Hack */ 863 864 /* modify margin */ 865 this.element.css('marginBottom',this.element.closest('.gw-gopf').data('rowspace')).closest('.gw-gopf-posts-wrap-inner').css('marginTop',this.element.closest('.gw-gopf').data('rowspace')*-1).end().find('.gw-gopf-post-col').css('marginTop',this.element.closest('.gw-gopf').data('rowspace')); 866 867 this.masonry.colYs = []; 868 while (i--) { 869 this.masonry.colYs.push( 0 ); 870 } 871 }, 872 _masonryGetContainerSize : function() { 873 var containerHeight = Math.max.apply( Math, this.masonry.colYs ); 874 containerHeight -= this.element.closest('.gw-gopf').data('rowspace'); 875 return { height: containerHeight }; 876 } 877 }); 878 879 $.GWIsotope.prototype._positionAbs = function( x, y ) { 880 if (this.element.closest('.gw-gopf.gw-gopf-rtl').length) { 881 return { right: x, top: y }; 882 } else { 883 return { left: x, top: y }; 884 } 885 }; 886 887 888 /* Filter button events */ 889 $portfolioFilter.delegate('div a', 'click', function(e) { 890 var $this=$(this), $parent=$this.closest('span'), filter; 891 e.preventDefault(); 892 893 $parent.addClass('gw-gopf-current').siblings().removeClass('gw-gopf-current'); 894 if ($parent.data('filter')==undefined) { 895 $this.closest('.gw-gopf').find('.gw-gopf-posts').callIsotope('*'); 896 $this.closest('.gw-gopf').find('.gw-gopf-posts').find('.gw-gopf-col-wrap').removeClass('gw-gopf-disabled'); 897 } else { 898 $this.closest('.gw-gopf').find('.gw-gopf-posts').callIsotope('[data-filter~="'+$parent.data('filter')+'"]'); 899 $this.closest('.gw-gopf').find('.gw-gopf-posts').find('.gw-gopf-col-wrap').addClass('gw-gopf-disabled').filter('[data-filter~="'+$parent.data('filter')+'"]').removeClass('gw-gopf-disabled'); 900 }; 901 }); 902 903 904 /* Call Isotope plugin */ 905 $portfolio.filter('.gw-gopf-grid-type').each(function(index, element) { 906 var $this = $(this); 907 $this.find('.gw-gopf-posts').callIsotope('*'); 908 if (!$this.hasClass('gw-gopf-isotope-ready')) { $this.closest('.gw-gopf').addClass('gw-gopf-isotope-ready'); }; 909 }); 910 911 }; 912 913 /* -------------------------------------------------------------------------------- / 914 [6] EFFECTS 915 / -------------------------------------------------------------------------------- */ 916 917 /* Handle taps on touch devices */ 918 919 if (isTouchDevice) { 920 $portfolio.delegate('.gw-gopf-post', 'touchstart', function (event) { 921 var $this = $(this); 922 $portfolio.find('.gw-gopf-current.gw-gopf-post').not($this).removeClass('gw-gopf-current').trigger('tapOff'); 923 if ( !$this.hasClass('gw-gopf-current')) { 924 $this.addClass('gw-gopf-current'); 925 $this.trigger('tapOn'); 926 }; 927 }); 928 929 /* Remove effect when you tap anywhere out */ 930 $(document).delegate(this, 'touchstart', function (event) { 931 if ($(event.target).closest('.gw-gopf-posts-wrap').length) { 932 $(event.target).closest('.gw-gopf-posts-wrap').addClass('gw-gopf-touch'); 933 } else { 934 $('.gw-gopf-posts-wrap').removeClass('gw-gopf-touch'); 935 } 936 if (!$(event.target).closest('.gw-gopf-current.gw-gopf-post').length) { 937 $portfolio.find('.gw-gopf-current.gw-gopf-post').removeClass('gw-gopf-current').trigger('tapOff'); 938 }; 939 if (!$(event.target).closest('.gw-gopf-posts-wrap').length) { 940 $portfolio.find('.gw-gopf-current.gw-gopf-post').removeClass('gw-gopf-current').trigger('tapOff'); 941 }; 942 943 }); 944 945 /* Some trick to re-enable filtering (exluded element fix) */ 946 $portfolio.delegate('.gw-gopf-cats > span a', 'touchstart', function (event) { 947 var $this = $(this); 948 $this.off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 949 $this.one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() { 950 /* $(this).trigger('click');* - just in case */ 951 }); 952 $portfolio.find('.gw-gopf-current.gw-gopf-post').removeClass('gw-gopf-current').trigger('tapOff'); 953 }); 954 955 /* Remove effect - exluded elements correction */ 956 $('body').delegate('button, input, select, textarea, a, .noSwipe', 'touchstart', function (event) { 957 if (!$(event.target).closest('.gw-gopf-current.gw-gopf-post').length) { 958 $portfolio.find('.gw-gopf-current.gw-gopf-post').removeClass('gw-gopf-current').trigger('tapOff'); 959 }; 960 }); 961 962 }; 963 964 $portfolio.delegate('.gw-gopf-post', 'mouseenter mouseleave tapOn tapOff', function (event) { 965 var $this = $(this), 966 postHeight = $this.outerHeight(), 967 $content = $this.find('.gw-gopf-post-content'), 968 contentHeight = $content.outerHeight(), 969 $overlayInner = $this.find('.gw-gopf-post-overlay-inner'), 970 overlayInnerHeight = $overlayInner.height(); 971 972 if (event.type == 'mouseenter' || event.type == 'tapOn') { 973 if ($this.hasClass('gw-gopf-current') && event.type == 'mouseenter' ) { return false; }; 974 $(event.target).closest('.gw-gopf').removeClass('gw-gopf-touch'); 975 $this.find('.gw-gopf-post-overlay').css('height', $this.find('.gw-gopf-post-header').outerHeight()); 976 $this.find('.gw-gopf-post-content-wrap').show(); 977 } else if (event.type == 'mouseleave' || event.type == 'tapOff') { 978 if ($this.hasClass('gw-gopf-current') && event.type == 'mouseleave' ) { return false; }; 979 $this.removeClass('gw-gopf-current'); 980 $(event.target).closest('.gw-gopf').addClass('gw-gopf-touch'); 981 } 982 983 /* Flex Slide Up */ 984 if ($this.closest('.gw-gopf').hasClass('gw-gopf-style-flex-slide-up')) { 985 if (event.type == 'mouseenter' || event.type == 'tapOn') { 986 if ( postHeight-contentHeight-overlayInnerHeight <= 0 ) { 987 $overlayInner.css('display', 'none'); 988 } else { 989 $overlayInner.css('display', 'inline-block'); 990 }; 991 992 /* Media wrap */ 993 $this.find('.gw-gopf-post-content-wrap').css({ 994 'top' : postHeight 995 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 996 997 setTimeout(function(){ 998 $this.find('.gw-gopf-post-content-wrap').css({ 999 'top' : postHeight-contentHeight < 0 ? 0 : postHeight-contentHeight 1000 });
1001 }, 1); 1002 1003 /* Overlay */ 1004 $this.find('.gw-gopf-post-overlay').css({ 1005 'height' : postHeight 1006 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1007 1008 setTimeout(function(){ 1009 $this.find('.gw-gopf-post-overlay').css({ 1010 'height' : postHeight-contentHeight < 0 ? 0 : postHeight-contentHeight 1011 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1012 }, 1); 1013 }; 1014 1015 if (event.type == 'mouseleave' || event.type == 'tapOff') { 1016 $this.find('.gw-gopf-post-content-wrap').css({ 1017 'top' : supportsTransitions ? postHeight : '100%' 1018 }).one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() { 1019 $(this).css({ 'top' : '100%' }); 1020 }); 1021 1022 $this.find('.gw-gopf-post-overlay').css({ 1023 'height' : supportsTransitions ? postHeight : '100%' 1024 }).one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() { 1025 $(this).css({ 'height' : '100%' }); 1026 }); 1027 }; 1028 }; 1029 1030 /* Flex Slide & Push Up */ 1031 if ($this.closest('.gw-gopf').hasClass('gw-gopf-style-flex-slide-push-up')) { 1032 if (event.type == 'mouseenter' || event.type == 'tapOn') { 1033 if ( postHeight-contentHeight-overlayInnerHeight <= 0 ) { 1034 $overlayInner.css('display', 'none'); 1035 } else { 1036 $overlayInner.css('display', 'inline-block'); 1037 }; 1038 1039 /* Media wrap */ 1040 $this.find('.gw-gopf-post-content-wrap').css({ 1041 'top' : postHeight 1042 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1043 1044 setTimeout(function(){ 1045 $this.find('.gw-gopf-post-content-wrap').css({ 1046 'top' : postHeight-contentHeight < 0 ? 0 : postHeight-contentHeight 1047 }); 1048 }, 1); 1049 1050 /* Overlay */ 1051 $this.find('.gw-gopf-post-overlay').css({ 1052 'top' : postHeight-contentHeight < 0 ? 100 : contentHeight, 1053 'height' : postHeight 1054 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1055 1056 setTimeout(function(){ 1057 $this.find('.gw-gopf-post-overlay').css({ 1058 'height' : postHeight-contentHeight < 0 ? 0 : postHeight-contentHeight 1059 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1060 }, 1); 1061 1062 /* Header */ 1063 $this.find('.gw-gopf-post-header').css({ 1064 'marginTop' : (postHeight-contentHeight < 0 ? postHeight : contentHeight)*-1, 1065 'marginBottom' : postHeight-contentHeight < 0 ? postHeight : contentHeight 1066 }); 1067 }; 1068 1069 if (event.type == 'mouseleave' || event.type == 'tapOff') { 1070 $this.find('.gw-gopf-post-content-wrap').css({ 1071 'top' : supportsTransitions ? postHeight : '100%' 1072 }).one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() { 1073 $(this).css({ 'top' : '100%' }); 1074 }); 1075 1076 $this.find('.gw-gopf-post-overlay').css({ 1077 'top' : 0, 1078 'height' : supportsTransitions ? postHeight : '100%' 1079 }).one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() { 1080 $(this).css({ 'height' : '100%' }); 1081 }); 1082 1083 $this.find('.gw-gopf-post-header').css({ 1084 'marginTop' : 0, 1085 'marginBottom' : 0 1086 }); 1087 }; 1088 }; 1089 1090 /* Flex Slide & Push Up Full */ 1091 if ($this.closest('.gw-gopf').hasClass('gw-gopf-style-flex-slide-push-up-full')) { 1092 if (event.type == 'mouseenter' || event.type == 'tapOn') { 1093 $this.find('.gw-gopf-post-header').css({ 1094 'marginTop' : postHeight*-1, 1095 'marginBottom' : postHeight 1096 }); 1097 }; 1098 1099 if (event.type == 'mouseleave' || event.type == 'tapOff') { 1100 $this.find('.gw-gopf-post-header').css({ 1101 'marginTop' : 0, 1102 'marginBottom' : 0 1103 }); 1104 }; 1105 }; 1106 1107 /* Flex Slide Down */ 1108 if ($this.closest('.gw-gopf').hasClass('gw-gopf-style-flex-slide-down')) { 1109 if (event.type == 'mouseenter' || event.type == 'tapOn') { 1110 if ( postHeight-contentHeight-overlayInnerHeight <= 0 ) { 1111 $overlayInner.css('display', 'none'); 1112 } else { 1113 $overlayInner.css('display', 'inline-block'); 1114 }; 1115 1116 /* Media wrap */ 1117 $this.find('.gw-gopf-post-content-wrap').css({ 1118 'bottom' : postHeight 1119 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1120 1121 setTimeout(function(){ 1122 $this.find('.gw-gopf-post-content-wrap').css({ 1123 'bottom' : postHeight-contentHeight < 0 ? 0 : postHeight-contentHeight 1124 });
1125 }, 1); 1126 1127 /* Overlay */ 1128 $this.find('.gw-gopf-post-overlay').css({ 1129 'height' : postHeight 1130 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1131 1132 setTimeout(function(){ 1133 $this.find('.gw-gopf-post-overlay').css({ 1134 'height' : postHeight-contentHeight < 0 ? 0 : postHeight-contentHeight 1135 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1136 }, 1); 1137 }; 1138 1139 if (event.type == 'mouseleave' || event.type == 'tapOff') { 1140 $this.find('.gw-gopf-post-content-wrap').css({ 1141 'bottom' : supportsTransitions ? postHeight : '100%' 1142 }).one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() { 1143 $(this).css({ 'bottom' : '100%' }); 1144 }); 1145 1146 $this.find('.gw-gopf-post-overlay').css({ 1147 'height' : supportsTransitions ? postHeight : '100%' 1148 }).one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() { 1149 $(this).css({ 'height' : '100%' }); 1150 }); 1151 }; 1152 }; 1153 1154 /* Flex Slide & Push Down */ 1155 if ($this.closest('.gw-gopf').hasClass('gw-gopf-style-flex-slide-push-down')) { 1156 if (event.type == 'mouseenter' || event.type == 'tapOn') { 1157 if ( postHeight-contentHeight-overlayInnerHeight <= 0 ) { 1158 $overlayInner.css('display', 'none'); 1159 } else { 1160 $overlayInner.css('display', 'inline-block'); 1161 }; 1162 1163 /* Media wrap */ 1164 $this.find('.gw-gopf-post-content-wrap').css({ 1165 'bottom' : postHeight 1166 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1167 1168 setTimeout(function(){ 1169 $this.find('.gw-gopf-post-content-wrap').css({ 1170 'bottom' : postHeight-contentHeight < 0 ? 0 : postHeight-contentHeight 1171 }); 1172 }, 1); 1173 1174 /* Overlay */ 1175 $this.find('.gw-gopf-post-overlay').css({ 1176 'bottom' : postHeight-contentHeight < 0 ? 100 : contentHeight, 1177 'height' : postHeight 1178 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1179 1180 setTimeout(function(){ 1181 $this.find('.gw-gopf-post-overlay').css({ 1182 'height' : postHeight-contentHeight < 0 ? 0 : postHeight-contentHeight 1183 }).off('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1184 }, 1); 1185 1186 /* Header */ 1187 $this.find('.gw-gopf-post-header').css({ 1188 'marginBottom' : (postHeight-contentHeight < 0 ? postHeight : contentHeight)*-1, 1189 'marginTop' : postHeight-contentHeight < 0 ? postHeight : contentHeight 1190 }); 1191 }; 1192 1193 if (event.type == 'mouseleave' || event.type == 'tapOff') { 1194 $this.find('.gw-gopf-post-content-wrap').css({ 1195 'bottom' : supportsTransitions ? postHeight : '100%' 1196 }).one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() { 1197 $(this).css({ 'bottom' : '100%' }); 1198 }); 1199 1200 $this.find('.gw-gopf-post-overlay').css({ 1201 'bottom' : 0, 1202 'height' : supportsTransitions ? postHeight : '100%' 1203 }).one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() { 1204 $(this).css({ 'height' : '100%' }); 1205 }); 1206 1207 $this.find('.gw-gopf-post-header').css({ 1208 'marginBottom' : 0, 1209 'marginTop' : 0 1210 }); 1211 }; 1212 }; 1213 1214 /* Flex Slide & Push Down Full */ 1215 if ($this.closest('.gw-gopf').hasClass('gw-gopf-style-flex-slide-push-down-full')) { 1216 if (event.type == 'mouseenter' || event.type == 'tapOn') { 1217 $this.find('.gw-gopf-post-header').css({ 1218 'marginTop' : postHeight, 1219 'marginBottom' : postHeight*-1 1220 }); 1221 }; 1222 1223 if (event.type == 'mouseleave' || event.type == 'tapOff') { 1224 $this.find('.gw-gopf-post-header').css({ 1225 'marginTop' : 0, 1226 'marginBottom' : 0 1227 }); 1228 }; 1229 }; 1230 1231 /* Door style */ 1232 if ($this.closest('.gw-gopf').hasClass('gw-gopf-style-door-slide-down')) { 1233 if (event.type == 'mouseenter' || event.type == 'tapOn') { 1234 $this.css({ 1235 'marginBottom' : contentHeight * -1, 1236 'paddingBottom' : contentHeight 1237 });
1238 }; 1239 1240 if (event.type == 'mouseleave' || event.type == 'tapOff') { 1241 $this.css({ 1242 'marginBottom' : 0, 1243 'paddingBottom' : 0 1244 }); 1245 }; 1246 }; 1247 1248 /* Delux Push Up */ 1249 if ($this.closest('.gw-gopf').hasClass('gw-gopf-style-delux-push-up')) { 1250 if (event.type == 'mouseenter' || event.type == 'tapOn') { 1251 $this.find('.gw-gopf-post-content-wrap').css('top', $this.find('.gw-gopf-post-header').outerHeight()); 1252 $this.css({ 1253 'marginTop' : contentHeight * -1, 1254 'paddingBottom' : contentHeight 1255 }); 1256 1257 }; 1258 1259 if (event.type == 'mouseleave' || event.type == 'tapOff') { 1260 $this.css({ 1261 'marginTop' : 0, 1262 'paddingBottom' : 0 1263 }); 1264 }; 1265 }; 1266 1267 /* Delux Push Down */ 1268 if ($this.closest('.gw-gopf').hasClass('gw-gopf-style-delux-push-down')) { 1269 if (event.type == 'mouseenter' || event.type == 'tapOn') { 1270 $this.find('.gw-gopf-post-content-wrap').css('bottom', $this.find('.gw-gopf-post-header').outerHeight()); 1271 $this.find('.gw-gopf-post-overlay').css('height', $this.find('.gw-gopf-post-header').outerHeight()); 1272 $this.css({ 1273 'marginBottom' : contentHeight * -1, 1274 'paddingTop' : contentHeight 1275 }); 1276 }; 1277 1278 if (event.type == 'mouseleave' || event.type == 'tapOff') { 1279 $this.css({ 1280 'marginBottom' : 0, 1281 'paddingTop' : 0 1282 }); 1283 }; 1284 }; 1285 1286 }); 1287 1288 /* -------------------------------------------------------------------------------- / 1289 [7] DEEP LINKING 1290 / -------------------------------------------------------------------------------- */ 1291 1292 function doHashChange() { 1293 var hashinfo = getHashInfo(), 1294 galleryItemIndex; 1295 1296 if (!hashinfo || hashinfo==undefined) { 1297 if (mfpOpened!=false) { 1298 $.magnificPopup.close(); 1299 } 1300 return false; 1301 } else { 1302 if (!$portfolio.filter('[data-id="'+hashinfo[2]+'"]').data('deepLinking')) { return false; }; 1303 }; 1304 1305 if (portfolioGallery[hashinfo[2]]!=undefined) { 1306 portfolioGallery[hashinfo[2]].each(function(index, element) { 1307 if ($(this).data('id')==hashinfo[1]+'_'+hashinfo[2]) { 1308 galleryItemIndex=index; 1309 }; 1310 }); 1311 1312 if (galleryItemIndex>-1) { 1313 if (mfpOpened!=false) { 1314 if (mfpOpened.data('id')!=$(portfolioGallery[hashinfo[2]]).eq(galleryItemIndex).data('id')) { 1315 portfolioGallery[hashinfo[2]].magnificPopup('open', galleryItemIndex); 1316 }; 1317 } else { 1318 portfolioGallery[hashinfo[2]].magnificPopup('open', galleryItemIndex); 1319 }; 1320 }; 1321 }; 1322 }; 1323 1324 doHashChange(); 1325 1326 function getHash() { 1327 var currentHash = location.hash && location.hash !='' ? location.hash.split('#')[1] : null; 1328 return currentHash; 1329 }; 1330 1331 function getHashInfo() { 1332 var hashData = getHash(); 1333 if (!hashData) return false; 1334 hashData = hashData.replace(/%7C/g, '|'); 1335 if (hashData && hashData.split('@').length == 2 && hashData.split('@')[0] == 'mpf-popup' && hashData.split('@')[1].split('|').length == 3) { 1336 var hashParts = hashData.split('@')[1].split('|'); 1337 return hashParts; 1338 }; 1339 }; 1340 1341 if (window.addEventListener) { 1342 window.addEventListener("hashchange", doHashChange, false); 1343 } else if (window.attachEvent) { 1344 window.attachEvent("onhashchange", doHashChange); 1345 }; 1346 1347 /* -------------------------------------------------------------------------------- / 1348 [8] OTHERS 1349 / -------------------------------------------------------------------------------- */ 1350 1351 /* -------------------------------------------------------------------------------- / 1352 [8] OTHERS 1353 / -------------------------------------------------------------------------------- */ 1354 1355 $(window).resize(function() { 1356 $portfolio.filter('.gw-gopf-isotope-ready').find('.gw-gopf-posts').GWisotope('reLayout'); 1357 }); 1358 1359 $(window).load(function() { 1360 if (supportsOrientationchange) { 1361 if (gw_go_portfolio_settings.mobileTransition=='enabled') { 1362 $('.gw-gopf-no-trans').removeClass('gw-gopf-no-trans'); 1363 }; 1364 } else { 1365 $('.gw-gopf-no-trans').removeClass('gw-gopf-no-trans'); 1366 }; 1367 }); 1368 1369 1370 }); 1371}(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.