1/*global jQuery,google */ 2 3var SWIFT = SWIFT || {}; 4 5(function(){ 6 7 // USE STRICT 8 "use strict"; 9 10 ///////////////////////////////////////////// 11 // PAGE FUNCTIONS 12 ///////////////////////////////////////////// 13 14 SWIFT.page = { 15 init: function () { 16 17 // BROWSER CHECK 18 SWIFT.page.browserCheck(); 19 20 // FITTEXT 21 SWIFT.page.resizeHeadings(); 22 23 // HEADER SLIDER 24 if (jQuery('body').hasClass('header-below-slider') && jQuery('.home-slider-wrap').length > 0) { 25 SWIFT.page.headerSlider(); 26 } 27 28 // ONE PAGE NAV 29 if (jQuery('#one-page-nav').length > 0) { 30 SWIFT.page.onePageNav(); 31 } 32 33 // BACK TO TOP 34 if (jQuery('#back-to-top').length > 0) { 35 $window.scroll(function() { 36 SWIFT.page.backToTop(); 37 }); 38 } 39 40 // EXPANDING ASSETS 41 SWIFT.page.expandingAssets(); 42 43 // RECENT POSTS 44 if (jQuery('.recent-posts').length > 0) { 45 SWIFT.recentPosts.init(); 46 } 47 48 // MOVE MODALS TO BOTTOM OF PAGE 49 SWIFT.page.moveModals(); 50 51 // LOAD MAP ASSET ON MODAL CLICK 52 jQuery('a[data-toggle="modal"]').on('click', function() { 53 setTimeout(function() { 54 SWIFT.map.init(); 55 }, 300); 56 57 return true; 58 }); 59 60 // REFRESH MODAL IFRAME ON CLOSE (FOR VIDEOS) 61 SWIFT.page.modalClose(); 62 63 // REPLACE COMMENTS REPLY TITLE HTML 64 if (body.hasClass('single-post')) { 65 var replyTitle = jQuery('#respond').find('h3'); 66 var originalText = jQuery('#respond').find('h3').html(); 67 68 replyTitle.addClass('spb-heading'); 69 replyTitle.html('<span>'+originalText+'</span>'); 70 } 71 72 // SMOOTH SCROLL LINKS 73 SWIFT.page.smoothScrollLinks(); 74 75 // STICKY SIDEBAR 76 if (!isMobileAlt && sfIncluded.hasClass('stickysidebars') && jQuery('.sidebar').length > 0) { 77 SWIFT.page.stickySidebars(); 78 } 79 80 // PORTFOLIO STICKY SIDEBAR 81 if (!isMobileAlt && jQuery('article.type-portfolio').hasClass('single-portfolio-split')) { 82 //SWIFT.portfolio.stickyDetails(); 83 } 84 85 // BUDDYPRESS ACTIVITY LINK CLICK 86 jQuery('.activity-time-since,.bp-secondary-action').on('click', function(e) { 87 e.preventDefault(); 88 jQuery('.viewer').css('display', 'none'); 89 window.location = jQuery(this).attr('href'); 90 }); 91 92 // LOVE IT CLICK 93 jQuery('.love-it').on('click', function() { 94 SWIFT.page.loveIt(jQuery(this)); 95 return false; 96 }); 97 98 // ARTICLE SHARE 99 SWIFT.page.articleShare(); 100 101 // ARTICLE NAVIGATION 102 if (body.hasClass('article-swipe') && body.hasClass('single-post') && jQuery('.post-pagination-wrap').length > 0) { 103 //SWIFT.page.articleNavigation(); 104 } 105 106 // ARTICLE WITH FULL WIDTH MEDIA TITLE 107 if (jQuery('article').hasClass('single-post-fw-media-title')) { 108 SWIFT.page.postMediaTitle(); 109 } 110 111 // RELATED POSTS 112 if (jQuery('.related-items').length > 0) { 113 SWIFT.relatedPosts.init(); 114 } 115 116 // LIGHTBOX 117 SWIFT.page.lightbox(); 118 119 // MOBILE 2 CLICK IMAGES 120 if (isMobileAlt && body.hasClass('mobile-two-click')) { 121 SWIFT.page.mobileThumbLinkClick(); 122 } 123 124 // PAGE FADE OUT 125 if (body.hasClass('page-transitions') && !isMobileAlt) { 126 SWIFT.page.pageTransitions(); 127 } 128 129 // DIRECTORY SUBMIT 130 SWIFT.page.directorySubmit(); 131 }, 132 homePreloader: function() { 133 // Site loaded, fade out preloader 134 body.addClass('sf-preloader-done'); 135 setTimeout(function() { 136 jQuery('#sf-home-preloader').fadeOut(300); 137 }, 300); 138 }, 139 load: function() { 140 141 // Hero HEADING 142 if (jQuery('.fancy-heading').length > 0) { 143 SWIFT.page.fancyHeading(); 144 } 145 146 // FS NEXT/PREV 147 if (jQuery('#prev-article-pagination') || jQuery('#next-article-pagination')) { 148 149 if ((body.hasClass('single-portfolio') && jQuery('article.portfolio').hasClass('single-portfolio-fw-media')) || (body.hasClass('single-post') && (jQuery('article.type-post').hasClass('single-post-fw-media-title') || jQuery('article.type-post').hasClass('single-post-fw-media') ))) { 150 151 setTimeout(function() { 152 SWIFT.page.fwMediaNextPrevAdjust(); 153 }, 500); 154 $window.smartresize( function() { 155 SWIFT.page.fwMediaNextPrevAdjust(); 156 }); 157 } 158 159 SWIFT.page.fsNextPrev(); 160 $window.scroll(function() { 161 SWIFT.page.fsNextPrev(); 162 }); 163 } 164 165 // HASH CHECK 166 setTimeout(function() { 167 var urlHash = document.location.toString(); 168 if (urlHash.match('#')) { 169 var hash = urlHash.split('#')[1]; 170 if ( jQuery('#' + hash).length > 0 ) { 171 SWIFT.page.onePageNavGoTo('#' + hash); 172 } 173 } 174 }, 200); 175 }, 176 browserCheck: function() { 177 178 // BODY CLASSES 179 if (isMobileAlt) { 180 body.addClass("mobile-browser"); 181 } else { 182 body.addClass("standard-browser"); 183 } 184 if (isIEMobile) { 185 body.addClass("ie-mobile"); 186 } 187 if (isAppleDevice) { 188 body.addClass("apple-mobile-browser"); 189 } 190 if (body.hasClass("woocommerce-page") && !body.hasClass("woocommerce")) { 191 body.addClass("woocommerce"); 192 } 193 194 // ADD IE CLASS 195 if (IEVersion && IEVersion < 9) { 196 body.addClass('browser-ie'); 197 } 198 199 // ADD IE10 CLASS 200 var pattern = /MSIE\s([\d]+)/, 201 ua = navigator.userAgent, 202 matched = ua.match(pattern); 203 if (matched) { 204 body.addClass('browser-ie10'); 205 } 206 207 // ADD IE11 CLASS 208 if (!!navigator.userAgent.match(/Trident.*rv\:11\./)) { 209 body.addClass('browser-ie11'); 210 } 211 212 // ADD SAFARI CLASS
213 if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) { 214 body.addClass('browser-safari'); 215 } 216 }, 217 resizeHeadings: function() { 218 var h1FontSize = jQuery('h1:not(.logo-h1)').css('font-size'), 219 h2FontSize = jQuery('h2:not(.caption-title)').css('font-size'); 220 221 SWIFT.page.resizeHeadingsResize(h1FontSize, h2FontSize); 222 $window.smartresize( function() { 223 SWIFT.page.resizeHeadingsResize(h1FontSize, h2FontSize); 224 }); 225 }, 226 resizeHeadingsResize: function(h1FontSize, h2FontSize) { 227 if ($window.width() <= 768) { 228 if (h1FontSize) { 229 h1FontSize = h1FontSize.replace("px", ""); 230 var h1FontSizeMin = Math.floor(h1FontSize * 0.6); 231 jQuery('h1:not(.logo-h1)').fitText(1, { minFontSize: h1FontSizeMin + 'px', maxFontSize: h1FontSize +'px' }).css('line-height', '120%'); 232 } 233 234 if (h2FontSize) { 235 h2FontSize = h2FontSize.replace("px", ""); 236 var h2FontSizeMin = Math.floor(h2FontSize * 0.6); 237 jQuery('h2:not(.caption-title)').fitText(1, { minFontSize: h2FontSizeMin + 'px', maxFontSize: h2FontSize +'px' }).css('line-height', '120%'); 238 } 239 } else { 240 jQuery('h1:not(.logo-h1)').css('font-size', '').css('line-height', ''); 241 jQuery('h2:not(.caption-title)').css('font-size', '').css('line-height', ''); 242 } 243 }, 244 loveIt: function($this) { 245 var locale = jQuery('#loveit-locale'), 246 post_id = $this.data('post-id'), 247 user_id = $this.data('user-id'), 248 action = 'love_it'; 249 250 if ($this.hasClass('loved')) { 251 action = 'unlove_it'; 252 } 253 if (locale.data('loggedin') == 'false' && jQuery.cookie('loved-' + post_id)) { 254 action = 'unlove_it'; 255 } 256 257 var data = { 258 action: action, 259 item_id: post_id, 260 user_id: user_id, 261 love_it_nonce: locale.data('nonce') 262 }; 263 264 jQuery.post(locale.data('ajaxurl'), data, function(response) { 265 var ajaxResponse = jQuery.trim(response), 266 count_wrap, 267 count; 268 269 if (ajaxResponse == 'loved') { 270 $this.addClass('loved'); 271 count_wrap = $this.find('data.count'); 272 count = count_wrap.text(); 273 count_wrap.text(parseInt(count) + 1); 274 if(locale.data('loggedin') == 'false') { 275 jQuery.cookie('loved-' + post_id, 'yes', { expires: 1 }); 276 } 277 } else if (ajaxResponse == 'unloved') { 278 $this.removeClass('loved'); 279 count_wrap = $this.find('data.count'); 280 count = count_wrap.text(); 281 count_wrap.text(parseInt(count) - 1); 282 if (locale.data('loggedin') == 'false') { 283 jQuery.cookie('loved-' + post_id, 'no', { expires: 1 }); 284 } 285 } else { 286 alert(locale.data('error')); 287 } 288 }); 289 }, 290 expandingAssets: function() { 291 jQuery('.spb-row-expand-text').on('click', '', function(e) { 292 e.preventDefault(); 293 var expand = jQuery(this), 294 expandRow = expand.next(); 295 296 if (expandRow.hasClass('spb-row-expanding-open') && !expandRow.hasClass('spb-row-expanding-active')) { 297 expandRow.addClass('spb-row-expanding-open').addClass('spb-row-expanding-active').slideUp(800); 298 setTimeout(function() { 299 expand.removeClass('row-open').find('span').text(expand.data('closed-text')); 300 expandRow.css('display', 'block').removeClass('spb-row-expanding-open').removeClass('spb-row-expanding-active'); 301 }, 800); 302 } else if (!expandRow.hasClass('spb-row-expanding-active')) { 303 expand.addClass('row-open').find('span').text(expand.data('open-text')); 304 expandRow.css('display', 'none').addClass('spb-row-expanding-open').addClass('spb-row-expanding-active').slideDown(800); 305 setTimeout(function() { 306 expandRow.removeClass('spb-row-expanding-active'); 307 }, 800); 308 } 309 310 }); 311 }, 312 headerSlider: function() { 313 314 // SET LOADING INDICATOR 315 jQuery('#site-loading').css('display', 'block'); 316 317 // SET SLIDER POSITION & HEIGHT 318 jQuery('#container').css('position', 'relative'); 319 jQuery('.home-slider-wrap').css('position', 'fixed'); 320 jQuery('#container').css('top', jQuery('.home-slider-wrap').height()); 321 setTimeout(function() { 322 jQuery('#site-loading').fadeOut(1000); 323 }, 250); 324 325 // RESIZE SLIDER HEIGHT 326 $window.smartresize( function() { 327 jQuery('#container').css('top', jQuery('.home-slider-wrap').height()); 328 }); 329 330 // CONTINUE LINK 331 jQuery('a#slider-continue').on('click', function(e) { 332 333 // Prevent default anchor action 334 e.preventDefault(); 335 336 // Animate scroll to main content 337 jQuery('html, body').stop().animate({ 338 scrollTop: jQuery('#container').css('top') 339 }, 1500, 'easeInOutExpo'); 340 341 }); 342 }, 343 fancyHeading: function() { 344 var fancyHeading = jQuery('.fancy-heading'), 345 fancyHeadingText = fancyHeading.find('.heading-text'), 346 fancyHeadingTextHeight = fancyHeadingText.height(), 347 fancyHeadingHeight = parseInt(fancyHeading.data('height'), 10), 348 header = jQuery('.header-wrap'), 349 headerHeight = 0; 350 351 if (body.hasClass('header-naked-light') || body.hasClass('header-naked-dark')) { 352 headerHeight = header.height(); 353 } 354 355 if (!fancyHeadingHeight) { 356 fancyHeadingHeight = 400; 357 } 358 359 if (fancyHeadingTextHeight > fancyHeadingHeight) { 360 fancyHeadingHeight = fancyHeadingTextHeight + 80; 361 } 362 363 fancyHeadingHeight = fancyHeadingHeight + headerHeight; 364 365 // Vertically center the heading text 366 fancyHeadingText.vCenterTop(); 367 368 // Animate in the heading text and title 369 setTimeout(function() { 370 fancyHeading.css({ 371 'height': fancyHeadingHeight + 'px', 372 'opacity': 1 373 }); 374 }, 400); 375 setTimeout(function() { 376 fancyHeadingText.css('opacity', 1); 377 }, 800); 378 setTimeout(function() { 379 fancyHeading.addClass('animated'); 380 }, 1400); 381 382 // Check if parallax scroll is possible 383 if (parallaxScroll && !isMobileAlt) { 384 $window.scroll(function(){ 385 386 var scrollTop = $window.scrollTop(), 387 headingOffset = 0; 388 389 if (jQuery('.sticky-header').length > 0) { 390 headingOffset = jQuery('.sticky-header').height() > 0 ? jQuery('.sticky-header').height() : jQuery('#header-section').height(); 391 } 392 if (jQuery('#top-bar').length > 0) { 393 headingOffset = headingOffset + jQuery('#top-bar').height(); 394 } 395 if (jQuery('#wpadminbar').length > 0) { 396 headingOffset = headingOffset + 32; 397 } 398 399 scrollTop = scrollTop - headingOffset; 400 401 // Only scroll if the heading is makes sense to do so 402 if (scrollTop < jQuery(document).height() - $window.height()) { 403 404 if (scrollTop < 0) { 405 scrollTop = 0; 406 } 407 408 // Reduce the heading height 409 fancyHeading.stop(true,true).transition({ 410 top: scrollTop / 1.8 411 }, 0); 412 413 // Move & fade the heading content 414 fancyHeadingText.stop(true,true).transition({ 415 opacity: 1 - scrollTop / 420 416 }, 0); 417 } 418 419 }); 420 } 421 }, 422 moveModals: function() { 423 jQuery(".modal").each(function(){ 424 jQuery(this).appendTo("body"); 425 }); 426 }, 427 modalClose: function() {
428 jQuery(".modal-backdrop, .modal .close, .modal .btn").on("click", function() { 429 jQuery(".modal iframe").each(function() { 430 var thisModal = jQuery(this); 431 thisModal.attr("src", thisModal.attr("src")); 432 }); 433 }); 434 }, 435 smoothScrollLinks: function() { 436 jQuery('a.smooth-scroll-link').on('click', function(e) { 437 438 var linkHref = jQuery(this).attr('href'); 439 440 if (linkHref && linkHref.indexOf('#') === 0) { 441 var headerHeight = 0; 442 443 if (jQuery('.sticky-header').length > 0) { 444 headerHeight = jQuery('.sticky-header').height() > 0 ? jQuery('.sticky-header').height() : jQuery('#header-section').height(); 445 } 446 if (jQuery('#wpadminbar').length > 0) { 447 headerHeight = headerHeight + 32; 448 } 449 if (jQuery('.sticky-top-bar').length > 0) { 450 headerHeight = headerHeight + jQuery('.sticky-top-bar').height() > 0 ? jQuery('.sticky-top-bar').height() : jQuery('#top-bar').height(); 451 } 452 453 SWIFT.isScrolling = true; 454 455 jQuery('html, body').stop().animate({ 456 scrollTop: jQuery(linkHref).offset().top - headerHeight 457 }, 1000, 'easeInOutExpo', function() { 458 SWIFT.isScrolling = false; 459 }); 460 461 e.preventDefault(); 462 463 } else { 464 return e; 465 } 466 467 }); 468 }, 469 onePageNav: function() { 470 471 var onePageNav = jQuery('#one-page-nav'), 472 onePageNavType = onePageNav.hasClass('opn-arrows') ? "arrows" : "standard", 473 onePageNavItems = "", 474 pageSectionCount = 0, 475 mainContent = jQuery('.page-content'); 476 477 mainContent.find('section.row').each(function() { 478 var linkID = jQuery(this).attr('id'), 479 linkName = jQuery(this).data('rowname'); 480 481 if (linkID && linkName.length > 0 && jQuery(this).height() > 0) { 482 onePageNavItems += '<li><a href="#'+linkID+'" data-title="'+linkName+'"><i></i></a><div class="hover-caption">'+linkName+'</div></li>'; 483 pageSectionCount++; 484 } 485 }); 486 487 if (pageSectionCount > 0) { 488 onePageNav.append('<ul>'+onePageNavItems+'</ul>'); 489 490 if (onePageNavType === "arrows") { 491 onePageNav.find('ul').css('display', 'none'); 492 onePageNav.append('<a href="#" class="opn-up"><i class="ss-up"></i></a>'); 493 onePageNav.append('<div class="opn-status"><span class="current">1</span>/<span class="total">'+pageSectionCount+'</span></div>'); 494 onePageNav.append('<a href="#" class="opn-down"><i class="ss-down"></i></a>'); 495 } 496 497 onePageNav.vCenter(); 498 setTimeout(function() { 499 500 SWIFT.page.onePageNavScroll(onePageNav); 501 502 onePageNav.css('display', 'block').stop().animate({ 503 'right': '0', 504 'opacity': 1 505 }, 1000, "easeOutQuart"); 506 507 // Nav Dots 508 jQuery('#one-page-nav ul li a').bind('click', function(e) { 509 SWIFT.page.onePageNavGoTo(jQuery(this).attr('href')); 510 e.preventDefault(); 511 }); 512 513 // Up Arrow 514 jQuery('#one-page-nav a.opn-up').bind('click', function(e) { 515 var currentSection = parseInt(jQuery('.opn-status .current').text(), 10), 516 prevSection = currentSection - 1, 517 prevSectionHref = jQuery('#one-page-nav ul li:nth-child('+ prevSection +') > a').attr('href'); 518 519 if (prevSection > 0) { 520 SWIFT.page.onePageNavGoTo(prevSectionHref); 521 } 522 e.preventDefault(); 523 }); 524 525 // Down Arrow 526 jQuery('#one-page-nav a.opn-down').bind('click', function(e) { 527 var currentSection = parseInt(jQuery('.opn-status .current').text(), 10), 528 nextSection = currentSection + 1, 529 nextSectionHref = jQuery('#one-page-nav ul li:nth-child('+ nextSection +') > a').attr('href'); 530 531 if (nextSection <= pageSectionCount) { 532 SWIFT.page.onePageNavGoTo(nextSectionHref); 533 } 534 e.preventDefault(); 535 }); 536 537 // Assign current on init and scroll 538 SWIFT.page.onePageNavScroll(onePageNav); 539 $window.on('scroll', function() { 540 SWIFT.page.onePageNavScroll(onePageNav); 541 }); 542 543 }, 1000); 544 } 545 }, 546 onePageNavGoTo: function(anchor) { 547 548 var adjustment = 0; 549 550 if (jQuery('#wpadminbar').length > 0) { 551 adjustment = jQuery('#wpadminbar').height(); 552 } 553 554 if (body.hasClass('sticky-header-enabled')) { 555 adjustment = jQuery('.sticky-header').outerHeight() > 0 ? adjustment + jQuery('.sticky-header').outerHeight() : adjustment + jQuery('#header-section').outerHeight(); 556 } 557 558 if (jQuery('.sticky-top-bar').length > 0) { 559 adjustment += jQuery('.sticky-top-bar').height() > 0 ? adjustment + jQuery('.sticky-top-bar').height() : adjustment + jQuery('#top-bar').height(); 560 } 561 562 SWIFT.isScrolling = true; 563 564 jQuery('html, body').stop().animate({ 565 scrollTop: jQuery(anchor).offset().top - adjustment + 1 566 }, 1000, 'easeInOutExpo', function() { 567 SWIFT.isScrolling = false;
568 }); 569 }, 570 onePageNavScroll: function(onePageNav) { 571 572 var adjustment = 0; 573 574 if (body.hasClass('sticky-header-enabled')) { 575 adjustment = jQuery('.sticky-header').height() > 0 ? adjustment + jQuery('.sticky-header').height() : adjustment + jQuery('#header-section').height(); 576 } 577 578 if (jQuery('#wpadminbar').length > 0) { 579 adjustment = adjustment + jQuery('#wpadminbar').height(); 580 } 581 582 if (jQuery('.sticky-top-bar').length > 0) { 583 adjustment += jQuery('.sticky-top-bar').height() > 0 ? adjustment + jQuery('.sticky-top-bar').height() : adjustment + jQuery('#top-bar').height(); 584 } 585 586 var currentSection = jQuery('section.row:in-viewport('+adjustment+')').data('rowname'), 587 currentSectionIndex = 0; 588 589 if (!currentSection) { 590 onePageNav.find('li').removeClass('selected'); 591 } 592 593 if (onePageNav.is(':visible') && currentSection) { 594 onePageNav.find('li').removeClass('selected'); 595 onePageNav.find('li a[data-title="'+currentSection+'"]').parent().addClass('selected'); 596 currentSectionIndex = onePageNav.find('li a[data-title="'+currentSection+'"]').parent().index() + 1; 597 } 598 599 if (currentSectionIndex > 0) { 600 jQuery('.opn-status .current').text(currentSectionIndex); 601 } 602 603 if (onePageNav.hasClass('opn-arrows')) { 604 var current = onePageNav.find('.current').text(), 605 total = onePageNav.find('.total').text(); 606 607 if (current === "1") { 608 onePageNav.find('.opn-up').addClass('disabled'); 609 } else { 610 onePageNav.find('.opn-up').removeClass('disabled'); 611 } 612 613 if (current === total) { 614 onePageNav.find('.opn-down').addClass('disabled'); 615 } else { 616 onePageNav.find('.opn-down').removeClass('disabled'); 617 } 618 } 619 }, 620 articleShare: function() { 621 jQuery('.article-share').each(function() { 622 var articleShare = jQuery(this), 623 image = articleShare.data('image'), 624 permalink = window.location.href, 625 title = encodeURIComponent(jQuery(document).find("title").text()), 626 links = ''; 627 628 links += '<li class="pinterest enabled" data-network="pinterest"><a href="http://pinterest.com/pin/create/button/?url=' + permalink + '&media=' + image + '&description=' + title + '" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=690,width=750\');return false;"></a></li>'; 629 links += '<li class="twitter enabled" data-network="twitter"><a href="http://twitter.com/share?text=' + title + '&url=' + permalink + '" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=440,width=660\');return false;"></a></li>'; 630 links += '<li class="facebook enabled" data-network="facebook"><a href="https://www.facebook.com/sharer/sharer.php?u=' + permalink + '" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=440,width=660\');return false;"></a></li>'; 631 if ( isMobile ) { 632 links += '<li class="whatsapp enabled" data-network="whatsapp"><a href="whatsapp://send?text=' + title + ' ' + permalink + '"></a></li>'; 633 } 634 links += '<li class="googlePlus enabled" data-network="googlePlus"><a href="https://plus.google.com/share?url=' + permalink + '" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=440,width=660\');return false;"></a></li>'; 635 //links += '<li class="reddit enabled" data-network="reddit"><a onclick="return false"></a></li>'; 636 links += '<li class="linkedin enabled" data-network="linkedin"><a href="https://www.linkedin.com/shareArticle?mini=true&url=' + permalink + '&title=' + title + '" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=690,width=750\');return false;"></a></li>'; 637 links += '<li class="email enabled" data-network="email"><a href="mailto:?subject=left%20sidebar%20test%20-%20Cardinal&body=' + permalink + '"></a></li>'; 638 639 articleShare.find('share-button').append('<span>' + articleShare.data('buttontext') + '</span>'); 640 articleShare.find('share-button').append('<div class="sb-social sb-top sb-center"><ul>' + links + '</ul></div>'); 641 642 articleShare.find('share-button').on('click', function() { 643 jQuery(this).find('.sb-social').toggleClass('active'); 644 }); 645 }); 646 }, 647 articleNavigation: function() { 648 var postPagination = jQuery('.post-pagination-wrap'), 649 postNext = postPagination.find('.next-article > h2 > a').attr('href'), 650 postPrev = postPagination.find('.prev-article > h2 > a').attr('href'); 651 652 jQuery('article.type-post').hammer().on("swipeleft", function(event) { 653 if (postPrev) { 654 window.location = postPrev; 655 } 656 }); 657 658 jQuery('article.type-post').hammer().on("swiperight", function(event) { 659 if (postNext) { 660 window.location = postNext; 661 } 662 }); 663 664 }, 665 postMediaTitle: function() { 666 var detailsOverlay = jQuery('.details-overlay'), 667 detailFeature = jQuery('.detail-feature'), 668 featureHeight = detailsOverlay.height() + 80; 669 670 if (body.hasClass('header-naked-light') || body.hasClass('header-naked-dark')) { 671 detailFeature.css('padding-top', jQuery('.header-wrap').height() * 2); 672 } 673 674 detailFeature.css('height', featureHeight); 675 setTimeout(function() { 676 jQuery('.details-overlay').vCenter().stop().animate({ 677 'bottom': '50%', 678 'opacity': 1 679 }, 1500, "easeOutExpo"); 680 }, 500); 681 682 $window.smartresize( function() { 683 detailFeature.css('height', detailsOverlay.height() + 80); 684 jQuery('.details-overlay').vCenter(); 685 }); 686 687 }, 688 lightbox: function() { 689 690 // Lightbox Social 691 var lightboxSocial = {};
692 if (lightboxSharing) { 693 lightboxSocial = { 694 facebook: { 695 source: 'https://www.facebook.com/sharer/sharer.php?u={URL}', 696 text: 'Share on Facebook' 697 }, 698 twitter: true, 699 googleplus: true, 700 pinterest: { 701 source: "https://pinterest.com/pin/create/bookmarklet/?url={URL}", 702 text: "Share on Pinterest" 703 } 704 }; 705 } 706 707 // Lightbox Galleries 708 var galleryArr = []; 709 jQuery('[data-rel^="ilightbox["]').each(function () { 710 var attr = this.getAttribute("data-rel"); 711 if (jQuery.inArray(attr, galleryArr) == -1 ) { 712 galleryArr.push(attr); 713 } 714 }); 715 jQuery.each(galleryArr, function (b, c) { 716 jQuery('[data-rel="' + c + '"]').iLightBox({ 717 skin: lightboxSkin, 718 social: { 719 buttons: lightboxSocial 720 }, 721 path: 'horizontal', 722 thumbnails: { 723 maxWidth: 120, 724 maxHeight: 120 725 }, 726 controls: { 727 arrows: lightboxControlArrows, 728 thumbnail: lightboxThumbs 729 } 730 }); 731 }); 732 }, 733 backToTop: function() { 734 var scrollPosition = $window.scrollTop(); 735 736 if (scrollPosition > 300) { 737 jQuery('#back-to-top').stop().animate({ 738 'bottom': '10px', 739 'opacity': 1 740 }, 300, "easeOutQuart"); 741 } else if (scrollPosition < 300) { 742 jQuery('#back-to-top').stop().animate({ 743 'bottom': '-60px', 744 'opacity': 0 745 }, 300, "easeInQuart"); 746 } 747 }, 748 fwMediaNextPrevAdjust: function() { 749 750 var navTop = 0; 751 752 if (body.hasClass('single-portfolio')) { 753 navTop = jQuery('article.portfolio').offset().top + jQuery('figure.fw-media-wrap').height() + 80; 754 } else if (body.hasClass('single-post')) { 755 if (jQuery('.detail-feature').length > 0) { 756 navTop = jQuery('article.post').offset().top + jQuery('.detail-feature').height() + 80; 757 } else { 758 navTop = jQuery('article.post').offset().top + jQuery('figure.fw-media-wrap').height() + 80; 759 } 760 } 761 762 jQuery('#prev-article-pagination').addClass('has-fw-media').css('top', navTop); 763 jQuery('#next-article-pagination').addClass('has-fw-media').css('top', navTop); 764 }, 765 fsNextPrev: function() { 766 var scrollPosition = $window.scrollTop(), 767 absTop = 0, 768 showArrowX = body.hasClass('single-product') ? 60 : 100; 769 770 if ((body.hasClass('single-portfolio') && jQuery('article.portfolio').hasClass('single-portfolio-fw-media')) || (body.hasClass('single-post') && (jQuery('article.type-post').hasClass('single-post-fw-media-title') || jQuery('article.type-post').hasClass('single-post-fw-media') ))) { 771 772 if (body.hasClass('single-portfolio')) { 773 absTop = jQuery('article.portfolio').offset().top + jQuery('figure.fw-media-wrap').height() + 200; 774 } else if (body.hasClass('single-post')) { 775 if (jQuery('.detail-feature').length > 0) { 776 absTop = jQuery('article.post').offset().top + jQuery('.detail-feature').height() + 200; 777 } else { 778 absTop = jQuery('article.post').offset().top + jQuery('figure.fw-media-wrap').height() + 200; 779 } 780 } 781 782 if ((scrollPosition + $window.height() / 2) > absTop) { 783 jQuery('#prev-article-pagination').addClass('fs-nav-fixed'); 784 jQuery('#next-article-pagination').addClass('fs-nav-fixed'); 785 } else if (scrollPosition < absTop) { 786 jQuery('#prev-article-pagination').removeClass('fs-nav-fixed'); 787 jQuery('#next-article-pagination').removeClass('fs-nav-fixed'); 788 } 789 } else { 790 if (scrollPosition > showArrowX) { 791 jQuery('#prev-article-pagination').stop().animate({ 792 'left': '0', 793 'opacity': 1 794 }, 300, "easeOutQuart"); 795 jQuery('#next-article-pagination').stop().animate({ 796 'right': '0', 797 'opacity': 1 798 }, 300, "easeOutQuart"); 799 } else if (scrollPosition < showArrowX) { 800 jQuery('#prev-article-pagination').stop().animate({ 801 'left': '-80px', 802 'opacity': 1 803 }, 300, "easeOutQuart"); 804 jQuery('#next-article-pagination').stop().animate({ 805 'right': '-80px', 806 'opacity': 1 807 }, 300, "easeOutQuart"); 808 } 809 } 810 }, 811 stickySidebars: function() { 812 813 var topMargin = 10; 814 815 if (jQuery('.sticky-header').length > 0) { 816 topMargin += jQuery('.sticky-header').height(); 817 } 818 819 if (jQuery('#breadcrumbs').length > 0) { 820 topMargin += jQuery('#breadcrumbs').height(); 821 } 822 823 jQuery('.sidebar > .sidebar-widget-wrap').stickySidebar({ 824 headerSelector: '.header-wrap', 825 navSelector: '.page-heading', 826 contentSelector: '.hentry', 827 footerSelector: '#footer-wrap', 828 sidebarTopMargin: topMargin, 829 footerThreshold: 160, 830 }); 831 832 SWIFT.page.stickySidebarsResize(); 833 $window.smartresize( function() { 834 SWIFT.page.stickySidebarsResize(); 835 }); 836 }, 837 stickySidebarsResize: function() { 838 jQuery('.sidebar-widget-wrap').each(function() { 839 var sidebar = jQuery(this); 840 sidebar.css('width', sidebar.parent().width()); 841 }); 842 },
843 getViewportHeight: function() { 844 var height = "innerHeight" in window ? window.innerHeight: document.documentElement.offsetHeight; 845 return height; 846 }, 847 checkIE: function() { 848 var undef, 849 v = 3, 850 div = document.createElement('div'), 851 all = div.getElementsByTagName('i'); 852 853 while ( 854 div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', 855 all[0] 856 ); 857 858 return v > 4 ? v : undef; 859 }, 860 pageTransitions: function() { 861 jQuery('a').on('click', function(e) { 862 var linkElement = jQuery(this), 863 link = linkElement.attr('href'), 864 linkTarget = linkElement.attr('target'); 865 866 if (linkTarget === '_blank' || link.indexOf('?') >= 0 || link.indexOf('#') >= 0 || link.indexOf('.jpg') >= 0 || link.indexOf('.png') >= 0 || link.indexOf('mailto') >= 0 || e.ctrlKey || e.metaKey || link.indexOf('javascript') === 0 ) { 867 return e; 868 } else { 869 if (body.hasClass('mobile-menu-open')) { 870 return; 871 } else { 872 SWIFT.page.fadePageOut(link); 873 e.preventDefault(); 874 } 875 } 876 }); 877 }, 878 fadePageIn: function() { 879 var preloadTime = 400; 880 881 if (jQuery('.parallax-window-height').length > 0) { 882 preloadTime = 800; 883 } 884 885 body.addClass('page-fading-in'); 886 jQuery('#site-loading').animate({ 887 'opacity': 0, 888 }, preloadTime, 'easeInExpo', function() { 889 jQuery(this).css('display', 'none'); 890 }); 891 setTimeout(function() { 892 body.removeClass('page-fading-in'); 893 }, 500); 894 }, 895 fadePageOut: function(link) { 896 jQuery('#site-loading').css('display', 'block').animate({ 897 'opacity': 1, 898 }, 400, 'easeInExpo'); 899 jQuery('#main-container').animate({ 900 'opacity': 0, 901 }, 500, 'easeInExpo', function() { 902 window.location = link; 903 }); 904 }, 905 mobileThumbLinkClick: function() { 906 jQuery(document).on('click', '.animated-overlay > a', function(e) { 907 var thisLink = jQuery(this); 908 909 if (thisLink.hasClass('hovered')) { 910 return e; 911 } else { 912 e.preventDefault(); 913 thisLink.addClass('hovered'); 914 } 915 }); 916 }, 917 directorySubmit: function() { 918 jQuery(document).on('click', '#sf_directory_calculate_coordinates', function(e) { 919 e.preventDefault(); 920 var geocoder = new google.maps.Geocoder(); 921 geocoder.geocode( { 'address': jQuery('#sf_directory_address').val()}, function(results, status) { 922 jQuery('#sf_directory_lat_coord').val(results[0].geometry.location.lat()); 923 jQuery('#sf_directory_lng_coord').val(results[0].geometry.location.lng()); 924 }); 925 926 }); 927 928 jQuery('#directory-submit').click(function(e) { 929 930 if (jQuery('#sf_directory_address').val() === '' || jQuery('#sf_directory_lat_coord').val() === '' || jQuery('sf_directory_lng_coord').val() === '' || jQuery('#directory_title').val() === '' || jQuery('#directory_description').val() === '' || jQuery('#directory-cat').val() <= 0 || jQuery('#directory-loc').val() <= 0) { 931 e.preventDefault(); 932 jQuery('.directory-error').show(); 933 jQuery('html, body').animate({ scrollTop: jQuery('.directory-error').offset().top-100}, 700); 934 return false; 935 } 936 jQuery('#add-directory-entry').submit(); 937 }); 938 } 939 }; 940 941 942 ///////////////////////////////////////////// 943 // SUPER SEARCH 944 ///////////////////////////////////////////// 945 946 SWIFT.superSearch = { 947 init: function() { 948 949 jQuery('.search-options .ss-dropdown').on('click', function(e) { 950 e.preventDefault(); 951 952 var option = jQuery(this), 953 dropdown = option.find( 'ul' ); 954 955 jQuery('.ss-dropdown ul').removeClass('show-dropdown'); 956 957 if (isMobileAlt) { 958 if (dropdown.hasClass('show-dropdown')) { 959 dropdown.removeClass('show-dropdown'); 960 } else { 961 dropdown.addClass('show-dropdown'); 962 } 963 } else { 964 if (dropdown.hasClass('show-dropdown')) { 965 dropdown.css('top', 30).removeClass('show-dropdown'); 966 } else { 967 dropdown.css('top', -10).addClass('show-dropdown'); 968 } 969 } 970 }); 971 972 jQuery('.ss-option').on('click', function(e) { 973 e.preventDefault(); 974 975 var thisOption = jQuery(this), 976 selectedOption = thisOption.attr('data-attr_value'), 977 parentOption = thisOption.parent().parent().parent(); 978 979 parentOption.find('li').removeClass('selected'); 980 thisOption.parent().addClass('selected'); 981 982 parentOption.attr('data-attr_value', selectedOption); 983 parentOption.find('span').text(thisOption.text()); 984 985 setTimeout(function() { 986 thisOption.parents('ul').first().css('top', 30).removeClass('show-dropdown'); 987 }, 100); 988 }); 989 990 jQuery('.super-search-go').on('click', function(e) { 991 e.preventDefault(); 992 var parentSearch = jQuery(this).parents('.sf-super-search'), 993 filterURL = SWIFT.superSearch.urlBuilder(parentSearch), 994 homeURL = jQuery(this).attr('data-home_url'), 995 shopURL = jQuery(this).attr('data-shop_url'); 996 997 if (filterURL.indexOf("product_cat") >= 0) { 998 location.href = homeURL + filterURL; 999 } else { 1000 location.href = shopURL + filterURL; 1001 } 1002 1003 }); 1004 }, 1005 urlBuilder: function(searchInstance) { 1006 1007 var queryString = ""; 1008 1009 jQuery(searchInstance).find('.search-options .ss-dropdown').each(function() { 1010 1011 var attr = jQuery(this).attr('id'); 1012 var attrValue = jQuery(this).attr('data-attr_value'); 1013 if (attrValue !== "") { 1014 if (attr === "product_cat") { 1015 if (queryString === "") { 1016 queryString += "?product_cat=" + attrValue; 1017 } else { 1018 queryString += "&product_cat=" + attrValue; 1019 } 1020 } else { 1021 if (queryString === "") { 1022 queryString += "?filter_" + attr + "=" + attrValue; 1023 } else { 1024 queryString += "&filter_" + attr + "=" + attrValue; 1025 } 1026 } 1027 } 1028 }); 1029 1030 jQuery('.search-options input').each(function() { 1031 var attr = jQuery(this).attr('name'); 1032 var attrValue = jQuery(this).attr('value'); 1033 if (queryString === "") { 1034 queryString += "?"+ attr + "=" + attrValue; 1035 } else { 1036 queryString += "&" + attr + "=" + attrValue; 1037 } 1038 }); 1039 1040 return queryString; 1041 } 1042 }; 1043 1044 1045 ///////////////////////////////////////////// 1046 // HEADER 1047 ///////////////////////////////////////////// 1048 1049 SWIFT.header = { 1050 init: function() { 1051 1052 // INIT VARIABLES 1053 var lastAjaxSearchValue = "", 1054 searchTimer = false;
1055 1056 1057 // STICKY HEADER 1058 if (body.hasClass('sticky-header-enabled') && !body.hasClass('vertical-header')) { 1059 SWIFT.header.stickyHeaderInit(); 1060 } 1061 1062 // STICKY TOP BAR 1063 if ( jQuery('.sticky-top-bar').length > 0 ) { 1064 SWIFT.header.stickyTopBarInit(); 1065 } 1066 1067 // FULLSCREEN SEARCH 1068 if (jQuery('#fullscreen-search').length > 0) { 1069 SWIFT.header.fsSearch(); 1070 } 1071 1072 jQuery('a.fs-header-search-link,a.fs-overlay-close').on('click', function(e) { 1073 e.preventDefault(); 1074 1075 if (body.hasClass('overlay-menu-open')) { 1076 SWIFT.header.overlayMenuToggle(); 1077 } 1078 if (body.hasClass('fs-supersearch-open')) { 1079 SWIFT.header.fsSuperSearchToggle(); 1080 } 1081 1082 SWIFT.header.fsSearchToggle(); 1083 }); 1084 1085 1086 // FULLSCREEN SUPERSEARCH 1087 jQuery('a.fs-supersearch-link').on('click', function(e) { 1088 e.preventDefault(); 1089 1090 if (body.hasClass('overlay-menu-open')) { 1091 SWIFT.header.overlayMenuToggle(); 1092 } 1093 if (body.hasClass('fs-search-open')) { 1094 SWIFT.header.fsSearchToggle(); 1095 } 1096 1097 SWIFT.header.fsSuperSearchToggle(); 1098 }); 1099 1100 1101 // OVERLAY MENU 1102 jQuery('a.overlay-menu-link').on('click', function(e) { 1103 e.preventDefault(); 1104 SWIFT.header.overlayMenuToggle(); 1105 1106 if (body.hasClass('fs-search-open')) { 1107 SWIFT.header.fsSearchToggle(); 1108 } 1109 if (body.hasClass('fs-supersearch-open')) { 1110 SWIFT.header.fsSuperSearchToggle(); 1111 } 1112 }); 1113 1114 jQuery('#overlay-menu li.menu-item a').on('click', function() { 1115 SWIFT.header.overlayMenuToggle(); 1116 }); 1117 1118 1119 // AJAX SEARCH 1120 jQuery('.header-search-link-alt').on('click', function(e) { 1121 e.preventDefault(); 1122 1123 var ajaxSearchWrap = jQuery('.ajax-search-wrap'); 1124 1125 if (ajaxSearchWrap.is(':visible')) { 1126 ajaxSearchWrap.fadeOut(300); 1127 setTimeout(function() { 1128 jQuery('.ajax-search-results').slideUp(100).empty(); 1129 jQuery('.ajax-search-form input[name=s]').val(''); 1130 }, 300); 1131 } else { 1132 ajaxSearchWrap.fadeIn(300); 1133 setTimeout(function() { 1134 jQuery('.ajax-search-form input[name=s]').focus(); 1135 jQuery("#container").bind("click", function(e) { 1136 var ajaxSearchWrap = jQuery('.ajax-search-wrap'); 1137 if (!jQuery(e.target).closest('.ajax-search-wrap').length) { 1138 ajaxSearchWrap.fadeOut(300); 1139 setTimeout(function() { 1140 jQuery('.ajax-search-results').slideUp(100).empty(); 1141 jQuery('.ajax-search-form input[name=s]').val(''); 1142 }, 300); 1143 jQuery("#container").unbind("click"); 1144 } 1145 }); 1146 }, 300); 1147 } 1148 1149 }); 1150 1151 1152 // AJAX SEARCH INPUT FUNCTION 1153 jQuery('.ajax-search-form input[name=s],#fs-search-input').on('keyup', function(e) { 1154 var searchvalue = e.currentTarget.value, 1155 homeURL = jQuery('.ajax-search-form').attr('action'); 1156 1157 clearTimeout(searchTimer); 1158 if (lastAjaxSearchValue != jQuery.trim(searchvalue) && searchvalue.length >= 3) { 1159 searchTimer = setTimeout( function() { 1160 if (jQuery('#fullscreen-search').length > 0 && history.pushState) { 1161 jQuery('#fullscreen-search').find('.search-wrap').animate({ 1162 'margin-top': '10%' 1163 }, 200); 1164 var urlWithSearchParam = homeURL + '?s=' + searchvalue; 1165 window.history.pushState({path:urlWithSearchParam}, '', urlWithSearchParam); 1166 } 1167 SWIFT.header.ajaxSearch(e); 1168 }, 400); 1169 } 1170 }); 1171 1172 1173 // CONTACT SLIDEOUT 1174 jQuery('a.contact-menu-link').on('click', function(e) { 1175 e.preventDefault(); 1176 var headerTop = jQuery('.header-wrap').scrollTop(); 1177 if (headerTop !== 0) { 1178 jQuery('body,html').animate({scrollTop: headerTop}, 600, 'easeOutCubic'); 1179 setTimeout(function() { 1180 jQuery('#contact-slideout').slideToggle(800, 'easeInOutExpo'); 1181 if (jQuery(this).hasClass('slide-open')) { 1182 jQuery(this).removeClass('slide-open'); 1183 } else { 1184 SWIFT.map.init(); 1185 jQuery(this).addClass('slide-open'); 1186 } 1187 }, 800); 1188 } else { 1189 jQuery('#contact-slideout').slideToggle(800, 'easeInOutExpo'); 1190 if (jQuery(this).hasClass('slide-open')) { 1191 jQuery(this).removeClass('slide-open'); 1192 } else { 1193 SWIFT.map.init(); 1194 jQuery(this).addClass('slide-open'); 1195 } 1196 } 1197 }); 1198 1199 // Mobile Sticky Header 1200 if (body.hasClass('mh-sticky')) { 1201 SWIFT.header.mobileStickyHeader(); 1202 } 1203 1204 // VERTICAL HEADER RIGHT POSITIONING 1205 if (body.hasClass('layout-boxed') && body.hasClass('vertical-header-right')) { 1206 1207 var rightOffset = ($window.width() - jQuery('#container').width()) / 2; 1208 jQuery('.header-wrap').css('right', rightOffset); 1209 1210 $window.smartresize( function() { 1211 var rightOffset = ($window.width() - jQuery('#container').width()) / 2; 1212 jQuery('.header-wrap').css('right', rightOffset); 1213 }); 1214 } 1215 }, 1216 mobileStickyHeader: function() { 1217 // MOBILE STICKY HEADER 1218 var mobileHeader = jQuery('#mobile-header'); 1219 1220 mobileHeader.sticky({ 1221 topSpacing: 0 1222 }); 1223 1224 jQuery('#mobile-header-sticky-wrapper').css('height', mobileHeader.outerHeight(true)); 1225 1226 $window.smartresize( function() { 1227 mobileHeader.sticky('update'); 1228 jQuery('#mobile-header-sticky-wrapper').css('height', mobileHeader.outerHeight(true)); 1229 }); 1230 }, 1231 stickyHeaderInit: function() { 1232 var spacing = 0, 1233 stickyHeader = jQuery('.sticky-header'), 1234 headerWrap = jQuery('.header-wrap'); 1235 1236 if (jQuery('#wpadminbar').length > 0) { 1237 spacing = 32; 1238 } 1239 1240 if ( jQuery('.sticky-top-bar').length > 0 ) { 1241 spacing += jQuery('.sticky-top-bar').outerHeight(); 1242 } 1243 1244 stickyHeader.sticky({ 1245 topSpacing: spacing 1246 }); 1247 1248 $window.smartresize( function() { 1249 stickyHeader.sticky('update'); 1250 }); 1251 1252 if (body.hasClass('layout-boxed')) { 1253 jQuery('.sticky-header').css('max-width', headerWrap.width()); 1254 $window.smartresize( function() { 1255 jQuery('.sticky-header').css('max-width', headerWrap.width()); 1256 }); 1257 } 1258 1259 // Sticky Header Resizing 1260 if (body.hasClass('sh-dynamic')) { 1261 var defaultHeaderPos = headerWrap.offset().top; 1262 $window.scroll(function () { 1263 defaultHeaderPos = headerWrap.offset().top - $window.scrollTop(); 1264 if (jQuery('.sticky-wrapper').hasClass('is-sticky') && defaultHeaderPos < -160) { 1265 headerWrap.addClass('resized-header'); 1266 } else if (headerWrap.hasClass('resized-header')) { 1267 headerWrap.removeClass('resized-header'); 1268 } 1269 1270 }); 1271 } 1272 }, 1273 stickyTopBarInit: function() { 1274 var spacing = 0, 1275 stickyTB = jQuery('.sticky-top-bar'), 1276 headerWrap = jQuery('.header-wrap'); 1277 1278 if (jQuery('#wpadminbar').length > 0) { 1279 spacing = 32; 1280 } 1281 1282 stickyTB.sticky({ 1283 topSpacing: spacing 1284 }); 1285 1286 $window.smartresize( function() { 1287 stickyTB.sticky('update'); 1288 }); 1289 1290 if (body.hasClass('layout-boxed')) { 1291 stickyTB.css('max-width', headerWrap.width()); 1292 $window.smartresize( function() { 1293 stickyTB.css('max-width', headerWrap.width()); 1294 }); 1295 } 1296 }, 1297 ajaxSearch: function(e) { 1298 var searchInput = jQuery(e.currentTarget), 1299 searchValues = searchInput.parents('form').serialize() + '&action=sf_ajaxsearch', 1300 results = jQuery('.ajax-search-results'), 1301 loadingIndicator = jQuery('.search-wrap .ajax-loading'), 1302 ajaxurl = jQuery('.search-wrap').data('ajaxurl'); 1303 1304 jQuery.ajax({ 1305 url: ajaxurl, 1306 type: "POST", 1307 data: searchValues, 1308 beforeSend: function() {
1309 jQuery('.ajax-search-results').slideUp(200); 1310 setTimeout(function() { 1311 loadingIndicator.fadeIn(50); 1312 }, 150); 1313 }, 1314 success: function(response) { 1315 if (response === 0) { 1316 response = ""; 1317 } else { 1318 results.html(response); 1319 } 1320 }, 1321 complete: function() { 1322 loadingIndicator.fadeOut(200); 1323 setTimeout(function() { 1324 results.slideDown(400); 1325 if (jQuery('#fullscreen-search').length > 0) { 1326 results.find('.search-result').each(function(i) { 1327 var result = jQuery(this); 1328 setTimeout(function() { 1329 result.addClass('load-in'); 1330 }, 200*i); 1331 }); 1332 } 1333 }, 200); 1334 } 1335 }); 1336 }, 1337 fsSearch: function() { 1338 var fsSearch = jQuery('#fullscreen-search'), 1339 searchInput = fsSearch.find('#fs-search-input'); 1340 1341 searchInput.autoGrowInput(); 1342 }, 1343 fsSearchToggle: function() { 1344 var fsSearch = jQuery('#fullscreen-search'), 1345 searchInput = fsSearch.find('#fs-search-input'); 1346 1347 if (body.hasClass('fs-search-open')) { 1348 body.removeClass('fs-aux-open'); 1349 body.removeClass('fs-search-open'); 1350 body.addClass('fs-search-closing'); 1351 setTimeout(function() { 1352 if (!body.hasClass('overlay-menu-open')) { 1353 jQuery('#main-nav,#main-navigation').fadeIn(400); 1354 } 1355 }, 200); 1356 } else { 1357 setTimeout(function() { 1358 body.removeClass('fs-search-closing'); 1359 body.addClass('fs-search-open'); 1360 body.addClass('fs-aux-open'); 1361 searchInput.focus(); 1362 jQuery('#main-nav,#main-navigation').fadeOut(300); 1363 }, 30); 1364 } 1365 }, 1366 fsSuperSearchToggle: function() { 1367 var fsSuperSearch = jQuery('#fullscreen-supersearch'); 1368 1369 if (body.hasClass('fs-supersearch-open')) { 1370 body.removeClass('fs-supersearch-open'); 1371 body.removeClass('fs-aux-open'); 1372 body.addClass('fs-supersearch-closing'); 1373 setTimeout(function() { 1374 jQuery('#main-nav,#main-navigation').fadeIn(400); 1375 }, 200); 1376 } else { 1377 setTimeout(function() { 1378 body.removeClass('fs-supersearch-closing'); 1379 body.addClass('fs-supersearch-open'); 1380 body.addClass('fs-aux-open'); 1381 jQuery('#main-nav,#main-navigation').fadeOut(300); 1382 }, 30); 1383 } 1384 }, 1385 overlayMenuToggle: function() { 1386 var overlayMenu = jQuery('#overlay-menu'), 1387 overlayMenuItemHeight = Math.floor(overlayMenu.find('nav ul').height() / overlayMenu.find('ul.menu > li').length) - 5, 1388 overlayMenuItemFS = Math.floor(overlayMenuItemHeight * 0.5); 1389 1390 if (overlayMenuItemFS > 60) { 1391 overlayMenuItemFS = 60; 1392 } 1393 1394 overlayMenu.find('li').css('height', overlayMenuItemHeight + 'px').css('font-size', overlayMenuItemFS + 'px').css('line-height', overlayMenuItemHeight - 20 + 'px'); 1395 1396 if (body.hasClass('overlay-menu-open')) { 1397 body.removeClass('overlay-menu-open'); 1398 body.removeClass('fs-aux-open'); 1399 body.addClass('overlay-menu-closing'); 1400 setTimeout(function() { 1401 if (!body.hasClass('fs-search-open')) { 1402 jQuery('#main-nav,#main-navigation').fadeIn(400); 1403 } 1404 body.removeClass('overlay-menu-closing'); 1405 }, 200); 1406 } else { 1407 setTimeout(function() { 1408 body.removeClass('overlay-menu-closing'); 1409 body.addClass('overlay-menu-open'); 1410 body.addClass('fs-aux-open'); 1411 jQuery('#main-nav,#main-navigation').fadeOut(300); 1412 }, 30); 1413 } 1414 } 1415 }; 1416 1417 1418 ///////////////////////////////////////////// 1419 // NAVIGATION 1420 ///////////////////////////////////////////// 1421 1422 SWIFT.nav = { 1423 init: function() { 1424 1425 // Set up Mega Menu 1426 if (!isMobile || $window.width() > 768) { 1427 SWIFT.nav.mainMenu(); 1428 } 1429 1430 // Set up Mobile Menu 1431 SWIFT.nav.mobileMenuInit(); 1432 1433 // Add main menu actions 1434 SWIFT.nav.mainMenuActions(); 1435 1436 }, 1437 mainMenu: function() { 1438 1439 jQuery("#main-navigation").find(".menu li.menu-item").hoverIntent({ 1440 over: function() { 1441 if (jQuery('#container').width() > 767 || body.hasClass('responsive-fixed')) { 1442 jQuery(this).find('ul.sub-menu,.mega-menu-sub').first().fadeIn(200); 1443 } 1444 }, 1445 out:function() { 1446 if (jQuery('#container').width() > 767 || body.hasClass('responsive-fixed')) { 1447 jQuery(this).find('ul.sub-menu,.mega-menu-sub').first().fadeOut(150); 1448 } 1449 }, 1450 timeout: 0 1451 }); 1452 1453 // Set sub-menu position based on menu height 1454 var mainNav = jQuery('#main-navigation'), 1455 mainNavHeight = mainNav.height(), 1456 subMenu = mainNav.find('.sub-menu'); 1457 1458 subMenu.each(function() { 1459 jQuery(this).css('top', mainNavHeight); 1460 }); 1461 }, 1462 mainMenuActions: function() { 1463 // Add parent class to items with sub-menus 1464 jQuery("ul.sub-menu").parents('li').addClass('parent'); 1465 1466 // Menu parent click function 1467 jQuery('.menu li.parent > a').on('click', function(e) { 1468 1469 if (jQuery('#container').width() < 1024 || body.hasClass('standard-browser')) { 1470 return e; 1471 } 1472 1473 var directDropdown = jQuery(this).parent().find('ul.sub-menu').first(); 1474 1475 if (directDropdown.css('opacity') === '1' || directDropdown.css('opacity') === 1) { 1476 return e; 1477 } else { 1478 e.preventDefault(); 1479 } 1480 }); 1481 1482 // Set Standard Sub Menu Top Position 1483 jQuery("nav.std-menu").find(".menu li").each(function() { 1484 var top = jQuery(this).outerHeight(); 1485 jQuery(this).find('ul.sub-menu').first().css('top', top); 1486 }); 1487 1488 // Enable hover dropdowns for window size above tablet width 1489 jQuery("nav.std-menu").find(".menu li.parent").hoverIntent({ 1490 over: function() { 1491 if (jQuery('#container').width() > 767 || body.hasClass('responsive-fixed')) { 1492 jQuery(this).find('ul.sub-menu').first().stop( true, true ).fadeIn(200); 1493 } 1494 }, 1495 out:function() { 1496 if (jQuery('#container').width() > 767 || body.hasClass('responsive-fixed')) { 1497 jQuery(this).find('.sub-menu').first().stop( true, true ).fadeOut(150); 1498 } 1499 }, 1500 timeout: 100 1501 }); 1502 1503 1504 // Shopping bag hover function 1505 jQuery(document).on("mouseenter", "li.shopping-bag-item", function() { 1506 if (jQuery('#container').width() > 767 || body.hasClass('responsive-fixed')) { 1507 jQuery(this).find('ul.sub-menu').first().stop( true, true ).fadeIn(200); 1508 } 1509 }).on("mouseleave", "li.shopping-bag-item", function() { 1510 if (jQuery('#container').width() > 767 || body.hasClass('responsive-fixed')) { 1511 jQuery(this).find('ul.sub-menu').first().stop( true, true ).fadeOut(150); 1512 } 1513 }); 1514 1515 1516 // Menu item click function 1517 jQuery('.menu-item').on('click', 'a', function(e) { 1518 1519 var menuItem = jQuery(this), 1520 linkHref = menuItem.attr('href'), 1521 isMobileMenuItem = false, 1522 youtubeURL = linkHref.match(/watch\?v=([a-zA-Z0-9\-_]+)/), 1523 vimeoURL = linkHref.match(/^http:\/\/(www\.)?vimeo\.com\/(clip\:)?(\d+).*$/); 1524 1525 1526 if (jQuery(this).parents('nav').attr('id') === "mobile-menu") { 1527 isMobileMenuItem = true; 1528 } 1529 1530 // Link to full width video overlay if link is YouTube/Vimeo 1531 if (youtubeURL || vimeoURL) { 1532 1533 var videoURL = ""; 1534 1535 if (youtubeURL) { 1536 videoURL = 'http://www.youtube.com/embed/'+ youtubeURL[1] +'?autoplay=1&wmode=transparent'; 1537 } else if (vimeoURL) { 1538 videoURL = 'https://player.vimeo.com/video/'+ vimeoURL[3] +'?title=0&byline=0&portrait=0&autoplay=1&wmode=transparent'; 1539 } 1540 1541 if (videoURL !== "") { 1542 jQuery(this).data('video', videoURL); 1543 SWIFT.widgets.openFullWidthVideo(jQuery(this)); 1544 } 1545 e.preventDefault(); 1546 // Smooth Scroll 1547 } else if (linkHref.indexOf('#') === 0 && linkHref.length > 1) { 1548 var headerHeight = 0; 1549 1550 if (isMobileMenuItem) { 1551 SWIFT.nav.mobileMenuHideTrigger(); 1552 setTimeout(function() { 1553 if (body.hasClass('mh-sticky')) { 1554 headerHeight = jQuery('#mobile-header').height(); 1555 } 1556 if (jQuery('#mobile-top-text-sticky-wrapper').length > 0 ) { 1557 headerHeight += jQuery('#mobile-top-text-sticky-wrapper').height(); 1558 } 1559 if (jQuery('#wpadminbar').length > 0) { 1560 headerHeight += jQuery('#wpadminbar').height(); 1561 } 1562 if ( jQuery('.sticky-top-bar').length > 0 ) { 1563 headerHeight += jQuery('.sticky-top-bar').outerHeight(); 1564 } 1565 1566 if (jQuery(linkHref).length > 0) { 1567 jQuery('html, body').stop().animate({ 1568 scrollTop: jQuery(linkHref).offset().top - headerHeight + 2 1569 }, 1000, 'easeInOutExpo'); 1570 } 1571 }, 400); 1572 } else { 1573 if (jQuery(linkHref).length > 0) { 1574 SWIFT.isScrolling = true; 1575 SWIFT.page.onePageNavGoTo(linkHref); 1576 setTimeout(function() { 1577 SWIFT.isScrolling = false;
1578 }, 1000); 1579 } 1580 } 1581 e.preventDefault(); 1582 } else { 1583 if (isMobileMenuItem) { 1584 return; 1585 } else { 1586 return e; 1587 } 1588 } 1589 1590 }); 1591 1592 1593 // Set current language to top bar item 1594 var currentLanguage = jQuery('li.aux-languages').find('.current-language').html(); 1595 if (currentLanguage !== "") { 1596 jQuery('li.aux-languages > a').html(currentLanguage); 1597 } 1598 1599 // Set menu state on resize 1600 $window.smartresize( function() { 1601 if (jQuery('#container').width() > 767 || body.hasClass('responsive-fixed')) { 1602 var menus = jQuery('nav').find('ul.menu'); 1603 menus.each(function() { 1604 jQuery(this).css("display", ""); 1605 }); 1606 } 1607 }); 1608 1609 // Change menu active when scroll through sections 1610 SWIFT.nav.currentScrollIndication(); 1611 $window.scroll(function () { 1612 SWIFT.nav.currentScrollIndication(); 1613 }); 1614 }, 1615 currentScrollIndication: function() { 1616 var adjustment = 0; 1617 1618 if (body.hasClass('sticky-header-enabled')) { 1619 adjustment = jQuery('.header-wrap').height(); 1620 } 1621 1622 if ( jQuery('.sticky-top-bar').length > 0 ) { 1623 adjustment += jQuery('.sticky-top-bar').outerHeight(); 1624 } 1625 1626 var inview = jQuery('section.row:in-viewport('+adjustment+')').attr('id'), 1627 menuItems = jQuery('#main-navigation .menu li a'), 1628 link; 1629 1630 if ( inview !== "" && typeof inview != 'undefined' ) { 1631 link = menuItems.filter('[href="#' + inview + '"]'); 1632 } 1633 1634 menuItems.parent().removeClass('current-scroll-item'); 1635 1636 if (typeof inview != 'undefined' && link.length > 0 && !link.hasClass('.current-scroll-item')) { 1637 menuItems.parent().removeClass('current-scroll-item'); 1638 link.parent().addClass('current-scroll-item'); 1639 } 1640 1641 }, 1642 mobileMenuInit: function() { 1643 1644 // Check if admin bar present 1645 if (jQuery('#wpadminbar').length > 0) { 1646 var topPadding = 54; 1647 1648 if (body.hasClass('mh-overlay')) { 1649 jQuery('.mobile-overlay-close').css('top', topPadding + 'px'); 1650 topPadding = topPadding + 40; 1651 } 1652 1653 jQuery('#mobile-menu-wrap').css('padding-top', topPadding + 'px'); 1654 jQuery('#mobile-cart-wrap').css('padding-top', topPadding + 'px'); 1655 } 1656 1657 // Mobile Logo click 1658 jQuery('#mobile-logo > a').on('click touchstart', function(e) { 1659 if (body.hasClass('mobile-menu-open') || body.hasClass('mobile-cart-open') || body.hasClass('mobile-menu-closing')) { 1660 return false; 1661 } else { 1662 return e; 1663 } 1664 }); 1665 1666 // Mobile Nav show 1667 jQuery('.mobile-menu-link').on('click', function(e) { 1668 e.preventDefault(); 1669 1670 if (body.hasClass('mh-overlay')) { 1671 SWIFT.nav.mobileHeaderOverlay('menu'); 1672 } else { 1673 if (body.hasClass('mobile-menu-open')) { 1674 if (isAndroid) { 1675 return; 1676 } 1677 SWIFT.nav.mobileMenuHideTrigger(); 1678 } else { 1679 SWIFT.nav.showMobileMenu(); 1680 } 1681 } 1682 }); 1683 1684 // Mobile Cart show 1685 jQuery('.mobile-cart-link').on('click', function(e) { 1686 e.preventDefault(); 1687 1688 if (body.hasClass('mh-overlay')) { 1689 SWIFT.nav.mobileHeaderOverlay('cart'); 1690 } else { 1691 if (body.hasClass('mobile-menu-open')) { 1692 if (isAndroid) { 1693 return; 1694 } 1695 SWIFT.nav.mobileMenuHideTrigger(); 1696 } else { 1697 SWIFT.nav.showMobileCart(); 1698 } 1699 } 1700 }); 1701 1702 // Mobile Overlay Close 1703 jQuery('.mobile-overlay-close').on('click', function(e) { 1704 e.preventDefault(); 1705 if (body.hasClass('mh-cart-show')) { 1706 jQuery('#mobile-cart-wrap').animate({ 1707 'opacity': 0 1708 }, 500, 'easeOutQuart'); 1709 setTimeout(function() { 1710 body.removeClass('mh-overlay-show'); 1711 body.removeClass('mh-cart-show'); 1712 }, 500); 1713 } else if (body.hasClass('mh-menu-show')) { 1714 jQuery('#mobile-menu-wrap').animate({ 1715 'opacity': 0 1716 }, 500, 'easeOutQuart'); 1717 setTimeout(function() { 1718 body.removeClass('mh-overlay-show'); 1719 body.removeClass('mh-menu-show'); 1720 }, 500); 1721 } 1722 }); 1723 1724 // Mobile Menu parent click 1725 jQuery('#mobile-menu li > a').on('click', function(e) { 1726 var parentMenuItem = jQuery(this).parent(), 1727 linkHref = jQuery(this).attr('href'), 1728 subMenu = parentMenuItem.find('ul.sub-menu'); 1729 1730 if (linkHref.indexOf('#') === 0 && linkHref.length > 1) { 1731 var headerHeight = 0; 1732 1733 SWIFT.nav.mobileMenuHideTrigger(); 1734 setTimeout(function() { 1735 if (body.hasClass('mh-sticky')) { 1736 headerHeight = jQuery('#mobile-header').height(); 1737 } 1738 if (jQuery('#mobile-top-text-sticky-wrapper').length > 0 ) { 1739 headerHeight += jQuery('#mobile-top-text-sticky-wrapper').height(); 1740 } 1741 if (jQuery('#wpadminbar').length > 0) { 1742 headerHeight += jQuery('#wpadminbar').height(); 1743 } 1744 1745 if (jQuery(linkHref).length > 0) { 1746 jQuery('html, body').stop().animate({ 1747 scrollTop: jQuery(linkHref).offset().top - headerHeight + 2 1748 }, 1000, 'easeInOutExpo'); 1749 } 1750 }, 400); 1751 1752 e.preventDefault(); 1753 1754 } else { 1755 1756 if (!parentMenuItem.hasClass('parent')) { 1757 SWIFT.nav.mobileMenuHideTrigger(); 1758 1759 if (body.hasClass('page-transitions')) { 1760 SWIFT.page.fadePageOut(linkHref); 1761 } 1762 1763 return e; 1764 } 1765
1766 if (subMenu.hasClass('sub-menu-open')) { 1767 if (linkHref.indexOf('http') === 0) { 1768 return e; 1769 } else { 1770 subMenu.removeClass('sub-menu-open'); 1771 e.preventDefault(); 1772 } 1773 } else { 1774 subMenu.addClass('sub-menu-open'); 1775 e.preventDefault(); 1776 } 1777 } 1778 }); 1779 1780 1781 // Swipe to hide mobile menu 1782 jQuery("#mobile-menu-wrap").swipe({ 1783 swipeLeft:function() { 1784 if (!body.hasClass('mobile-header-center-logo-alt') && !body.hasClass('mobile-header-left-logo')) { 1785 SWIFT.nav.mobileMenuHideTrigger(); 1786 } 1787 }, 1788 swipeRight:function() { 1789 if (body.hasClass('mobile-header-center-logo-alt') || body.hasClass('mobile-header-left-logo')) { 1790 SWIFT.nav.mobileMenuHideTrigger(); 1791 } 1792 }, 1793 }); 1794 1795 // Swipe to hide mobile cart 1796 jQuery("#mobile-cart-wrap").swipe( { 1797 swipeLeft:function() { 1798 if (body.hasClass('mobile-header-center-logo-alt') || body.hasClass('mobile-header-right-logo') || body.hasClass('mobile-header-center-logo')) { 1799 SWIFT.nav.mobileMenuHideTrigger(); 1800 } 1801 }, 1802 swipeRight:function() { 1803 if (!body.hasClass('mobile-header-center-logo-alt') && !body.hasClass('mobile-header-right-logo')) { 1804 SWIFT.nav.mobileMenuHideTrigger(); 1805 } 1806 }, 1807 }); 1808 1809 // Hide on resize 1810 $window.smartresize( function() { 1811 1812 var windowWidth = $window.width(); 1813 1814 if (windowWidth > 1024 && body.hasClass('mhs-tablet-land')) { 1815 SWIFT.nav.mobileMenuHideTrigger(); 1816 } else if (windowWidth > 991 && body.hasClass('mhs-tablet-port')) { 1817 SWIFT.nav.mobileMenuHideTrigger(); 1818 } else if (windowWidth > 767 && body.hasClass('mhs-mobile')) { 1819 SWIFT.nav.mobileMenuHideTrigger(); 1820 } 1821 1822 }); 1823 1824 }, 1825 showMobileMenu: function() { 1826 1827 var windowTop = $window.scrollTop(); 1828 if (jQuery('#wpadminbar').length > 0) { 1829 windowTop = windowTop - jQuery('#wpadminbar').height(); 1830 } 1831 if (windowTop > 0 && body.hasClass('mh-sticky')) { 1832 jQuery('#mobile-header').css('position', 'absolute').css('top', windowTop); 1833 } 1834 1835 if (body.hasClass('header-below-slider')) { 1836 jQuery('#mobile-menu-wrap').css('position', 'absolute').css('top', jQuery('#container').offset().top); 1837 } 1838 1839 jQuery('#mobile-menu-wrap').css('display', 'block'); 1840 body.addClass('mobile-menu-open'); 1841 setTimeout(function() { 1842 jQuery('#container').on('click touchstart', SWIFT.nav.mobileMenuHideTrigger); 1843 }, 400); 1844 }, 1845 hideMobileMenu: function() { 1846 var windowTop = $window.scrollTop(); 1847 body.removeClass('mobile-menu-open'); 1848 setTimeout(function() { 1849 jQuery('#mobile-menu-wrap').css('display', 'none'); 1850 if (windowTop > 0 && body.hasClass('mh-sticky')) { 1851 jQuery('#mobile-header').css('position', 'fixed').css('top', '0'); 1852 } else { 1853 jQuery('#mobile-header').css('position', '').css('top', ''); 1854 } 1855 jQuery('#container').off('click touchstart', SWIFT.nav.mobileMenuHideTrigger); 1856 }, 300); 1857 setTimeout(function() { 1858 body.removeClass('mobile-menu-closing'); 1859 }, 1000); 1860 }, 1861 showMobileCart: function() { 1862 var windowTop = $window.scrollTop(); 1863 if (jQuery('#wpadminbar').length > 0) { 1864 windowTop = windowTop - jQuery('#wpadminbar').height(); 1865 } 1866 if (windowTop > 0 && body.hasClass('mh-sticky')) { 1867 jQuery('#mobile-header').css('position', 'absolute').css('top', windowTop); 1868 } 1869 1870 if (body.hasClass('header-below-slider')) { 1871 jQuery('#mobile-cartdon-wrap').css('position', 'absolute').css('top', jQuery('#container').offset().top); 1872 } 1873 1874 jQuery('#mobile-cart-wrap').css('display', 'block'); 1875 body.addClass('mobile-menu-open'); 1876 body.addClass('mobile-cart-open'); 1877 setTimeout(function() { 1878 jQuery('#container').on('click touchstart', SWIFT.nav.mobileMenuHideTrigger); 1879 }, 400); 1880 }, 1881 hideMobileCart: function() { 1882 var windowTop = $window.scrollTop(); 1883 body.removeClass('mobile-cart-open'); 1884 setTimeout(function() { 1885 jQuery('#mobile-cart-wrap').css('display', 'none'); 1886 if (windowTop > 0 && body.hasClass('mh-sticky')) { 1887 jQuery('#mobile-header').css('position', 'fixed').css('top', '0'); 1888 } else { 1889 jQuery('#mobile-header').css('position', '').css('top', ''); 1890 } 1891 jQuery('#container').off('click touchstart', SWIFT.nav.mobileMenuHideTrigger); 1892 }, 400); 1893 setTimeout(function() { 1894 body.removeClass('mobile-menu-closing'); 1895 }, 1000); 1896 }, 1897 mobileMenuHideTrigger: function(e) { 1898 if (e != null) { 1899 e.preventDefault(); 1900 } 1901 body.addClass('mobile-menu-closing'); 1902 SWIFT.nav.hideMobileMenu(); 1903 SWIFT.nav.hideMobileCart(); 1904 }, 1905 mobileHeaderOverlay: function(type) { 1906 1907 if (type === "menu") { 1908 jQuery('#mobile-menu-wrap').css('display', 'block'); 1909 body.addClass('mh-overlay-show'); 1910 body.addClass('mh-menu-show'); 1911 jQuery('#mobile-menu-wrap').animate({ 1912 'opacity': 1 1913 }, 500, 'easeOutQuart'); 1914 } else if (type === "cart") { 1915 jQuery('#mobile-cart-wrap').css('display', 'block'); 1916 body.addClass('mh-overlay-show'); 1917 body.addClass('mh-cart-show'); 1918 jQuery('#mobile-cart-wrap').animate({ 1919 'opacity': 1 1920 }, 500, 'easeOutQuart'); 1921 } 1922 1923 } 1924 }; 1925 1926 1927 ///////////////////////////////////////////// 1928 // WOOCOMMERCE FUNCTIONS 1929 ///////////////////////////////////////////// 1930 1931 SWIFT.woocommerce = { 1932 init: function() { 1933 1934 // QUANTITY FUNCTIONS
1935 SWIFT.woocommerce.productQuantityAdjust(); 1936 1937 jQuery('.add_to_cart_button').on('click', function() { 1938 var button = jQuery(this); 1939 var added_text = button.attr("data-added_text"); 1940 button.addClass("product-added"); 1941 button.find('span').text(added_text); 1942 button.find('i').attr('class', 'fa-check'); 1943 }); 1944 1945 // Cart remove product 1946 jQuery(document).on('click', '.shopping-bag .remove-product', function(e) { 1947 1948 e.preventDefault(); 1949 e.stopPropagation(); 1950 var prod_id = jQuery(this).attr('data-product-id'), 1951 prod_quantity = jQuery(this).attr('data-product-qty'), 1952 empty_bag_txt = jQuery('.shopping-bag').attr('data-empty-bag-txt'), 1953 singular_item_txt = jQuery('.shopping-bag').attr('data-singular-item-txt'), 1954 multiple_item_txt = jQuery('.shopping-bag').attr('data-multiple-item-txt'), 1955 data = {action: 'sf_cart_product_remove', product_id: prod_id}, 1956 ajaxURL = jQuery(this).attr('data-ajaxurl'); 1957 1958 jQuery.post(ajaxURL, data, function(response) { 1959 1960 var cartTotal = response; 1961 var cartcounter = 0; 1962
1963 cartcounter = parseInt(jQuery('.cart-contents .num-items').first().text()) - prod_quantity; 1964 jQuery('.cart-contents .amount').replaceWith(cartTotal); 1965 jQuery('.cart-contents .num-items').text(cartcounter); 1966 1967 jQuery('.cart-contents .num-items').each(function( index ) { 1968 jQuery(this).text(cartcounter); 1969 }); 1970 1971 jQuery('.product-id-'+prod_id).remove(); 1972 1973 if ( cartcounter <= 0 ) { 1974 jQuery('.sub-menu .shopping-bag').prepend('<div class="bag-empty">' + empty_bag_txt + '</div>'); 1975 jQuery('.sub-menu .shopping-bag .bag-header').remove(); 1976 jQuery('.sub-menu .shopping-bag .bag-buttons').remove(); 1977 } else { 1978 if ( cartcounter == 1 ) { 1979 jQuery('.sub-menu .shopping-bag .bag-header').text('1 ' + singular_item_txt); 1980 } else { 1981 jQuery('.sub-menu .shopping-bag .bag-header').text(cartcounter + ' ' + multiple_item_txt); 1982 } 1983 } 1984 1985 }); 1986 1987 return false; 1988 1989 }); 1990 1991// jQuery("body").bind("added_to_cart", function() { 1992// console.log('added to cart'); 1993// }); 1994 1995 jQuery('.show-products-link').on('click', function(e) { 1996 e.preventDefault(); 1997 var linkHref = jQuery(this).attr('href').replace('?', ''), 1998 currentURL = document.location.href.replace(/\/page\/\d+/, ''), 1999 currentQuery = document.location.search; 2000 2001 if (currentQuery.indexOf('?show') >= 0) { 2002 window.location = jQuery(this).attr('href'); 2003 } else if (currentQuery.indexOf('?') >= 0) { 2004 window.location = currentURL + '&' + linkHref; 2005 } else { 2006 window.location = currentURL + '?' + linkHref; 2007 } 2008 }); 2009 2010 jQuery('.shipping-calculator-form input').keypress(function(e) { 2011 if(e.which == 10 || e.which == 13) { 2012 jQuery(".update-totals-button button").click(); 2013 } 2014 }); 2015 2016 if (jQuery('.product-grid').length > 0) { 2017 2018 if (!jQuery('.inner-page-wrap').hasClass('full-width-shop')) { 2019 var productGrid = jQuery('.product-grid'); 2020 productGrid.imagesLoaded(function () { 2021 productGrid.equalHeights(); 2022 }); 2023 2024 $window.smartresize( function() { 2025 if (jQuery().equalHeights) { 2026 jQuery('.product-grid').children().css('min-height','0'); 2027 jQuery('.product-grid').equalHeights(); 2028 } 2029 }); 2030 } 2031 } 2032 }, 2033 load: function() { 2034 2035 if (jQuery('.woocommerce-shop-page').hasClass('full-width-shop') && !(IEVersion && IEVersion < 9)) { 2036 SWIFT.woocommerce.fullWidthShop(); 2037 } 2038 2039 }, 2040 variations: function() { 2041 jQuery('.variations_form select, .variations select').each( function() { 2042 var variationSelect = jQuery(this); 2043 variationSelect.on("change", function(){ 2044 if (jQuery('#sf-included').hasClass('has-productzoom')) { 2045 jQuery('.zoomContainer').remove(); 2046 setTimeout(function() { 2047 jQuery('.product-slider-image').each(function() { 2048 jQuery(this).data('zoom-image', jQuery(this).parent().find('a.zoom').attr('href')); 2049 }); 2050 var firstImage = jQuery('#product-img-slider li:first').find('.product-slider-image'); 2051 SWIFT.woocommerce.productZoom(firstImage); 2052 jQuery('#product-img-slider').flexslider(0); 2053 }, 500); 2054 } else { 2055 setTimeout(function() { 2056 jQuery('#product-img-slider').flexslider(0); 2057 var flexViewport = jQuery('#product-img-slider').find('.flex-viewport'), 2058 flexsliderHeight = flexViewport.find('ul.slides').css('height'); 2059 2060 flexViewport.animate({ 2061 'height': flexsliderHeight 2062 }, 300); 2063 }, 500); 2064 } 2065 }); 2066 }); 2067 }, 2068 productZoom: function(zoomObject) { 2069 jQuery('#product-img-slider li a.zoom').css('display', 'none'); 2070 zoomObject.elevateZoom({ 2071 zoomType: productZoomType, 2072 cursor: "crosshair", 2073 zoomParent: '#product-img-slider', 2074 responsive: true, 2075 zoomWindowFadeIn: 400, 2076 zoomWindowFadeOut: 500, 2077 lensSize: 250 2078 }); 2079 $window.smartresize( function() { 2080 var currentImage = jQuery('#product-img-slider li.flex-active-slide').find('.product-slider-image'); 2081 if (!currentImage) { 2082 jQuery('#product-img-slider li:first').find('.product-slider-image'); 2083 }
2084 SWIFT.woocommerce.productZoom(currentImage); 2085 }); 2086 }, 2087 fullWidthShop: function() { 2088 var shopItems = jQuery('.full-width-shop').find('.products'), 2089 itemWidth = shopItems.find('.product').first().data('width'), 2090 shopSidebar = shopItems.find('.sidebar'); 2091 2092 if (shopSidebar.length > 0) { 2093 2094 // Full Width Shop Sidebar 2095 SWIFT.woocommerce.fullWidthShopSetSidebarHeight(); 2096 $window.smartresize( function() { 2097 SWIFT.woocommerce.fullWidthShopSetSidebarHeight(); 2098 }); 2099 2100 shopItems.isotope({ 2101 itemSelector: '.product', 2102 layoutMode: 'masonry', 2103 masonry: { 2104 columnWidth: '.'+itemWidth 2105 }, 2106 isOriginLeft: !isRTL 2107 }); 2108 2109 SWIFT.woocommerce.animateItems(shopItems); 2110 2111 shopSidebar.stop().animate({ 2112 'opacity': 1 2113 }, 500); 2114 shopItems.isotope( 'stamp', shopSidebar ); 2115 shopItems.isotope('layout'); 2116 2117 } else { 2118 2119 shopItems.isotope({ 2120 itemSelector: '.product', 2121 layoutMode: 'fitRows', 2122 isOriginLeft: !isRTL 2123 }); 2124
2125 SWIFT.woocommerce.animateItems(shopItems); 2126 2127 } 2128 }, 2129 fullWidthShopSetSidebarHeight: function() { 2130 var shopItems = jQuery('.full-width-shop').find('.products'), 2131 shopSidebar = shopItems.find('div.sidebar'), 2132 defaultSidebarHeight = shopSidebar.css('height', '').outerHeight(), 2133 newSidebarHeight = 0, 2134 sidebarHeightMultiply = 2, 2135 firstProductHeight = shopItems.find('.product').first().outerHeight(true); 2136 2137 sidebarHeightMultiply = Math.ceil(defaultSidebarHeight / firstProductHeight); 2138 newSidebarHeight = firstProductHeight * sidebarHeightMultiply; 2139 shopSidebar.css('height', newSidebarHeight); 2140 }, 2141 animateItems: function(shopItems) { 2142 shopItems.find('.product').each(function(i) { 2143 jQuery(this).delay(i*200).animate({ 2144 'opacity' : 1 2145 }, 800, 'easeOutExpo', function() { 2146 jQuery(this).addClass('item-animated'); 2147 }); 2148 }); 2149 }, 2150 productQuantityAdjust: function() { 2151 2152 // Increase 2153 jQuery(document).on('click', '.qty-plus', function(e) { 2154 e.preventDefault(); 2155 var quantityInput = jQuery(this).parents('.quantity').find('input.qty'), 2156 newValue = parseInt(quantityInput.val(), 10) + 1, 2157 maxValue = parseInt(quantityInput.attr('max'), 10); 2158 2159 if (!maxValue) { 2160 maxValue = 9999999999; 2161 } 2162 2163 if ( newValue <= maxValue ) { 2164 quantityInput.val(newValue); 2165 quantityInput.change(); 2166 } 2167 }); 2168 2169 // Decrease 2170 jQuery(document).on('click', '.qty-minus', function(e) { 2171 e.preventDefault(); 2172 var quantityInput = jQuery(this).parents('.quantity').find('input.qty'), 2173 newValue = parseInt(quantityInput.val(), 10) - 1, 2174 minValue = parseInt(quantityInput.attr('min'), 10); 2175 2176 if (!minValue) { 2177 minValue = 1; 2178 } 2179 2180 if ( newValue >= minValue ) { 2181 quantityInput.val(newValue); 2182 quantityInput.change(); 2183 } 2184 }); 2185 2186 } 2187 }; 2188 2189 ///////////////////////////////////////////// 2190 // FLEXSLIDER FUNCTION 2191 ///////////////////////////////////////////// 2192 2193 SWIFT.flexSlider = { 2194 init: function() { 2195 2196 if (!jQuery().flexslider) { 2197 return; 2198 } 2199 2200 if (jQuery('#product-img-slider').length > 0) { 2201 SWIFT.flexSlider.productSlider(); 2202 } 2203 2204 jQuery('.item-slider').flexslider({ 2205 useCSS: flexUseCSS, 2206 animation: "slide", //String: Select your animation type, "fade" or "slide" 2207 slideDirection: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical" 2208 slideshow: sliderAuto, //Boolean: Animate slider automatically 2209 slideshowSpeed: sliderSlideSpeed, //Integer: Set the speed of the slideshow cycling, in milliseconds 2210 animationDuration: sliderAnimSpeed, //Integer: Set the speed of animations, in milliseconds 2211 rtl: isRTL, 2212 smoothHeight: true, 2213 directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false) 2214 controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage 2215 keyboardNav: false, //Boolean: Allow slider navigating via keyboard left/right keys 2216 mousewheel: false, //Boolean: Allow slider navigating via mousewheel 2217 prevText: "Prev", //String: Set the text for the "previous" directionNav item 2218 nextText: "Next", //String: Set the text for the "next" directionNav item 2219 pausePlay: true, //Boolean: Create pause/play dynamic element 2220 pauseText: '', //String: Set the text for the "pause" pausePlay item 2221 playText: '', //String: Set the text for the "play" pausePlay item 2222 randomize: false, //Boolean: Randomize slide order 2223 slideToStart: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide) 2224 animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end 2225 pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended. 2226 pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering 2227 controlsContainer: "", //Selector: Declare which container the navigation elements should be appended too. Default container is the flexSlider element. Example use would be ".flexslider-container", "#container", etc. If the given element is not found, the default action will be taken. 2228 manualControls: "", //Selector: Declare custom control navigation. Example would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs. 2229 start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide 2230 before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation 2231 after: function(){}, //Callback: function(slider) - Fires after each slider animation completes 2232 end: function(){} //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous) 2233 }); 2234 jQuery('.content-slider').each(function() { 2235 var slider = jQuery(this), 2236 autoplay = ((slider.attr('data-autoplay') === "yes") ? true : false); 2237 2238 slider.flexslider({ 2239 useCSS: flexUseCSS, 2240 animation: "fade", //String: Select your animation type, "fade" or "slide"
2241 slideshow: autoplay, //Boolean: Animate slider automatically 2242 slideshowSpeed: 6000, //Integer: Set the speed of the slideshow cycling, in milliseconds 2243 animationDuration: 1000, //Integer: Set the speed of animations, in milliseconds 2244 smoothHeight: false, 2245 directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false) 2246 rtl: isRTL, 2247 controlNav: false, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage 2248 prevText: "", //String: Set the text for the "previous" directionNav item 2249 nextText: "", //String: Set the text for the "next" directionNav item 2250 pauseOnHover: true, 2251 start: function() { 2252 SWIFT.flexSlider.slideEqualHeights(); 2253 $window.smartresize( function() { 2254 SWIFT.flexSlider.slideEqualHeights(); 2255 }); 2256 } 2257 }); 2258 }); 2259 }, 2260 productSlider: function() { 2261 if (!jQuery().flexslider) { 2262 return; 2263 } 2264 jQuery('#product-img-slider').flexslider({ 2265 useCSS: flexUseCSS, 2266 animation: "slide", 2267 controlNav: true, 2268 smoothHeight: true, 2269 animationLoop: false, 2270 slideshow: sliderAuto, 2271 slideshowSpeed: sliderSlideSpeed, //Integer: Set the speed of the slideshow cycling, in milliseconds 2272 animationDuration: sliderAnimSpeed, //Integer: Set the speed of animations, in milliseconds 2273 rtl: isRTL, 2274 sync: '#product-img-nav', 2275 start: function(productSlider) { 2276 if (hasProductZoom) { 2277 if (productSlider.slides) { 2278 var currentImageHasSlides = productSlider.slides.eq(productSlider.currentSlide).find('.product-slider-image'); 2279 SWIFT.woocommerce.productZoom(currentImageHasSlides); 2280 } else { 2281 var currentImageNoSlides = jQuery('#product-img-slider').find('.product-slider-image'); 2282 SWIFT.woocommerce.productZoom(currentImageNoSlides); 2283 } 2284 } 2285 }, 2286 before: function() { 2287 if (hasProductZoom) { 2288 jQuery('.zoomContainer').remove(); 2289 } 2290 }, 2291 after: function(productSlider) { 2292 if (hasProductZoom) { 2293 var currentSlideImage = productSlider.slides.eq(productSlider.currentSlide).find('.product-slider-image'); 2294 SWIFT.woocommerce.productZoom(currentSlideImage); 2295 } 2296 } 2297 }); 2298 2299 if (jQuery('#product-img-nav ul.slides li').length > 1) { 2300 jQuery('#product-img-nav').flexslider({ 2301 animation: "slide", 2302 rtl: isRTL, 2303 useCSS: flexUseCSS, 2304 directionNav: false, 2305 controlNav: false, 2306 animationLoop: false, 2307 slideshow: false, 2308 itemWidth: 100, 2309 itemMargin: 0, 2310 asNavFor: '#product-img-slider' 2311 }); 2312 } else { 2313 jQuery('#product-img-nav').css('display', 'none'); 2314 } 2315 }, 2316 thumb: function() { 2317 if (!jQuery().flexslider) { 2318 return; 2319 } 2320 jQuery('.thumb-slider').flexslider({ 2321 animation: "fade", //String: Select your animation type, "fade" or "slide" 2322 slideDirection: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical" 2323 slideshow: sliderAuto, //Boolean: Animate slider automatically 2324 slideshowSpeed: sliderSlideSpeed, //Integer: Set the speed of the slideshow cycling, in milliseconds 2325 animationDuration: sliderAnimSpeed, //Integer: Set the speed of animations, in milliseconds 2326 directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false) 2327 controlNav: false, //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage 2328 keyboardNav: false, //Boolean: Allow slider navigating via keyboard left/right keys 2329 smoothHeight: false, 2330 rtl: isRTL 2331 }); 2332 }, 2333 slideEqualHeights: function() { 2334 setTimeout(function() { 2335 jQuery('.content-slider').find('.slide-content-wrap').css('position', 'relative'); 2336 if (jQuery().equalHeights) { 2337 jQuery('.content-slider > ul').equalHeights(); 2338 } 2339 jQuery('.content-slider').find('.slide-content-wrap').vCenterTop(); 2340 jQuery('.content-slider').find('.slide-content-wrap').css('position', 'absolute'); 2341 }, 200); 2342 } 2343 }; 2344 2345 ///////////////////////////////////////////// 2346 // PORTFOLIO 2347 ///////////////////////////////////////////// 2348 2349 var portfolioContainer = jQuery('.portfolio-wrap').find('.filterable-items'); 2350 2351 SWIFT.portfolio = { 2352 init: function() { 2353 portfolioContainer.each(function() { 2354 var portfolioInstance = jQuery(this); 2355 if (portfolioInstance.hasClass('masonry-items') && !(IEVersion && IEVersion < 9)) { 2356 SWIFT.portfolio.masonrySetup(portfolioInstance); 2357 } else if (portfolioInstance.hasClass('multi-masonry-items') && !(IEVersion && IEVersion < 9)) { 2358 SWIFT.portfolio.multiMasonrySetup(portfolioInstance); 2359 } else { 2360 SWIFT.portfolio.standardSetup(portfolioInstance); 2361 } 2362 }); 2363 2364 // PORTFOLIO WINDOW RESIZE 2365 $window.smartresize( function() { 2366 SWIFT.portfolio.windowResized(); 2367 }); 2368 2369 // Enable filter options on when there are items from that skill 2370 jQuery('.filtering li').each( function() { 2371 var filter = jQuery(this), 2372 filterName = jQuery(this).find('a').attr('class'), 2373 portfolioItems = jQuery(this).parents('.portfolio-wrap').find('.filterable-items'); 2374 2375 portfolioItems.find('.portfolio-item').each( function() { 2376 if ( jQuery(this).hasClass(filterName) ) { 2377 filter.addClass('has-items'); 2378 } 2379 }); 2380 }).parents('.filtering').animate({ 2381 opacity: 1 2382 }, 400); 2383 2384 // filter items when filter link is clicked 2385 jQuery('.filtering li').on('click', 'a', function(e) { 2386 e.preventDefault(); 2387 jQuery(this).parent().parent().find('li').removeClass('selected'); 2388 jQuery(this).parent().addClass('selected'); 2389 var selector = jQuery(this).data('filter'); 2390 var portfolioItems = jQuery(this).parents('.portfolio-wrap').find('.filterable-items'); 2391 portfolioItems.isotope({ filter: selector }); 2392 }); 2393 2394 jQuery('.filter-wrap > a').on('click', function(e) { 2395 e.preventDefault(); 2396 jQuery(this).parent().find('.filter-slide-wrap').slideToggle(); 2397 }); 2398 }, 2399 standardSetup: function(portfolioInstance) { 2400 portfolioInstance.imagesLoaded(function () { 2401 SWIFT.portfolio.setItemHeight(); 2402 SWIFT.flexSlider.thumb(); 2403 portfolioInstance.animate({opacity: 1}, 800); 2404 portfolioInstance.isotope({ 2405 resizable: true, 2406 layoutMode: 'fitRows', 2407 isOriginLeft: !isRTL 2408 }); 2409 });
2410 portfolioInstance.appear(function() { 2411 SWIFT.portfolio.animateItems(portfolioInstance); 2412 }); 2413 }, 2414 masonrySetup: function(portfolioInstance) { 2415 portfolioInstance.imagesLoaded(function () { 2416 SWIFT.flexSlider.thumb(); 2417 portfolioInstance.isotope({ 2418 resizable: false, 2419 itemSelector : '.portfolio-item', 2420 layoutMode: 'masonry', 2421 isOriginLeft: !isRTL 2422 }); 2423 }); 2424 portfolioInstance.appear(function() { 2425 SWIFT.portfolio.animateItems(portfolioInstance); 2426 }); 2427 }, 2428 multiMasonrySetup: function(portfolioInstance) { 2429 portfolioInstance.imagesLoaded(function () { 2430 SWIFT.flexSlider.thumb(); 2431 SWIFT.portfolio.multiMasonrySizeFix(false); 2432 portfolioInstance.isotope({ 2433 resizable: false, 2434 itemSelector : '.portfolio-item', 2435 layoutMode: 'packery', 2436 packery: { 2437 columnWidth: '.grid-sizer' 2438 }, 2439 isOriginLeft: !isRTL 2440 }); 2441 }); 2442 portfolioInstance.appear(function() { 2443 SWIFT.portfolio.animateItems(portfolioInstance); 2444 }); 2445 }, 2446 animateItems: function(portfolioInstance) { 2447 portfolioInstance.find('.portfolio-item').each(function(i) { 2448 jQuery(this).delay(i*200).animate({ 2449 'opacity' : 1 2450 }, 800, 'easeOutExpo', function() { 2451 jQuery(this).addClass('item-animated'); 2452 }); 2453 }); 2454 }, 2455 setItemHeight: function() { 2456 if (!portfolioContainer.hasClass('col-1') && !portfolioContainer.hasClass('masonry-items') && !portfolioContainer.hasClass('multi-masonry-items')) { 2457 portfolioContainer.children().css('min-height','0'); 2458 portfolioContainer.equalHeights(); 2459 } 2460 }, 2461 multiMasonrySizeFix: function($init) { 2462 var baseItem = portfolioContainer.find('.portfolio-item.size-standard').first(), 2463 standardHeight = baseItem.height(), 2464 standardWidth = baseItem.width(), 2465 wideTallHeight = (standardHeight * 2) + parseInt(baseItem.css('margin-bottom'), 10), 2466 wideWidth = (standardWidth * 2) + parseInt(baseItem.css('margin-bottom'), 10); 2467 2468 if (standardHeight > 0) { 2469 //portfolioContainer.find('.portfolio-item.size-wide .multi-masonry-img-wrap').css('height', standardHeight).css('width', wideWidth + 2); 2470 //portfolioContainer.find('.portfolio-item.size-wide-tall .multi-masonry-img-wrap').css('height', wideTallHeight).css('width', wideWidth + 2); 2471 //portfolioContainer.find('.portfolio-item.size-tall .multi-masonry-img-wrap').css('height', wideTallHeight).css('width', standardWidth + 2); 2472 portfolioContainer.find('.portfolio-item.size-wide .multi-masonry-img-wrap').css('height', standardHeight); 2473 portfolioContainer.find('.portfolio-item.size-wide-tall .multi-masonry-img-wrap').css('height', wideTallHeight); 2474 portfolioContainer.find('.portfolio-item.size-tall .multi-masonry-img-wrap').css('height', wideTallHeight); 2475 } 2476 if ($init) { 2477 portfolioContainer.isotope('layout'); 2478 } 2479 }, 2480 windowResized: function() { 2481 if (!portfolioContainer.hasClass('col-1') && !portfolioContainer.hasClass('masonry-items') && !portfolioContainer.hasClass('multi-masonry-items')) { 2482 SWIFT.portfolio.setItemHeight(); 2483 } 2484 2485 if (portfolioContainer.hasClass('multi-masonry-items')) { 2486 SWIFT.portfolio.multiMasonrySizeFix(true); 2487 } 2488 }, 2489 portfolioShowcaseInit: function() { 2490 SWIFT.flexSlider.thumb(); 2491 SWIFT.portfolio.portfolioShowcaseWrap(); 2492 SWIFT.portfolio.portfolioShowcaseItems(); 2493 $window.smartresize( function() { 2494 SWIFT.portfolio.portfolioShowcaseWrap(); 2495 SWIFT.portfolio.portfolioShowcaseItems(); 2496 }); 2497 }, 2498 portfolioShowcaseWrap: function() { 2499 var portfolioShowcaseWrap = jQuery('.portfolio-showcase-wrap'); 2500 portfolioShowcaseWrap.animate({opacity: 1}, 600); 2501 }, 2502 portfolioShowcaseItems: function() { 2503 jQuery('.portfolio-showcase-wrap').each(function() { 2504 2505 var contWidth = jQuery('#main-container').width(); 2506 2507 if (jQuery('#container').hasClass('boxed-layout')) { 2508 contWidth = jQuery('#container').width(); 2509 } 2510 2511 var thisShowcase = jQuery(this), 2512 columns = thisShowcase.find('.portfolio-showcase-items').data('columns'), 2513 windowWidth = contWidth + 2, 2514 itemWidth = Math.floor(windowWidth / columns), 2515 maximisedWidth = Math.floor(windowWidth * 40 / 100), 2516 reducedWidth = Math.floor(windowWidth / 5), 2517 deselectedLeft = (itemWidth / 2 - maximisedWidth / 2) / 0.75, 2518 resetLeft = (reducedWidth / 2 - maximisedWidth / 2) / 1.3, 2519 isAnimating = !1, 2520 speed = 300; 2521 2522 var showcaseItem = thisShowcase.find('li.portfolio-item'); 2523 2524 if (columns === 5) { 2525 maximisedWidth = Math.floor(windowWidth * 25 / 100); 2526 reducedWidth = Math.floor(windowWidth / 5.33); 2527 deselectedLeft = (itemWidth / 2 - maximisedWidth / 2) / 0.75; 2528 resetLeft = (reducedWidth / 2 - maximisedWidth / 2) / 1.3; 2529 showcaseItem.css("width", itemWidth); 2530 showcaseItem.css("height", maximisedWidth / 1.5); 2531 showcaseItem.find('.main-image').css("width", maximisedWidth); 2532 showcaseItem.find('.main-image').css("left", resetLeft); 2533 showcaseItem.find('.main-image').css("top", - maximisedWidth / 6); 2534 speed = 200; 2535 } else { 2536 showcaseItem.css("width", itemWidth); 2537 showcaseItem.css("height", maximisedWidth / 2); 2538 showcaseItem.find('.main-image').css("width", maximisedWidth); 2539 showcaseItem.find('.main-image').css("left", resetLeft); 2540 } 2541 2542 showcaseItem.each(function () { 2543 if (windowWidth > 768) { 2544 jQuery(this).mouseenter(function () { 2545 if (!isAnimating) { 2546 isAnimating = !0; 2547 jQuery(this).removeClass("deselected-item"); 2548 thisShowcase.find(".deselected-item").stop().animate({ 2549 width: reducedWidth 2550 }, speed); 2551 thisShowcase.find(".deselected-item").find(".main-image").stop().animate({ 2552 left: deselectedLeft 2553 }, speed); 2554 jQuery(this).find(".main-image").stop().animate({ 2555 left: 0 2556 }, speed); 2557 jQuery(this).stop().animate({ 2558 width: maximisedWidth 2559 }, speed + 1, function () { 2560 jQuery(this).find(".item-info").stop().show(); 2561 jQuery(this).find(".item-info").stop().animate({ 2562 bottom: 0 2563 }, speed, "easeInOutQuart"); 2564 }); 2565 } 2566 }); 2567 jQuery(this).mouseleave(function () { 2568 if (isAnimating) { 2569 isAnimating = !1; 2570 jQuery(this).addClass("deselected-item"); 2571 thisShowcase.find(".portfolio-item").stop().animate({ 2572 width: itemWidth 2573 }, speed); 2574 thisShowcase.find(".portfolio-item .main-image").stop().animate({ 2575 left: resetLeft 2576 }, speed); 2577 jQuery(this).find(".item-info").stop().animate({ 2578 bottom: -85 2579 }, speed, function () { 2580 jQuery(this).find(".item-info").stop().hide(); 2581 }); 2582 } 2583 }); 2584 } 2585 }); 2586 }); 2587 }, 2588 stickyDetails: function() { 2589 2590 var offset = 0; 2591 2592 if (jQuery('.sticky-header').length > 0) { 2593 offset = jQuery('.sticky-header').height() > 0 ? jQuery('.sticky-header').height() : jQuery('#header-section').height(); 2594 } 2595 if (jQuery('#wpadminbar').length > 0) { 2596 offset = offset + jQuery('#wpadminbar').height(); 2597 } 2598 if (jQuery('.sticky-top-bar').length > 0) { 2599 offset = offset + jQuery('.sticky-top-bar').height() > 0 ? jQuery('.sticky-top-bar').height() : jQuery('#top-bar').height(); 2600 } 2601 2602 jQuery(".page-content").stick_in_parent({ 2603 offset_top: offset + 30 2604 }); 2605 2606 } 2607 }; 2608 2609 2610 ///////////////////////////////////////////// 2611 // BLOG 2612 ///////////////////////////////////////////// 2613 2614 var blogItems = jQuery('.blog-wrap').find('.blog-items'); 2615 2616 SWIFT.blog = { 2617 init: function() { 2618 2619 // BLOG ITEM SETUP 2620 blogItems.each(function() { 2621 var blogInstance = jQuery(this); 2622 if (blogInstance.hasClass('blog-grid-items')) { 2623 SWIFT.blog.blogGrid(blogInstance.find('.grid-items')); 2624 } else { 2625 SWIFT.blog.blogLayout(blogInstance); 2626 } 2627 }); 2628 2629 // Blog Filtering 2630 SWIFT.blog.blogFiltersInit(); 2631 2632 // BLOG AUX SLIDEOUT 2633 jQuery('.blog-slideout-trigger').on('click', function(e) { 2634 e.preventDefault(); 2635 2636 // VARIABLES 2637 var blogWrap = jQuery(this).parent().parent().parent().parent(); 2638 var filterPanel = blogWrap.find('.blog-filter-wrap .filter-slide-wrap'); 2639 var auxType = jQuery(this).attr('data-aux'); 2640 2641 // ADD COLUMN SIZE AND REMOVE BRACKETS FROM COUNT 2642 blogWrap.find('.aux-list li').addClass('col-sm-2'); 2643 blogWrap.find('.aux-list li a span').each(function() { 2644 jQuery(this).html(jQuery(this).html().replace("(","").replace(")","")); 2645 }); 2646 2647 // IF SELECTING AN OPTION THAT IS OPEN, CLOSE THE PANEL 2648 if (jQuery(this).parent().hasClass('selected') && !filterPanel.is(':animated')) { 2649 blogWrap.find('.blog-aux-options li').removeClass('selected'); 2650 filterPanel.slideUp(400); 2651 return; 2652 } 2653 2654 // AUX BUTTON SELECTED STATE 2655 blogWrap.find('.blog-aux-options li').removeClass('selected'); 2656 jQuery(this).parent().addClass('selected'); 2657 2658 // IF SLIDEOUT IS OPEN 2659 if (filterPanel.is(':visible')) { 2660 2661 filterPanel.slideUp(400); 2662 setTimeout(function() { 2663 blogWrap.find('.aux-list').css('display', 'none');
2664 blogWrap.find('.aux-'+auxType).css('display', 'block'); 2665 filterPanel.slideDown(); 2666 }, 600); 2667 2668 // IF SLIDEOUT IS CLOSED 2669 } else { 2670 2671 blogWrap.find('.aux-list').css('display', 'none'); 2672 blogWrap.find('.aux-'+auxType).css('display', 'block'); 2673 filterPanel.slideDown(); 2674 2675 } 2676 }); 2677 2678 }, 2679 blogFiltersInit: function() { 2680 2681 SWIFT.blog.blogShowFilters(); 2682 jQuery('.filtering').animate({ 2683 opacity: 1 2684 }, 400); 2685 2686 // filter items when filter link is clicked 2687 jQuery('.filtering li').on('click', 'a', function(e) { 2688 e.preventDefault(); 2689 jQuery(this).parent().parent().find('li').removeClass('selected'); 2690 jQuery(this).parent().addClass('selected'); 2691 var selector = jQuery(this).data('filter'); 2692 var blogItems = jQuery(this).parents('.blog-wrap').find('.blog-items'); 2693 blogItems.isotope({ filter: selector }); 2694 }); 2695 2696 jQuery('.filter-wrap > a').on('click', function(e) { 2697 e.preventDefault(); 2698 jQuery(this).parent().find('.filter-slide-wrap').slideToggle(); 2699 }); 2700 }, 2701 blogShowFilters: function() { 2702 // Enable filter options on when there are items from that skill 2703 jQuery('.filtering li').each( function() { 2704 var filter = jQuery(this), 2705 filterName = jQuery(this).find('a').attr('class'), 2706 blogItems = jQuery(this).parents('.blog-wrap').find('.blog-items'); 2707 2708 blogItems.find('.blog-item').each( function() { 2709 if ( jQuery(this).hasClass(filterName) ) { 2710 filter.addClass('has-items'); 2711 } 2712 }); 2713 }); 2714 }, 2715 blogLayout: function(blogInstance) { 2716 2717 var blogType = blogInstance.data('blog-type'), 2718 layoutMode = 'fitRows'; 2719 2720 if (blogType === "masonry") { 2721 layoutMode = 'masonry'; 2722 } 2723 2724 if (blogType === "masonry" && blogInstance.hasClass('social-blog')) { 2725 var tweets = blogInstance.parent().find('.blog-tweets').html(), 2726 instagrams = blogInstance.parent().find('.blog-instagrams'); 2727 2728 blogInstance.imagesLoaded(function () { 2729 SWIFT.flexSlider.thumb(); 2730 blogInstance.isotope({ 2731 resizable: false, 2732 itemSelector : '.blog-item', 2733 layoutMode: 'masonry', 2734 getSortData : { 2735 date : function ( elem ) { 2736 return jQuery(elem).data('date'); 2737 } 2738 }, 2739 sortBy: 'date', 2740 sortAscending: false, 2741 isOriginLeft: !isRTL 2742 }); 2743 if (tweets !== "") { 2744 blogInstance.isotope('insert', jQuery(tweets)); 2745 } 2746 if (instagrams.length > 0) { 2747 SWIFT.blog.masonryInstagram(instagrams, blogInstance); 2748 } 2749 blogInstance.isotope('updateSortData').isotope(); 2750 }); 2751 2752 } else { 2753 blogInstance.imagesLoaded(function () { 2754 SWIFT.flexSlider.thumb(); 2755 blogInstance.isotope({ 2756 resizable: true, 2757 layoutMode: layoutMode, 2758 isOriginLeft: !isRTL 2759 }); 2760 }); 2761 blogInstance.appear(function() { 2762 SWIFT.blog.animateItems(blogInstance); 2763 }); 2764 } 2765 }, 2766 masonryInstagram: function(instagrams, blogItems) { 2767 var userID = instagrams.data('userid'), 2768 token = instagrams.data('token'), 2769 count = instagrams.data('count'), 2770 itemClass = instagrams.data('itemclass'), 2771 clientid = '756db9880cc84c3dab85118df38f9b91'; 2772 2773 jQuery.ajax({ 2774 url: 'https://api.instagram.com/v1/users/' + userID + '/media/recent?access_token='
2774+ token, // specify the ID of the first found user 2775 dataType: 'jsonp', 2776 type: 'GET', 2777 data: {client_id: clientid, count: count}, 2778 success: function(data) { 2779 for (var i = 0; i < count; i++) { 2780 if (data.data[i]) { 2781 var caption = ""; 2782 if (data.data[i].caption) { 2783 caption = data.data[i].caption.text; 2784 } 2785 instagrams.append("<li class='blog-item instagram-item "+itemClass+"' data-date='"+data.data[i].created_time+"'><a class='timestamp inst-icon' target='_blank' href='" + data.data[i].link +"'><i class='fa-instagram'></i></a><div class='inst-overlay'><a target='_blank' href='" + data.data[i].link +"'></a><h6>"+instagrams.data('title')+"</h6><h2>"+caption+"</h2><div class='name-divide'></div><data class='date timeago' title='"+data.data[i].created_time+"' value=''>"+data.data[i].created_time+"</data></div><img class='instagram-image' src='" + data.data[i].images.low_resolution.url +"' width='306px' height='306px' /></li>"); 2786 } 2787 } 2788 jQuery("data.timeago").timeago(); 2789 instagrams.imagesLoaded(function(){ 2790 blogItems.isotope('insert', jQuery(instagrams.html())); 2791 }); 2792 blogItems.isotope('updateSortData').isotope(); 2793 } 2794 }); 2795 }, 2796 animateItems: function(blogInstance) { 2797 blogInstance.find('.blog-item').each(function(i) { 2798 jQuery(this).delay(i*200).animate({ 2799 'opacity' : 1, 2800 }, 800, 'easeOutExpo', function() { 2801 jQuery(this).addClass('item-animated'); 2802 }); 2803 }); 2804 }, 2805 blogGrid: function(gridItems) { 2806 var tweets = gridItems.parent().find('.blog-tweets').html(), 2807 instagrams = gridItems.parent().find('.blog-instagrams'); 2808 2809 gridItems.imagesLoaded(function () { 2810 SWIFT.flexSlider.thumb(); 2811 gridItems.isotope({ 2812 resizable: false, 2813 itemSelector : '.blog-item', 2814 layoutMode: 'fitRows', 2815 getSortData : { 2816 id : function ( elem ) { 2817 return jQuery(elem).data('sortid'); 2818 } 2819 }, 2820 sortBy: 'id', 2821 sortAscending: true, 2822 isOriginLeft: !isRTL 2823 }); 2824 if (tweets !== "") { 2825 gridItems.isotope('insert', jQuery(tweets)); 2826 } 2827 if (instagrams.length > 0) { 2828 SWIFT.blog.blogGridInstagram(instagrams, gridItems); 2829 } 2830 gridItems.isotope('updateSortData').isotope(); 2831 SWIFT.blog.blogGridResize(); 2832 }).animate({ 2833 'opacity' : 1 2834 }, 800, 'easeOutExpo'); 2835 2836 $window.smartresize( function() { 2837 SWIFT.blog.blogGridResize(); 2838 }); 2839 2840 }, 2841 blogGridResize: function() { 2842 blogItems.find('.grid-items').each(function() { 2843 var gridItem = jQuery(this).find('.blog-item'), 2844 itemWidth = gridItem.first().width(); 2845 if (gridItem.first().hasClass('col-sm-sf-25')) { 2846 itemWidth = itemWidth / 2; 2847 } 2848 gridItem.css('height', itemWidth); 2849 }); 2850 setTimeout(function() { 2851 jQuery(".tweet-text,.quote-excerpt").dotdotdot(); 2852 blogItems.find('.grid-items').isotope('layout'); 2853 }, 500); 2854 }, 2855 blogGridInstagram: function(instagrams, gridItems) { 2856 var userID = instagrams.data('userid'), 2857 token = instagrams.data('token'), 2858 count = instagrams.data('count'), 2859 clientid = '756db9880cc84c3dab85118df38f9b91'; 2860 2861 jQuery.ajax({ 2862 url: 'https://api.instagram.com/v1/users/' + userID + '/media/recent?access_token='
2862+ token, // specify the ID of the first found user 2863 dataType: 'jsonp', 2864 type: 'GET', 2865 data: {client_id: clientid, count: count}, 2866 success: function(data) { 2867 for (var i = 0; i < count; i++) { 2868 if (data.data[i]) { 2869 var caption = ""; 2870 if (data.data[i].caption) { 2871 caption = data.data[i].caption.text; 2872 } 2873 instagrams.append("<li class='blog-item col-sm-sf-5 instagram-item' data-date='"+data.data[i].created_time+"' data-sortid='"+i*2+"'><a class='timestamp inst-icon' target='_blank' href='" + data.data[i].link +"'><i class='fa-instagram'></i></a><div class='inst-img-wrap'><div class='inst-overlay'><a target='_blank' href='" + data.data[i].link +"'></a><h6>"+instagrams.data('title')+"</h6><h2>"+caption+"</h2><div class='name-divide'></div><data class='date timeago' title='"+data.data[i].created_time+"' value=''>"+data.data[i].created_time+"</data></div><img class='instagram-image' src='" + data.data[i].images.low_resolution.url +"' /></div></li>"); 2874 } 2875 } 2876 jQuery("data.timeago").timeago(); 2877 SWIFT.blog.blogGridResize(); 2878 instagrams.imagesLoaded(function(){ 2879 gridItems.isotope('insert', jQuery(instagrams.html())); 2880 SWIFT.blog.blogGridResize(); 2881 }); 2882 gridItems.isotope('updateSortData').isotope(); 2883 } 2884 }); 2885 }, 2886 infiniteScroll: function() { 2887 if (!(IEVersion && IEVersion < 9)) { 2888 var infScrollData = jQuery('#inf-scroll-params'); 2889 var infiniteScroll = { 2890 loading: { 2891 img: infScrollData.data('loadingimage'), 2892 msgText: infScrollData.data('msgtext'), 2893 finishedMsg: infScrollData.data('finishedmsg') 2894 }, 2895 "nextSelector":".pagenavi li.next a", 2896 "navSelector":".pagenavi", 2897 "itemSelector":".blog-item", 2898 "contentSelector":".blog-items" 2899 }; 2900 jQuery( infiniteScroll.contentSelector ).infinitescroll( 2901 infiniteScroll, function(elements) { 2902 SWIFT.flexSlider.thumb(); 2903 //blogItems.fitVids(); 2904 blogItems.imagesLoaded(function () { 2905 blogItems.isotope( 'appended', elements ); 2906 jQuery.each(elements, function(i, element) { 2907 jQuery(element).addClass('item-animated'); 2908 }); 2909 }); 2910 SWIFT.blog.blogShowFilters(); 2911 if (blogItems.parent().find('.pagination-wrap').hasClass('load-more')) { 2912 jQuery('.load-more-btn').animate({ 2913 'opacity': 1 2914 }, 400); 2915 } 2916 } 2917 ); 2918 if (blogItems.parent().find('.pagination-wrap').hasClass('load-more')) { 2919 $window.unbind('.infscr'); 2920 jQuery('.load-more-btn').on('click', function(e) { 2921 e.preventDefault(); 2922 jQuery( infiniteScroll.contentSelector ).infinitescroll('retrieve'); 2923 jQuery('.load-more-btn').animate({ 2924 'opacity': 0 2925 }, 400); 2926 }); 2927 } 2928 } else { 2929 jQuery('.pagination-wrap').removeClass('hidden'); 2930 } 2931 } 2932 }; 2933 2934 ///////////////////////////////////////////// 2935 // GALLERIES 2936 ///////////////////////////////////////////// 2937 2938 var galleriesContainer = jQuery('.galleries-wrap').find('.filterable-items'); 2939 2940 SWIFT.galleries = { 2941 init: function() { 2942 galleriesContainer.each(function() { 2943 var galleriesInstance = jQuery(this); 2944 if (galleriesInstance.hasClass('masonry-items')) { 2945 SWIFT.galleries.masonrySetup(galleriesInstance); 2946 } else { 2947 SWIFT.galleries.standardSetup(galleriesInstance); 2948 } 2949 }); 2950 2951 // PORTFOLIO WINDOW RESIZE 2952 $window.smartresize( function() { 2953 SWIFT.galleries.windowResized(); 2954 }); 2955 2956 // Enable filter options on when there are items from that skill 2957 jQuery('.filtering li').each( function() { 2958 var filter = jQuery(this), 2959 filterName = jQuery(this).find('a').attr('class'), 2960 galleryItems = jQuery(this).parents('.galleries-wrap').find('.filterable-items'); 2961 2962 galleryItems.find('.gallery-item').each( function() { 2963 if ( jQuery(this).hasClass(filterName) ) { 2964 filter.addClass('has-items'); 2965 } 2966 }); 2967 }).parents('.filtering').animate({ 2968 opacity: 1 2969 }, 400); 2970 2971 // filter items when filter link is clicked 2972 jQuery('.filtering li').on('click', 'a', function(e) { 2973 e.preventDefault(); 2974 jQuery(this).parent().parent().find('li').removeClass('selected'); 2975 jQuery(this).parent().addClass('selected'); 2976 var selector = jQuery(this).data('filter'); 2977 var galleryItems = jQuery(this).parents('.galleries-wrap').find('.filterable-items'); 2978 galleryItems.isotope({ filter: selector }); 2979 }); 2980 }, 2981 standardSetup: function(galleryInstance) { 2982 galleryInstance.imagesLoaded(function () { 2983 SWIFT.galleries.setItemHeight(); 2984 galleryInstance.animate({opacity: 1}, 800); 2985 galleryInstance.isotope({ 2986 resizable: true, 2987 layoutMode: 'fitRows', 2988 isOriginLeft: !isRTL 2989 }); 2990 });
2991 galleryInstance.appear(function() { 2992 SWIFT.galleries.animateItems(galleryInstance); 2993 }); 2994 }, 2995 masonrySetup: function(galleryInstance) { 2996 galleryInstance.imagesLoaded(function () { 2997 galleryInstance.isotope({ 2998 resizable: false, 2999 itemSelector : '.gallery-item', 3000 layoutMode: 'masonry', 3001 isOriginLeft: !isRTL 3002 }); 3003 }); 3004 galleryInstance.appear(function() { 3005 SWIFT.galleries.animateItems(galleryInstance); 3006 }); 3007 }, 3008 animateItems: function(galleryInstance) { 3009 galleryInstance.find('.gallery-item').each(function(i) { 3010 jQuery(this).delay(i*200).animate({ 3011 'opacity' : 1 3012 }, 800, 'easeOutExpo', function() { 3013 jQuery(this).addClass('item-animated'); 3014 }); 3015 }); 3016 }, 3017 setItemHeight: function() { 3018 if (!galleriesContainer.hasClass('col-1') && !galleriesContainer.hasClass('masonry-items')) { 3019 galleriesContainer.children().css('min-height','0'); 3020 galleriesContainer.equalHeights(); 3021 } 3022 }, 3023 windowResized: function() { 3024 if (!galleriesContainer.hasClass('col-1') && !galleriesContainer.hasClass('masonry-items')) { 3025 SWIFT.galleries.setItemHeight(); 3026 } 3027 }, 3028 }; 3029 3030 3031 ///////////////////////////////////////////// 3032 // GALLERY 3033 ///////////////////////////////////////////// 3034 3035 SWIFT.gallery = { 3036 init: function() { 3037 3038 jQuery('.spb_gallery_widget').each(function() { 3039 if (jQuery(this).hasClass('gallery-masonry')) { 3040 SWIFT.gallery.galleryMasonry(jQuery(this).find('.filterable-items')); 3041 } else if (jQuery(this).hasClass('gallery-slider')) { 3042 SWIFT.gallery.gallerySlider(jQuery(this)); 3043 } 3044 }); 3045 }, 3046 galleryMasonry: function(element) { 3047 element.imagesLoaded(function () { 3048 element.isotope({ 3049 resizable: false, 3050 itemSelector : '.gallery-image', 3051 layoutMode: 'masonry', 3052 isOriginLeft: !isRTL 3053 }); 3054 }); 3055 element.appear(function() { 3056 SWIFT.gallery.animateItems(element); 3057 }); 3058 }, 3059 animateItems: function(element) { 3060 element.find('.gallery-image').each(function(i) { 3061 jQuery(this).delay(i*200).animate({ 3062 'opacity' : 1 3063 }, 800, 'easeOutExpo', function() { 3064 jQuery(this).addClass('item-animated'); 3065 }); 3066 }); 3067 }, 3068 gallerySlider: function(element) { 3069 3070 var gallerySlider = element.find('.gallery-slider'), 3071 galleryNav = element.find('.gallery-nav'), 3072 galleryAuto = gallerySlider.data('autoplay'); 3073 3074 if (galleryAuto === "yes") { 3075 galleryAuto = true; 3076 } else { 3077 galleryAuto = false; 3078 } 3079 3080 galleryNav.flexslider({ 3081 animation: "slide", 3082 directionNav: true, 3083 controlNav: false, 3084 animationLoop: false, 3085 slideshow: false, 3086 itemWidth: 100, 3087 itemMargin: 30, 3088 rtl: isRTL, 3089 asNavFor: gallerySlider 3090 }); 3091 3092 gallerySlider.flexslider({ 3093 animation: gallerySlider.data('transition'), 3094 slideshow: galleryAuto, 3095 slideshowSpeed: sliderSlideSpeed, //Integer: Set the speed of the slideshow cycling, in milliseconds 3096 animationDuration: sliderAnimSpeed, //Integer: Set the speed of animations, in milliseconds 3097 controlNav: false, 3098 animationLoop: false, 3099 smoothHeight: true, 3100 rtl: isRTL, 3101 sync: galleryNav, 3102 start: function() { 3103 if ( galleryAuto ) { 3104 gallerySlider.appear(function() { 3105 gallerySlider.flexslider('play'); 3106 }); 3107 } 3108 } 3109 }); 3110 3111 } 3112 }; 3113 3114 3115 ///////////////////////////////////////////// 3116 // RECENT POSTS 3117 ///////////////////////////////////////////// 3118 3119 SWIFT.recentPosts = { 3120 init: function() { 3121 3122 // TEAM EQUAL HEIGHTS 3123 var recentPostAsset = jQuery('.recent-posts:not(.carousel-items,.posts-type-list)'); 3124 recentPostAsset.imagesLoaded(function () { 3125 SWIFT.flexSlider.thumb(); 3126 recentPostAsset.equalHeights(); 3127 }); 3128 3129 // TEAM ASSETS 3130 $window.smartresize( function() { 3131 if (jQuery().equalHeights) { 3132 jQuery('.recent-posts:not(.carousel-items,.posts-type-list)').children().css('min-height','0'); 3133 jQuery('.recent-posts:not(.carousel-items,.posts-type-list)').equalHeights(); 3134 } 3135 }); 3136 } 3137 }; 3138 3139 3140 ///////////////////////////////////////////// 3141 // CAROUSEL FUNCTIONS 3142 ///////////////////////////////////////////// 3143 3144 SWIFT.carouselWidgets = { 3145 init: function() { 3146 3147 // CAROUSELS 3148 var carousel = jQuery('.carousel-items'), 3149 carouselAuto = sfOptionParams.data('carousel-autoplay'), 3150 carouselPSpeed = sfOptionParams.data('carousel-pagespeed'), 3151 carouselSSpeed = sfOptionParams.data('carousel-slidespeed'), 3152 carouselPagination = sfOptionParams.data('carousel-pagination'), 3153 carouselPDirection = 'ltr', 3154 desktopWidth = 1199; 3155 3156 if (body.hasClass('vertical-header')) { 3157 desktopWidth = desktopWidth + jQuery('#header-section').width(); 3158 } 3159 3160 if (carouselAuto) { 3161 carouselAuto = true; 3162 } else { 3163 carouselAuto = false;
3164 } 3165 if (carouselPagination) { 3166 carouselPagination = true; 3167 } else { 3168 carouselPagination = false; 3169 } 3170 if (isRTL) { 3171 carouselPDirection = 'rtl'; 3172 } 3173 3174 carousel.each(function() { 3175 var carouselInstance = jQuery('#'+jQuery(this).attr('id')), 3176 carouselColumns = parseInt(carouselInstance.attr("data-columns"), 10), 3177 desktopCarouselItems = 4 > carouselColumns ? carouselColumns : 4, 3178 desktopSmallCarouselItems = 3 > carouselColumns ? carouselColumns : 3, 3179 mobileCarouselItems = 1; 3180 3181 if (carouselInstance.hasClass('clients-items')) { 3182 mobileCarouselItems = 2; 3183 } 3184 if (carouselInstance.hasClass('testimonials')) { 3185 desktopCarouselItems = 1; 3186 desktopSmallCarouselItems = 1; 3187 mobileCarouselItems = 1; 3188 } 3189 3190 carouselInstance.imagesLoaded(function () { 3191 3192 if (!carouselInstance.hasClass('no-gutters')) { 3193 var carouselWidth = carouselInstance.width(); 3194 if (isRTL) { 3195 carouselInstance.css('margin-right', '-15px').css('width', carouselWidth + 30); 3196 } else { 3197 carouselInstance.css('margin-left', '-15px').css('width', carouselWidth + 30); 3198 } 3199 } 3200 3201 carouselInstance.owlCarousel({ 3202 items : carouselColumns, 3203 itemsDesktop: [desktopWidth,desktopCarouselItems], 3204 itemsDesktopSmall: [desktopWidth-220,desktopSmallCarouselItems], 3205 itemsMobile: [479,mobileCarouselItems], 3206 paginationSpeed: carouselPSpeed, 3207 slideSpeed: carouselSSpeed, 3208 autoPlay: carouselAuto, 3209 autoPlayDirection : carouselPDirection, 3210 pagination: carouselPagination, 3211 autoHeight : true, 3212 beforeUpdate: function() { 3213 if (!carouselInstance.hasClass('no-gutters')) { 3214 carouselInstance.css('width', ''); 3215 var carouselWidth = carouselInstance.width(); 3216 carouselInstance.css('width', carouselWidth + 30); 3217 } 3218 }, 3219 afterUpdate: function () { 3220 carouselInstance.find('.flex-active-slide').resize(); 3221 }, 3222 afterInit: function() { 3223 SWIFT.flexSlider.thumb(); 3224 carouselInstance.find('.flex-active-slide').resize(); 3225 carouselInstance.find('.owl-wrapper-outer').css('height', carouselInstance.find('.owl-wrapper').height()); 3226 } 3227 }).animate({ 3228 'opacity': 1 3229 },800); 3230 }); 3231 }); 3232 3233 // Previous 3234 jQuery('.carousel-next').click( function(e) { 3235 e.preventDefault(); 3236 var carousel = jQuery(this).closest('.spb_content_element').find('.owl-carousel'); 3237 if (isRTL) { 3238 carousel.data( 'owlCarousel' ).prev(); 3239 } else { 3240 carousel.data( 'owlCarousel' ).next(); 3241 } 3242 }); 3243 3244 // Next 3245 jQuery('.carousel-prev').click( function(e) { 3246 e.preventDefault(); 3247 var carousel = jQuery(this).closest('.spb_content_element').find('.owl-carousel'); 3248 if (isRTL) { 3249 carousel.data( 'owlCarousel' ).next(); 3250 } else { 3251 carousel.data( 'owlCarousel' ).prev(); 3252 } 3253 }); 3254 }, 3255 carouselSwipeIndicator: function(carousel) { 3256 carousel.appear(function() { 3257 var swipeIndicator = jQuery(this).parents('.carousel-wrap').find('.sf-swipe-indicator'); 3258 setTimeout(function() { 3259 swipeIndicator.fadeIn(500); 3260 }, 400); 3261 setTimeout(function() { 3262 swipeIndicator.addClass('animate'); 3263 }, 1000); 3264 setTimeout(function() { 3265 swipeIndicator.fadeOut(400); 3266 }, 3000); 3267 }); 3268 }, 3269 carouselMinHeight: function(carousel) { 3270 var minHeight = parseInt(carousel.find('.carousel-item:not(.no-thumb)').eq(0).css('height')); 3271 carousel.find('.owl-item').each(function () { 3272 jQuery(this).css('min-height',minHeight+'px'); 3273 }); 3274 } 3275 }; 3276 3277 3278 ///////////////////////////////////////////// 3279 // WIDGET FUNCTIONS 3280 ///////////////////////////////////////////// 3281 3282 SWIFT.widgets = { 3283 init: function() { 3284 3285 // LOAD WIDGETS 3286 SWIFT.widgets.accordion(); 3287 SWIFT.widgets.toggle(); 3288 SWIFT.widgets.fullWidthVideo(); 3289 SWIFT.widgets.introAnimations(); 3290 SWIFT.widgets.iconBoxes(); 3291 3292 // SF TOOLTIPS 3293 if (jQuery('[rel=tooltip]').length > 0) { 3294 jQuery('[rel=tooltip]').tooltip(); 3295 } 3296 3297 // DYNAMIC TABS 3298 jQuery('.tabs-type-dynamic .menu-icon').hover(function() { 3299 jQuery(this).parents('.nav-tabs').addClass('show-tabs'); 3300 }); 3301 3302 jQuery('.tabs-type-dynamic').mouseleave(function() { 3303 jQuery(this).find('.nav-tabs').removeClass('show-tabs'); 3304 }); 3305 3306 jQuery('ul.nav-tabs li a, .spb_accordion_section > h3 a').on('click', '', function(){ 3307 var thisTab = jQuery(this), 3308 asset = thisTab.parents('.spb_content_element').first(); 3309 3310 setTimeout(function() { 3311 $window.trigger('resize');
3312 if (asset.find('.map-canvas').length > 0) { 3313 var map = asset.find('.map-canvas'); 3314 map.each(function() { 3315 google.maps.event.trigger(jQuery(this), "resize"); 3316 }); 3317 } 3318 }, 300); 3319 }); 3320 3321 }, 3322 accordion: function() { 3323 jQuery('.spb_accordion').each(function() { 3324 var spb_tabs, 3325 active_tab = false, 3326 active_attr = parseInt(jQuery(this).attr('data-active'), 10); 3327 3328 if (jQuery.type( active_attr ) === "number") { active_tab = active_attr; } 3329 3330 spb_tabs = jQuery(this).find('.spb_accordion_wrapper').accordion({ 3331 header: "> div > h4", 3332 autoHeight: true, 3333 collapsible: true, 3334 active: active_tab, 3335 heightStyle: "content" 3336 }); 3337 }).css('opacity', 1); 3338 }, 3339 tabs: function() { 3340 // SET ACTIVE TABS PANE 3341 setTimeout(function() { 3342 jQuery('.spb_tabs').each(function() { 3343 jQuery(this).find('.tab-pane').first().addClass('active'); 3344 jQuery(this).find('.tab-pane').removeClass('load'); 3345 }); 3346 }, 200); 3347 3348 // SET ACTIVE TOUR PANE 3349 setTimeout(function() { 3350 jQuery('.spb_tour').each(function() { 3351 jQuery(this).find('.tab-pane').first().addClass('active'); 3352 jQuery(this).find('.tab-pane').removeClass('load'); 3353 }); 3354 }, 200); 3355 3356 // RESET MAPS ON TAB CLICK 3357 jQuery('ul.nav-tabs li a, .spb_accordion_section > h4 a').on('click', '', function(){ 3358 var thisTab = jQuery(this), 3359 asset = thisTab.parents('.spb_content_element').first(); 3360 3361 if (asset.find('.map-canvas').length > 0) { 3362 setTimeout(function() { 3363 jQuery(window).trigger('resize'); 3364 var map = asset.find('.map-canvas'); 3365 SWIFT.map.init(); 3366 }, 100); 3367 } 3368 }); 3369 3370 // SET DESIRED TAB ON LOAD 3371 setTimeout(function() { 3372 if (jQuery('.spb_tabs').length > 0) { 3373 3374 // Show correct tab on page load 3375 var tabUrl = document.location.toString(); 3376 if (tabUrl.match('#') && jQuery('.nav-tabs a[href="#'+tabUrl.split('#')[1]+'"]').length > 0) { 3377 var thisTab = jQuery('.nav-tabs a[href="#'+tabUrl.split('#')[1]+']"'), 3378 tabHash = tabUrl.split('#')[1]; 3379 3380 jQuery('.nav-tabs a[href="#'+tabHash+'"]').tab('show'); 3381 } 3382 3383 // Change hash on tab click 3384 jQuery('.nav-tabs a').click(function (e) { 3385 var hash = e.target.hash; 3386 3387 if (history.pushState) { 3388 history.pushState(null, null, hash); 3389 } else { 3390 location.hash = hash; 3391 } 3392 }); 3393 } 3394 if (jQuery('.spb_accordion').length > 0) { 3395 3396 // Show correct accordion section on page load 3397 var accordionUrl = document.location.toString(); 3398 if (accordionUrl.match('#') && jQuery('.spb_accordion a[href="#'+accordionUrl.split('#')[1]+'"]').length > 0) { 3399 var thisAccordion = jQuery('.spb_accordion a[href="#'+accordionUrl.split('#')[1]+'"]'), 3400 accordionHash = accordionUrl.split('#')[1]; 3401 3402 jQuery('.spb_accordion a[href="#'+accordionHash+'"]').click(); 3403 } 3404 3405 // Change hash on tab click 3406 jQuery('.spb_accordion a').click(function (e) { 3407 var hash = e.target.hash; 3408 3409 if (history.pushState) { 3410 history.pushState(null, null, hash); 3411 } else { 3412 location.hash = hash; 3413 } 3414 }); 3415 } 3416 3417 if (jQuery('.spb_tour').length > 0) { 3418 3419 // Show correct accordion section on page load 3420 var tourUrl = document.location.toString(); 3421 if (tourUrl.match('#') && jQuery('.spb_tour a[href="#'+tourUrl.split('#')[1]+'"]').length > 0) { 3422 var thisTour = jQuery('.spb_tour a[href="#'+tourUrl.split('#')[1]+'"]'), 3423 tourHash = tourUrl.split('#')[1]; 3424 3425 jQuery('.spb_tour a[href="#'+tourHash+'"]').click(); 3426 } 3427 3428 // Change hash on tab click 3429 jQuery('.spb_tour a').click(function (e) { 3430 var hash = e.target.hash; 3431 3432 if ( history.pushState ) { 3433 history.pushState(null, null, hash); 3434 } else { 3435 location.hash = hash; 3436 } 3437 }); 3438 } 3439 3440 }, 220); 3441 }, 3442 toggle: function() { 3443 jQuery('.spb_toggle').click(function() { 3444 if ( jQuery(this).hasClass('spb_toggle_title_active') ) { 3445 jQuery(this).removeClass('spb_toggle_title_active').next().slideUp(500); 3446 } else { 3447 jQuery(this).addClass('spb_toggle_title_active').next().slideDown(500); 3448 } 3449 }); 3450 jQuery('.spb_toggle_content').each(function() { 3451 if ( jQuery(this).next().is('h4.spb_toggle') === false ) { 3452 jQuery('<div class="last_toggle_el_margin"></div>').insertAfter(this); 3453 } 3454 }); 3455 }, 3456 initSkillBars: function() { 3457 // SKILL BARS 3458 SWIFT.widgets.animateSkillBars(); 3459 jQuery('a.ui-tabs-anchor').click(function(){ 3460 SWIFT.widgets.animateSkillBars(); 3461 }); 3462 }, 3463 animateSkillBars: function() { 3464 jQuery('.progress:not(.animated)').each(function(){ 3465 var progress = jQuery(this); 3466 3467 progress.appear(function() { 3468 var progressBar = jQuery(this), 3469 progressValue = progressBar.find('.bar').data('value'); 3470 progressBar.addClass('animated'); 3471 progressBar.find('.bar').animate({ 3472 width: progressValue + "%" 3473 }, 800, function() { 3474 progressBar.parent().find('.bar-text').css('width', progressValue + "%"); 3475 progressBar.parent().find('.bar-text .progress-value').fadeIn(600); 3476 }); 3477 }); 3478 }); 3479 }, 3480 fullWidthVideo: function() { 3481 body.on('click', '.fw-video-link', function(){ 3482 if (jQuery(this).data('video') !== "") { 3483 SWIFT.widgets.openFullWidthVideo(jQuery(this)); 3484 } 3485 return false;
3486 }); 3487 3488 body.on('click', '.fw-video-close', function(){ 3489 SWIFT.widgets.closeFullWidthVideo(); 3490 }); 3491 }, 3492 openFullWidthVideo: function(element) { 3493 jQuery('.fw-video-close').addClass('is-open'); 3494 jQuery('.fw-video-spacer').animate({ 3495 height: windowheight 3496 }, 1000, 'easeInOutExpo'); 3497 3498 jQuery('.fw-video-area').css('display', 'block').animate({ 3499 top: 0, 3500 height: '100%' 3501 }, 1000, 'easeInOutExpo', function() { 3502 // load video here 3503 jQuery('.fw-video-area > .fw-video-wrap').append('<iframe class="fw-video" src="'+element.data('video')+'" width="100%" height="100%" frameborder="0" mozallowfullscreen webkitallowfullscreen allowfullscreen></iframe>'); 3504 }); 3505 }, 3506 closeFullWidthVideo: function() { 3507 jQuery('.fw-video-close').removeClass('is-open'); 3508 jQuery('.fw-video-spacer').animate({ 3509 height: 0 3510 }, 1000, 'easeInOutExpo', function(){ 3511 }); 3512 jQuery('.fw-video-area').animate({ 3513 top:'-100%' 3514 }, 1000, 'easeInOutExpo', function() { 3515 jQuery('.fw-video-area').css('display', 'none'); 3516 jQuery('.fw-video-area .fw-video').remove(); 3517 }); 3518 3519 // pause videos 3520 jQuery('.fw-video-area video').each(function(){ 3521 this.pause(); 3522 }); 3523 setTimeout(function() { 3524 jQuery('.fw-video-area').find('iframe').remove(); 3525 }, 1500); 3526 3527 return false; 3528 }, 3529 introAnimations: function() { 3530 if ( !(isMobileAlt && body.hasClass('disable-mobile-animations')) ) { 3531 jQuery('.sf-animation').each(function() { 3532 var animatedItem = jQuery(this); 3533 animatedItem.waypoint(function(direction) { 3534 var itemAnimation = animatedItem.data('animation'), 3535 itemDelay = animatedItem.data('delay'); 3536 3537 setTimeout(function() { 3538 window.requestAnimationFrame( function() { 3539 animatedItem.addClass(itemAnimation); 3540 setTimeout(function() { 3541 animatedItem.addClass('sf-animate'); 3542 }, 100); 3543 }); 3544 }, itemDelay); 3545 }, { 3546 offset: '90%', 3547 triggerOnce: true 3548 }); 3549 }); 3550 } 3551 }, 3552 animateItem: function(animatedItem) { 3553 var itemAnimation = animatedItem.data('animation'), 3554 itemDelay = animatedItem.data('delay'); 3555 3556 setTimeout(function() { 3557 animatedItem.addClass(itemAnimation + ' sf-animate'); 3558 }, itemDelay); 3559 }, 3560 iconBoxes: function() { 3561 if (isMobileAlt) { 3562 jQuery('.sf-icon-box').on('click', function() { 3563 jQuery(this).addClass('sf-mobile-hover'); 3564 }); 3565 } else { 3566 jQuery('.sf-icon-box').hover( 3567 function() { 3568 jQuery(this).addClass('sf-hover'); 3569 }, function() { 3570 jQuery(this).removeClass('sf-hover'); 3571 } 3572 ); 3573 } 3574 } 3575 }; 3576 3577 3578 ///////////////////////////////////////////// 3579 // TEAM MEMBERS FUNCTION 3580 ///////////////////////////////////////////// 3581 3582 SWIFT.teamMembers = { 3583 init: function() { 3584 // TEAM EQUAL HEIGHTS 3585 var team = jQuery('.team-members:not(.carousel-items)'); 3586 team.imagesLoaded(function () { 3587 if ($window.width() > 767) { 3588 team.equalHeights(); 3589 } 3590 }); 3591 3592 // TEAM ASSETS 3593 $window.smartresize( function() { 3594 if (jQuery().equalHeights) { 3595 jQuery('.team-members:not(.carousel-items)').children().css('min-height','0'); 3596 if ($window.width() > 767) { 3597 jQuery('.team-members:not(.carousel-items)').equalHeights(); 3598 } 3599 } 3600 }); 3601 } 3602 }; 3603 3604 ///////////////////////////////////////////// 3605 // RELATED POSTS FUNCTION 3606 ///////////////////////////////////////////// 3607 3608 SWIFT.relatedPosts = { 3609 init: function() { 3610 // TEAM EQUAL HEIGHTS 3611 var relatedItems = jQuery('.related-items'); 3612 relatedItems.imagesLoaded(function () { 3613 if ($window.width() > 767) { 3614 relatedItems.equalHeights(); 3615 } 3616 }); 3617 3618 // TEAM ASSETS 3619 $window.smartresize( function() { 3620 if (jQuery().equalHeights) { 3621 jQuery('.related-items').children().css('min-height','0'); 3622 if ($window.width() > 767) { 3623 jQuery('.related-items').equalHeights(); 3624 } 3625 } 3626 }); 3627 } 3628 }; 3629 3630 3631 ///////////////////////////////////////////// 3632 // MAP FUNCTIONS 3633 ///////////////////////////////////////////// 3634 3635 var infowindow, bounds, directory_bounds, mapTypeIdentifier = "", mapType, mapColor, mapSaturation, mapCenterLat, mapCenterLng, companyPos = "", isDraggable = true, latitude, longitude, mapCoordinates, markersArray = []; 3636 3637 3638 SWIFT.map = { 3639 init:function() { 3640 3641 var maps = jQuery('.map-canvas'); 3642 var mapContainer; 3643 3644 if (typeof google !== 'undefined') { 3645 bounds = new google.maps.LatLngBounds(); 3646 } 3647 3648 maps.each(function(i, element) { 3649 mapContainer = element; 3650 var mapZoom = mapContainer.getAttribute('data-zoom'); 3651 3652 mapType = mapContainer.getAttribute('data-maptype'); 3653 mapColor = mapContainer.getAttribute('data-mapcolor'); 3654 mapCenterLat = mapContainer.getAttribute('data-center-lat'); 3655 mapCenterLng = mapContainer.getAttribute('data-center-lng'); 3656 mapSaturation = mapContainer.getAttribute('data-mapsaturation'); 3657 3658 SWIFT.map.createMap( mapContainer, mapZoom, mapType, mapColor, mapSaturation, jQuery(this), mapCenterLat, mapCenterLng ); 3659 }); 3660 3661 }, 3662 getLatLong: function(address, fn) { 3663 var geocoder; 3664 geocoder = new google.maps.Geocoder(); 3665 geocoder.geocode( { 'address': address}, function(results, status) { 3666 fn(results[0].geometry.location, results[0].geometry.location.lat(), results[0].geometry.location.lng()); 3667 }); 3668 }, 3669 addWinContent: function(marker, html, map) { 3670 google.maps.event.addListener(marker, 'click', function() { 3671 infowindow.setContent(html); 3672 infowindow.open(map, marker); 3673 }); 3674 }, 3675 addMarker: function(mapInstance, pinLogoURL, pinTitle, pinContent, pinLink, address, pinButtonText) { 3676 var companyMarker; 3677 3678 mapCoordinates = new google.maps.LatLng(latitude, longitude); 3679 3680 if (pinLogoURL) { 3681 companyPos = new google.maps.LatLng(latitude, longitude); 3682 companyMarker = new google.maps.Marker({ 3683 position: mapCoordinates, 3684 map: mapInstance, 3685 icon: pinLogoURL, 3686 animation: google.maps.Animation.DROP }); 3687 } else { 3688 companyPos = new google.maps.LatLng(latitude, longitude); 3689 companyMarker = new google.maps.Marker({ 3690 position: mapCoordinates, 3691 map: mapInstance, 3692 animation: google.maps.Animation.DROP }); 3693 } 3694 3695 var html = '<div class="pinmarker">'; 3696 if (pinTitle !== "") { 3697 html += '<h3>'+pinTitle+'</h3>'; 3698 } 3699 if (pinContent !== "") { 3700 html += '<p>'+pinContent+' </p>'; 3701 } 3702 if (pinLink !== "" && pinButtonText !== "") { 3703 html += '<div><a href="' + pinLink + '" target="_blank">'+pinButtonText+'</a></div>'; 3704 } 3705 html += '</div>'; 3706 3707 infowindow = new google.maps.InfoWindow(); 3708 SWIFT.map.addWinContent(companyMarker, html, mapInstance); 3709 bounds.extend(mapCoordinates); 3710 }, 3711 createMap: function(mapContainer, mapZoom, mapType, mapColor, mapSaturation, targetMap, mapCenterLat, mapCenterLng) { 3712 3713 if (google) { 3714 directory_bounds = new google.maps.LatLngBounds(); 3715 } 3716 3717 var pinLogoURL = "", mapLightness = false;
3718 3719 if (mapSaturation == "mono-light") { 3720 if (mapColor === "") { 3721 mapColor = "#ffffff"; 3722 } 3723 mapSaturation = -100; 3724 } else if (mapSaturation == "mono-dark") { 3725 if (mapColor === "") { 3726 mapColor = "#222222"; 3727 } 3728 mapSaturation = -100; 3729 mapLightness = true; 3730 } else { 3731 mapSaturation = -20; 3732 } 3733 3734 var styles = [ 3735 { 3736 stylers: [ 3737 {hue: mapColor}, 3738 {"invert_lightness": mapLightness}, 3739 {saturation: mapSaturation} 3740 ] 3741 } 3742 ]; 3743 3744 var styledMap = new google.maps.StyledMapType(styles,{name: "Styled Map"}); 3745 3746 if (isMobileAlt) { 3747 isDraggable = false; 3748 } 3749 3750 if (mapType === "satellite") { 3751 mapTypeIdentifier = google.maps.MapTypeId.SATELLITE; 3752 } else if (mapType === "terrain") { 3753 mapTypeIdentifier = google.maps.MapTypeId.TERRAIN; 3754 } else if (mapType === "hybrid") { 3755 mapTypeIdentifier = google.maps.MapTypeId.HYBRID; 3756 } else { 3757 mapTypeIdentifier = google.maps.MapTypeId.ROADMAP; 3758 } 3759 3760 var settings = { 3761 scrollwheel: false, 3762 draggable: isDraggable, 3763 mapTypeControl: true, 3764 mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, 3765 navigationControl: true, 3766 navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, 3767 mapTypeId: mapTypeIdentifier 3768 }; 3769 3770 var mapInstance = new google.maps.Map(mapContainer, settings); 3771 var pinTitle, pinContent, pinLink, address, pinButtonText; 3772 var pincount = targetMap.parent().find('.pin_location').length; 3773 3774 //Resize Window Responsiveness 3775 google.maps.event.addDomListener(window, 'resize', function() { 3776 //mapInstance.fitBounds(bounds); 3777 mapInstance.setZoom(mapInstance.getZoom()); 3778 }); 3779 3780 bounds = new google.maps.LatLngBounds(); 3781 targetMap.parent().find('.pin_location').each(function(i, element) { 3782 3783 pinLogoURL = element.getAttribute('data-pinimage'); 3784 pinTitle = element.getAttribute('data-title'); 3785 pinContent = element.getAttribute('data-content'); 3786 address = element.getAttribute('data-address'); 3787 pinLink = element.getAttribute('data-pinlink'); 3788 latitude = element.getAttribute('data-lat'); 3789 longitude = element.getAttribute('data-lng'); 3790 pinButtonText = element.getAttribute('data-button-text'); 3791 3792 3793 if (latitude === '' && longitude === '') { 3794 3795 SWIFT.map.getLatLong(address, function(location, lati,longi ) { 3796 3797 latitude = lati; 3798 longitude = longi; 3799 SWIFT.map.addMarker(mapInstance, pinLogoURL, pinTitle, pinContent, pinLink, address, pinButtonText); 3800 3801 if ( pincount > 1 ) { 3802 if(mapCenterLat !== '' && mapCenterLng !== ''){ 3803 mapInstance.setZoom(parseInt(mapZoom, 10)); 3804 mapInstance.setCenter(new google.maps.LatLng(mapCenterLat, mapCenterLng)); 3805 }else{ 3806 mapInstance.fitBounds(bounds); 3807 } 3808 } else { 3809 mapInstance.setZoom(parseInt(mapZoom, 10)); 3810 mapInstance.setCenter(new google.maps.LatLng(latitude, longitude)); 3811 } 3812 3813 }); 3814 3815 } else { 3816 3817 SWIFT.map.addMarker(mapInstance, pinLogoURL, pinTitle, pinContent, pinLink, address, pinButtonText); 3818 3819 if ( pincount > 1 ) { 3820 if(mapCenterLat !== '' && mapCenterLng !== ''){ 3821 mapInstance.setZoom(parseInt(mapZoom, 10)); 3822 mapInstance.setCenter(new google.maps.LatLng(mapCenterLat, mapCenterLng)); 3823 }else{ 3824 mapInstance.fitBounds(bounds); 3825 } 3826 } else { 3827 mapInstance.setZoom(parseInt(mapZoom, 10)); 3828 mapInstance.setCenter(new google.maps.LatLng(latitude, longitude)); 3829 } 3830 3831 } 3832 3833 }); 3834 3835 3836 // MAP COLOURIZE 3837 if (mapColor !== "") { 3838 mapInstance.mapTypes.set('map_style', styledMap); 3839 mapInstance.setMapTypeId('map_style'); 3840 } 3841 3842 var listener = google.maps.event.addListener(mapInstance, "idle", function() { 3843 mapInstance.setZoom(parseInt( mapInstance.getZoom(), 10)); 3844 google.maps.event.removeListener(listener); 3845 }); 3846 3847 } 3848 }; 3849 3850 3851 3852 ///////////////////////////////////////////// 3853 // MAP DIRECTORY FUNCTIONS 3854 ///////////////////////////////////////////// 3855 3856 SWIFT.mapDirectory = { 3857 init : function(searchTerm, locationFilter, categoryFilter) { 3858 3859 searchTerm = jQuery('#dir-search-value').val(); 3860 locationFilter = jQuery('.directory-location-option').val(); 3861 categoryFilter = jQuery('.directory-category-option').val(); 3862 3863 var mapsDirectory = jQuery('.map-directory-canvas'); 3864 var mapDirContainer, mapZoom; 3865 3866 mapsDirectory.each(function(i, element) { 3867 3868 var mapDirContainer = element, 3869 mapZoom = mapDirContainer.getAttribute('data-zoom'), 3870 mapType = mapDirContainer.getAttribute('data-maptype'), 3871 mapColor = mapDirContainer.getAttribute('data-mapcolor'), 3872 mapSaturation = mapDirContainer.getAttribute('data-mapsaturation'), 3873 mapExcerpt = mapDirContainer.getAttribute('data-excerpt'); 3874 3875 if ( categoryFilter == null || categoryFilter == 'All' ){ 3876 categoryFilter = mapDirContainer.getAttribute('data-directory-category'); 3877 } 3878 3879 SWIFT.mapDirectory.directoryMap( mapDirContainer, mapZoom, mapType, mapColor, mapSaturation, jQuery(this), searchTerm, locationFilter, categoryFilter); 3880 3881 }); 3882 }, 3883 searchDirectory: function(){ 3884 SWIFT.mapDirectory.init(jQuery('#dir-search-value').val(), jQuery('.directory-location-option').val(), jQuery('.directory-category-option').val()); 3885 }, 3886 getLatLong: function(address, fn){ 3887 var geocoder; 3888 geocoder = new google.maps.Geocoder(); 3889 geocoder.geocode( { 'address': address}, function(results, status) { 3890 fn(results[0].geometry.location, results[0].geometry.location.lat(), results[0].geometry.location.lng()); 3891 }); 3892 }, 3893 addWinContent: function(marker, html, map){ 3894 markersArray.push(marker); 3895 google.maps.event.addListener(marker, 'click', function() { 3896 infowindow.setContent(html); 3897 infowindow.open(map, marker); 3898 }); 3899 }, 3900 addMarkerDir: function(mapInstance, pinLogoURL, pinTitle, pinContent, pinLink, address, pinButtonText,pinFeaturedImage, lat, lng){ 3901 var companyMarker, pinImgContainer; 3902 3903 mapCoordinates = new google.maps.LatLng(lat, lng); 3904 3905 if (pinLogoURL) { 3906 companyPos = new google.maps.LatLng(lat, lng); 3907 companyMarker = new google.maps.Marker({ 3908 position: mapCoordinates, 3909 map: mapInstance, 3910 icon: pinLogoURL, 3911 optimized: false, 3912 animation: google.maps.Animation.DROP }); 3913 } else { 3914 companyPos = new google.maps.LatLng(lat, lng); 3915 companyMarker = new google.maps.Marker({ 3916 position: mapCoordinates, 3917 map: mapInstance, 3918 animation: google.maps.Animation.DROP }); 3919 } 3920 if (pinFeaturedImage === null) { 3921 pinImgContainer = ''; 3922 } else { 3923 pinImgContainer = '<img class="info-window-img" alt="" src="'+pinFeaturedImage
3923+'" height="140" width="140"/>'; 3924 } 3925 3926 var html = ''; 3927 if (pinLink === '' || pinButtonText === '') { 3928 html = '<div class="pinmarker">'+pinImgContainer+'<div class="pinmarker-container"><h3>'+pinTitle+'</h3><div class="excerpt">'+pinContent+'</div></div></div>'; 3929 } else { 3930 html = '<div class="pinmarker">'+pinImgContainer+'<div class="pinmarker-container"><h3>'+pinTitle+'</h3><div class="excerpt">'+pinContent+'</div><a class="pin-button" href="' + pinLink + '" target="_blank">'+pinButtonText+'</a></div></div>'; 3931 } 3932 3933 3934 infowindow = new google.maps.InfoWindow(); 3935 SWIFT.mapDirectory.addWinContent(companyMarker, html, mapInstance); 3936 directory_bounds.extend(mapCoordinates); 3937 }, 3938 directoryMap: function(mapContainer, mapZoom, mapType, mapColor, mapSaturation, targetMap, searchTerm, locationFilter, categoryFilter, excerpt) { 3939 3940 var pinLogoURL = "", mapLightness = false; 3941 var mapFilter = mapContainer.getAttribute('data-directory-map-filter'); 3942 var mapFilterPos = mapContainer.getAttribute('data-directory-map-filter-pos'); 3943 var mapResults = mapContainer.getAttribute('data-directory-map-results'); 3944 var excerpt = mapContainer.getAttribute('data-excerpt'); 3945 var directoryItemHtml = ""; 3946 3947 //Only if we want to display the map 3948 if (mapResults !== 'list') { 3949 3950 if (mapSaturation == "mono-light") { 3951 if (mapColor === "") { 3952 mapColor = "#ffffff"; 3953 } 3954 mapSaturation = -100; 3955 } else if (mapSaturation == "mono-dark") { 3956 if (mapColor === "") { 3957 mapColor = "#222222"; 3958 } 3959 mapSaturation = -100; 3960 mapLightness = true; 3961 } else { 3962 mapSaturation = -20; 3963 } 3964 3965 var styles = [ 3966 { 3967 stylers: [ 3968 {hue: mapColor}, 3969 {"invert_lightness": mapLightness}, 3970 {saturation: mapSaturation} 3971 ] 3972 } 3973 ]; 3974 3975 var styledMap = new google.maps.StyledMapType(styles,{name: "Styled Map"}); 3976 3977 if (isMobileAlt) { 3978 isDraggable = false; 3979 } 3980 3981 if (mapType === "satellite") { 3982 mapTypeIdentifier = google.maps.MapTypeId.SATELLITE; 3983 } else if (mapType === "terrain") { 3984 mapTypeIdentifier = google.maps.MapTypeId.TERRAIN; 3985 } else if (mapType === "hybrid") { 3986 mapTypeIdentifier = google.maps.MapTypeImapDirContainerd.HYBRID; 3987 } else { 3988 mapTypeIdentifier = google.maps.MapTypeId.ROADMAP; 3989 } 3990 3991 3992 } else { 3993 jQuery(mapContainer).hide(); 3994 } 3995 3996 var pinTitle, pinContent, pinLink, address, pinButtonText, pinShortContent, pinThumbnail; 3997 var pincount = targetMap.parent().find('.pin_location').length; 3998 3999 directory_bounds = new google.maps.LatLngBounds(); 4000 4001 if (categoryFilter === "") { 4002 categoryFilter = mapContainer.getAttribute('data-directory-category'); 4003 } 4004 4005 //Ajax call to get the Directory Itens 4006 var data = { 4007 action: 'sf_directory', 4008 search_term: searchTerm, 4009 location_term: locationFilter, 4010 category_term: categoryFilter, 4011 item_excerpt: excerpt 4012 4013 }; 4014 4015 jQuery.post(mapContainer.getAttribute('data-ajaxurl'), data, function(response) { 4016 var json = jQuery.parseJSON(response); 4017 var mapFilterHtml; 4018 var pincount = json.results; 4019 4020 jQuery('.directory-results').hide(); 4021 4022 var settings = { 4023 scrollwheel: false, 4024 draggable: isDraggable, 4025 mapTypeControl: true, 4026 mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, 4027 navigationControl: true, 4028 navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, 4029 mapTypeId: mapTypeIdentifier 4030 }; 4031 4032 if (pincount > 0) { 4033 4034 var mapInstance = new google.maps.Map(mapContainer, settings); 4035 markersArray = []; 4036 4037 // MAP COLOURIZE 4038 if (mapColor !== "" && mapResults != 'list') { 4039 mapInstance.mapTypes.set('map_style', styledMap); 4040 mapInstance.setMapTypeId('map_style'); 4041 } 4042 4043 //Resize Window Responsiveness 4044 google.maps.event.addDomListener(window, 'resize', function() { 4045 mapInstance.fitBounds(directory_bounds); 4046 mapInstance.setZoom(parseInt(mapZoom, 10)); 4047 }); 4048 4049 var resultText = "", thumbnail_image = ''; 4050 4051 if ( pincount > 1 ) { 4052 resultText = json.results_text_1 + ' '+pincount+' '+json.results_text_2plural; 4053 } else { 4054 resultText = json.results_text_1 + ' '+pincount+' '+json.results_text_2; 4055 } 4056 jQuery(mapContainer).parent().parent().parent().find('.directory-results').prepend('<div class="results-title"><h2>'+resultText+'</h2>'); 4057 4058 } else { 4059 4060 for (var i=0; i < markersArray.length; i++) { 4061 markersArray[i].setMap(null); 4062 } 4063 4064 jQuery(mapContainer).parent().parent().parent().find('.directory-results').append('<div class="results-title"><h2>
4064'+json.errormsg+'</h2>'); 4065 4066 } 4067 4068 if (pincount > 0 && mapResults != 'list') { 4069 4070 jQuery(mapContainer).show(); 4071 jQuery('.directory-results').append(json.pagination); 4072 4073 jQuery.each(json.items, function(i, item) { 4074 4075 //Get the directory itens details 4076 var pinTitle = item.pin_title, 4077 pinLogoURL = item.pin_logo_url, 4078 pinContent = item.pin_content, 4079 pinShortContent = item.pin_short_content, 4080 address = item.pin_address, 4081 pinLink = item.pin_link, 4082 pinButtonText = item.pin_button_text, 4083 latitude = item.pin_lat, 4084 longitude = item.pin_lng, 4085 pinThumbnail = item.pin_thumbnail, 4086 categories = item.categories, 4087 location = item.location, 4088 thumbnail_image = '', 4089 result_header = true, 4090 hasThumb = false, 4091 extra_class = ''; 4092 if ( excerpt != '' ){ 4093 pinContent = pinShortContent; 4094 } 4095 4096 if (pinThumbnail && pinLink) { 4097 hasThumb = true; 4098 thumbnail_image = '<figure class="animated-overlay overlay-alt"><img itemprop="image" src="'+pinThumbnail+'" alt="'+pinTitle+'"><a href="'+pinLink+'" target="_blank" class="link-to-post"></a><div class="figcaption-wrap"></div><figcaption><div class="thumb-info"><h4>'+pinTitle+'</h4></div></figcaption></figure>'; 4099 } else if (pinThumbnail) { 4100 hasThumb = true; 4101 thumbnail_image = '<figure><img itemprop="image" src="'+pinThumbnail+'" alt="'+pinTitle+'"></figure>'; 4102 } 4103 4104 //Add the Directory List Results 4105 if (!hasThumb) { 4106 extra_class = 'no-thumb'; 4107 } 4108 4109 if ( mapResults != 'list') { 4110 4111 //Add directory item to the map 4112 console.log(pinShortContent); 4113 SWIFT.mapDirectory.addMarkerDir(mapInstance, pinLogoURL, pinTitle, pinShortContent, pinLink, address, pinButtonText,pinThumbnail, latitude, longitude); 4114 4115 if ( pincount > 1 ) { 4116 mapInstance.fitBounds(directory_bounds); 4117 } else { 4118 mapInstance.setZoom(parseInt(mapZoom, 10)); 4119 mapInstance.setCenter(new google.maps.LatLng(latitude, longitude)); 4120 } 4121 } 4122 }); 4123 } else { 4124 jQuery(mapContainer).hide(); 4125 } 4126 jQuery('.directory-results').show(); 4127 }); 4128 } 4129 }; 4130 4131 4132 ///////////////////////////////////////////// 4133 // CROWDFUNDING FUNCTIONS 4134 ///////////////////////////////////////////// 4135 4136 SWIFT.crowdfunding = { 4137 init:function() { 4138 4139 if (jQuery('#back-this-project').find('.edd_price_options').length <= 0) { 4140 jQuery('#back-this-project > h2').css('display', 'none'); 4141 } 4142 4143 if (jQuery('#back-this-project').hasClass('project-donate-only')) { 4144 jQuery('.edd_price_options').find('li').first().addClass('atcf-selected'); 4145 jQuery('.edd_price_options').find('li').first().find('input[type="radio"]').prop('checked', true); 4146 } 4147 4148 jQuery('.atcf-price-option').on('click', function() { 4149 4150 var selectedOption = jQuery(this), 4151 selectedPrice = selectedOption.data('price').substr(0, selectedOption.data('price').indexOf('-')); 4152 4153 if (selectedOption.hasClass('inactive')) { 4154 return false; 4155 } 4156 4157 if (selectedPrice && jQuery('#atcf_custom_price').val().length <= 0) { 4158 jQuery('#atcf_custom_price').val(selectedPrice); 4159 } 4160 jQuery('.atcf-price-option').find('input[type="radio"]').prop('checked', false); 4161 jQuery('.atcf-price-option').removeClass('atcf-selected'); 4162 selectedOption.find('input[type="radio"]').prop('checked', true); 4163 selectedOption.addClass('atcf-selected'); 4164 }); 4165 4166 var campaignItems = jQuery('.campaign-items:not(.carousel-items)'); 4167 campaignItems.imagesLoaded(function () { 4168 campaignItems.equalHeights(); 4169 }); 4170 4171 $window.smartresize( function() { 4172 if (jQuery().equalHeights) { 4173 jQuery('.campaign-items:not(.carousel-items)').children().css('min-height','0'); 4174 jQuery('.campaign-items:not(.carousel-items)').equalHeights(); 4175 } 4176 }); 4177 4178 } 4179 }; 4180 4181 ///////////////////////////////////////////// 4182 // RELOAD FUNCTIONS 4183 ///////////////////////////////////////////// 4184 4185 SWIFT.reloadFunctions = { 4186 init:function() { 4187 4188 // Remove title attributes from images to avoid showing on hover 4189 jQuery('img[title]').each(function() { 4190 jQuery(this).removeAttr('title'); 4191 }); 4192 4193 if (!isAppleDevice) { 4194 jQuery('embed').show(); 4195 } 4196 4197 // Animate Top Links 4198 jQuery('.animate-top').on('click', function(e) { 4199 e.preventDefault(); 4200 jQuery('body,html').animate({scrollTop: 0}, 800, 'easeOutCubic'); 4201 }); 4202 }, 4203 load:function() { 4204 if (!isMobile) { 4205 4206 // Button hover tooltips 4207 jQuery('.tooltip').each( function() { 4208 jQuery(this).css( 'marginLeft', '-' + Math.round( (jQuery(this).outerWidth(true) / 2) ) + 'px' ); 4209 }); 4210 4211 jQuery('.comment-avatar').hover( function() { 4212 jQuery(this).find('.tooltip' ).stop().animate({ 4213 bottom: '44px', 4214 opacity: 1 4215 }, 500, 'easeInOutExpo'); 4216 }, function() { 4217 jQuery(this).find('.tooltip').stop().animate({ 4218 bottom: '25px', 4219 opacity: 0 4220 }, 400, 'easeInOutExpo'); 4221 }); 4222 4223 jQuery('.grid-image').hover( function() { 4224 jQuery(this).find('.tooltip' ).stop().animate({ 4225 bottom: '85px', 4226 opacity: 1 4227 }, 500, 'easeInOutExpo'); 4228 }, function() { 4229 jQuery(this).find('.tooltip').stop().animate({ 4230 bottom: '65px', 4231 opacity: 0 4232 }, 400, 'easeInOutExpo'); 4233 }); 4234 4235 } 4236 } 4237 }; 4238 4239 4240 ///////////////////////////////////////////// 4241 // GLOBAL VARIABLES 4242 ///////////////////////////////////////////// 4243 4244 var $window = jQuery(window), 4245 body = jQuery('body'), 4246 sfIncluded = jQuery('#sf-included'), 4247 sfOptionParams = jQuery('#sf-option-params'),
4248 windowheight = SWIFT.page.getViewportHeight(), 4249 deviceAgent = navigator.userAgent.toLowerCase(), 4250 isMobile = deviceAgent.match(/(iphone|ipod|android|iemobile)/), 4251 isMobileAlt = deviceAgent.match(/(iphone|ipod|ipad|android|iemobile)/), 4252 isAppleDevice = deviceAgent.match(/(iphone|ipod|ipad)/), 4253 isAndroid = deviceAgent.match(/(android)/), 4254 isIEMobile = deviceAgent.match(/(iemobile)/), 4255 isSafari = navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 && navigator.userAgent.indexOf('Android') == -1, 4256 parallaxScroll = navigator.userAgent.indexOf('Safari') != -1 || navigator.userAgent.indexOf('Chrome') == -1, 4257 IEVersion = SWIFT.page.checkIE(), 4258 isRTL = body.hasClass('rtl') ? true : false, 4259 flexUseCSS = isMobileAlt ? false : true, 4260 sliderAuto = sfOptionParams.data('slider-autoplay') ? true : false, 4261 sliderSlideSpeed = sfOptionParams.data('slider-slidespeed'), 4262 sliderAnimSpeed = sfOptionParams.data('slider-animspeed'), 4263 lightboxControlArrows = sfOptionParams.data('lightbox-nav') === "arrows" ? true : false, 4264 lightboxThumbs = sfOptionParams.data('lightbox-thumbs') ? true : false, 4265 lightboxSkin = sfOptionParams.data('lightbox-skin') === "dark" ? "metro-black" : "metro-white", 4266 lightboxSharing = sfOptionParams.data('lightbox-sharing') ? true : false, 4267 hasProductZoom = jQuery('#sf-included').hasClass('has-productzoom') && !body.hasClass('mobile-browser') ? true : false, 4268 productZoomType = sfOptionParams.data('product-zoom-type') === "lens" ? "lens" : "inner"; 4269 4270 SWIFT.isScrolling = false; 4271 4272 ///////////////////////////////////////////// 4273 // LOAD + READY FUNCTION 4274 ///////////////////////////////////////////// 4275 4276 var onReady = { 4277 init: function(){ 4278 SWIFT.page.init(); 4279 if (jQuery('.sf-super-search').length > 0) { 4280 SWIFT.superSearch.init(); 4281 } 4282 if (jQuery('#header-section').length > 0) { 4283 SWIFT.header.init(); 4284 } 4285 SWIFT.nav.init(); 4286 //if (sfIncluded.hasClass('has-products') || body.hasClass('woocommerce-cart') || body.hasClass('woocommerce-account')) { 4287 SWIFT.woocommerce.init(); 4288 //} 4289 if (sfIncluded.hasClass('has-portfolio')) { 4290 SWIFT.portfolio.init(); 4291 } 4292 if (sfIncluded.hasClass('has-portfolio-showcase')) { 4293 SWIFT.portfolio.portfolioShowcaseInit(); 4294 } 4295 if (sfIncluded.hasClass('has-blog')) { 4296 SWIFT.blog.init(); 4297 } 4298 if (sfIncluded.hasClass('has-infscroll') && !isMobile) { 4299 SWIFT.blog.infiniteScroll(); 4300 } 4301 if (sfIncluded.hasClass('has-gallery')) { 4302 SWIFT.gallery.init(); 4303 } 4304 if (sfIncluded.hasClass('has-galleries')) { 4305 SWIFT.galleries.init(); 4306 } 4307 SWIFT.widgets.init(); 4308 if (sfIncluded.hasClass('has-team')) { 4309 SWIFT.teamMembers.init(); 4310 } 4311 if (sfIncluded.hasClass('has-carousel')) { 4312 SWIFT.carouselWidgets.init(); 4313 } 4314 SWIFT.crowdfunding.init(); 4315 SWIFT.reloadFunctions.init(); 4316 } 4317 }; 4318 var onLoad = { 4319 init: function(){ 4320 if (body.hasClass('sf-preloader') && !isMobileAlt) { 4321 SWIFT.page.homePreloader(); 4322 } 4323 SWIFT.flexSlider.init(); 4324 if (sfIncluded.hasClass('has-products') || body.hasClass('woocommerce-cart') || body.hasClass('woocommerce-account')) { 4325 SWIFT.woocommerce.load(); 4326 } 4327 SWIFT.page.load(); 4328 if (body.hasClass('page-transitions')) { 4329 SWIFT.page.fadePageIn(); 4330 } 4331 SWIFT.widgets.tabs(); 4332 if (sfIncluded.hasClass('has-progress-bar')) { 4333 SWIFT.widgets.initSkillBars(); 4334 } 4335 if (sfIncluded.hasClass('has-map')) { 4336 SWIFT.map.init(); 4337 SWIFT.mapDirectory.init('', '', ''); 4338 4339 jQuery(document).on( 'click', '#directory-search-button', function() { 4340 jQuery('.directory-search-form').submit(); 4341 }); 4342 jQuery('ul.nav-tabs li a, .spb_accordion_section > h3 a').click(function(){ 4343 var thisTabHref = jQuery(this).attr('href'); 4344 if (jQuery(thisTabHref).find('.spb_gmaps_widget').length > 0) { 4345 SWIFT.map.init(); 4346 SWIFT.mapDirectory.init('', '', ''); 4347 } 4348 }); 4349 } 4350 SWIFT.reloadFunctions.load(); 4351 SWIFT.woocommerce.variations(); 4352 } 4353 }; 4354 4355 jQuery(document).ready(onReady.init); 4356 jQuery(window).on('load', onLoad.init); 4357 4358})(jQuery); 4359 4360window.onpageshow = function(event) { 4361 if ( event.persisted && jQuery('body').hasClass("sf-preloader") ) { 4362 window.location.reload(); 4363 } 4364};
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.