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