1// ------------------------------------------------------------------------ 2// Check if element is in ViewPort 3// ------------------------------------------------------------------------ 4(function($) { 5 "use strict"; 6 $.belowthefold = function(element, settings) { 7 var fold = $(window).height() + $(window).scrollTop(); 8 return fold <= $(element).offset().top - settings.threshold; 9 }; 10 $.abovethetop = function(element, settings) { 11 var top = $(window).scrollTop(); 12 return top >= $(element).offset().top + $(element).height() - settings.threshold; 13 }; 14 $.rightofscreen = function(element, settings) { 15 var fold = $(window).width() + $(window).scrollLeft(); 16 return fold <= $(element).offset().left - settings.threshold; 17 }; 18 $.leftofscreen = function(element, settings) { 19 var left = $(window).scrollLeft(); 20 return left >= $(element).offset().left + $(element).width() - settings.threshold; 21 }; 22 $.inviewport = function(element, settings) { 23 return !$.rightofscreen(element, settings) && !$.leftofscreen(element, settings) && !$.belowthefold(element, settings) && !$.abovethetop(element, settings); 24 }; 25 $.extend($.expr[':'], { 26 "below-the-fold": function(a, i, m) { 27 return $.belowthefold(a, { 28 threshold: 0 29 }); 30 }, 31 "above-the-top": function(a, i, m) { 32 return $.abovethetop(a, { 33 threshold: 0 34 }); 35 }, 36 "left-of-screen": function(a, i, m) { 37 return $.leftofscreen(a, { 38 threshold: 0 39 }); 40 }, 41 "right-of-screen": function(a, i, m) { 42 return $.rightofscreen(a, { 43 threshold: 0 44 }); 45 }, 46 "in-viewport": function(a, i, m) { 47 return $.inviewport(a, { 48 threshold: 0 49 }); 50 } 51 }); 52 // ------------------------------------------------------------------------ 53 // Preload Effect 54 // ------------------------------------------------------------------------ 55 $(window).load(function() { 56 "use strict"; 57 $('body').removeClass('fade-in'); 58 }); 59 window.addEventListener("beforeunload", function () { 60 $("body a[href]").click(function(){ 61 var $anchor = $(this); 62 63 // Don't fade for links that open in new window 64 if ( $anchor.attr('target') && $anchor.attr('target').indexOf('_blank') >=0 ) { 65 return; 66 } 67 // Don't fade for email 68 if ( $anchor.attr('href').indexOf('mailto:') >=0 ) { 69 return; 70 } 71 72 // Don't fade for telephone links 73 if ( $anchor.attr('href').indexOf('tel:') >=0 ) { 74 return; 75 } 76 77 // Don't fade for links to anchor tags 78 if ( $anchor.attr('href').indexOf('#') >=0 ) { 79 return; 80 } 81 82 // Fade out 83 document.body.classList.add("fade-out"); 84 }); 85 }); 86 87 $(document).ready(function() { 88 "use strict"; 89 $(".wpb_wrapper:empty").parent().addClass('hide-on-mobile'); 90 91 $('.parallax-overlay').each(function() { 92 var size = $(this).attr('data-vc-kd-parallax'); 93 var height = $(this).closest('.kd_vc_parallax').innerHeight(); 94 $(this).css('height', size * height + 'px'); 95 }); 96 97 if ($('.entry-header .breadcrumbs').length > 0) { 98 var str = $(".entry-header .breadcrumbs").html(); 99 $(".entry-header .breadcrumbs").html(str.replace(/>/g, '<span class="fa fa-angle-right"></span>')); 100 } 101 102 // ------------------------------------------------------------------------ 103 // 3rd level menu off screen 104 // ------------------------------------------------------------------------ 105 106 $(".navbar-nav .dropdown").on("mouseover", function () { 107 var dropdown = $(this).find('.dropdown-menu'); 108 var off = dropdown.offset(); 109 var l = off.left; 110 var w = dropdown.width(); 111 var docW = $(window).width(); 112 var isEntirelyVisible = (l + w < docW); 113 if (!isEntirelyVisible) { 114 console.log(l + w - docW); 115 dropdown.addClass('align-menu-right'); 116 } 117 }); 118 $(window).on('resize', function(){ 119 $(".dropdown-menu").removeClass('align-menu-right'); 120 }); 121 122 // ------------------------------------------------------------------------ 123 // Mega menu effects 124 // ------------------------------------------------------------------------ 125 if ($('.transparent-navigation').length > 0) { 126 $( ".navbar-nav .mega-menu" ).hover( 127 function () { 128 $('body').removeClass( "transparent-navigation" ); 129 }, 130 function () { 131 $('body').addClass( "transparent-navigation" ); 132 } 133 ); 134 } 135 136 $( ".navbar-nav .mega-menu" ).hover( 137 function () { 138 $('.navbar-nav').addClass( "no-transition" ); 139 }, 140 function () { 141 $('.navbar-nav').removeClass( "no-transition" ); 142 } 143 ); 144 145 146 if ($('#single-page').length > 0) { 147 $('body').addClass('single-post'); 148 } 149 150 // ------------------------------------------------------------------------ 151 // Side panel 152 // ------------------------------------------------------------------------ 153 var $html_wrapper = $('html'), 154 scrollDisabled = false, 155 scrollTop; 156 157 function scrollDisable() { 158 if (scrollDisabled) { 159 return; 160 } 161 162 scrollTop = $(window).scrollTop(); 163 164 $html_wrapper.addClass('scrollLock') 165 .css({ 166 top: -1 * scrollTop 167 }); 168 169 scrollDisabled = true; 170 } 171 172 function scrollEnable() { 173 if (!scrollDisabled) { 174 return; 175 } 176 177 $html_wrapper.removeClass('scrollLock'); 178 $(window).scrollTop(scrollTop); 179 180 scrollDisabled = false;
181 } 182 183 if ($(".panel-trigger-btn").length) { 184 $(".panel-trigger-btn").click(function() { 185 scrollDisable(); 186 $(".kd-side-panel, .panel-screen-overlay").addClass("active"); 187 $(".navbar.navbar-default.fixed-menu").addClass("panel-enabled"); 188 }); 189 $(".kd-side-panel .panel-close").click(function() { 190 scrollEnable(); 191 $(".kd-side-panel, .panel-screen-overlay").removeClass("active"); 192 $(".navbar.navbar-default.fixed-menu").removeClass("panel-enabled"); 193 }); 194 195 $('.panel-screen-overlay').on("click", function(){ 196 $(".kd-side-panel .panel-close").trigger("click"); 197 }); 198 } 199 200 // ------------------------------------------------------------------------ 201 // Live Preview Customizer 202 // ------------------------------------------------------------------------ 203 204 $("#customizer .switcher, .demo-switcher ").click(function() { 205 $("#customizer").toggleClass('active'); 206 }); 207 208 // ------------------------------------------------------------------------ 209 // Topbar search 210 // ------------------------------------------------------------------------ 211 212 $(".topbar-search .toggle-search").click(function() { 213 $(".topbar-search .topbar-search-container").toggleClass('active'); 214 $(this).toggleClass('fa-times'); 215 }); 216 217 function draw() { 218 requestAnimationFrame(draw); 219 scrollEvent(); 220 } 221 draw(); 222 223 // ------------------------------------------------------------------------ 224 // Fixed Footer 225 // ------------------------------------------------------------------------ 226 if ($("#footer.fixed").length) { 227 var footerHeight = $("#footer.fixed").height(); 228 $("#wrapper").css("margin-bottom", footerHeight); 229 } 230 231 // ------------------------------------------------------------------------ 232 // Custom Search Field 233 // ------------------------------------------------------------------------ 234 $("#s").each(function(index, elem) { 235 var eId = $(elem).attr("id"); 236 var label = null; 237 if (eId && (label = $(elem).parents("form").find("label[for=" + eId + "]")).length == 1) { 238 $(elem).attr("placeholder", 'Search'); 239 $(label).remove(); 240 } 241 }); 242 $(".search-submit, .blog_widget #bbp_search_submit").val('ï'); 243 $(".woocommerce-product-search input[type='submit']").val('ï'); 244 // ------------------------------------------------------------------------ 245 // Contact Form Buttons 246 // ------------------------------------------------------------------------ 247 $(document).on("click", ".section .wpcf7-not-valid-tip,.section .wpcf7-mail-sent-ok, .blog-header-form .wpcf7-not-valid-tip, .blog-header-form .wpcf7-mail-sent-ok, .subscribe-form header .wpcf7-response-output, .modal-content-inner .wpcf7-not-valid-tip, .kd-side-panel .wpcf7-not-valid-tip", function() { 248 $(this).fadeOut(); 249 }); 250 // ------------------------------------------------------------------------ 251 // Reset reCaptcha for modal window 252 // ------------------------------------------------------------------------ 253 if ($('.wpcf7-recaptcha').length > 0) { 254 $(document).on("click", ".modal-menu-item", function() { 255 grecaptcha.reset(); 256 }); 257 } 258 // ------------------------------------------------------------------------ 259 // Blog video cover 260 // ------------------------------------------------------------------------ 261 $('.background-video-image').each(function() { 262 var imgSrc = $(this).children('img').attr('src'); 263 $(this).css('background', 'url("' + imgSrc + '")').css('background-position', 'initial'); 264 }); 265 266 267 $('.video-cover').each(function(){ 268 var videoCover = $(this); 269 if(videoCover.find('iframe').length){ 270 videoCover.find('iframe').attr('data-src', videoCover.find('iframe').attr('src')); 271 videoCover.find('iframe').attr('src',''); 272 } 273 }); 274 275 $('.video-cover .play-video').on("click", function(){ 276 var playIcon = $(this); 277 var videoCover = playIcon.closest('.video-cover'); 278 if(videoCover.find('video').length){ 279 var video = videoCover.find('video').get(0); 280 videoCover.addClass('show-video'); 281 video.play(); 282 return false;
283 } else if(videoCover.find('iframe').length){ 284 var iframe = videoCover.find('iframe'); 285 var videoSrc = iframe.attr('data-src'); 286 var videoSrcAuto = videoSrc.replace('?feature=oembed', '?autoplay=1'); 287 iframe.attr('src', videoSrcAuto); 288 videoCover.addClass('show-video'); 289 return false; 290 } 291 }); 292 293 // ------------------------------------------------------------------------ 294 // Main Menu One Page Links 295 // ------------------------------------------------------------------------ 296 297 $( "<span class='mobile-dropdown'></span>" ).appendTo( $( ".navbar-nav .menu-item-has-children" ) ); 298 299 $(".navbar-nav .menu-item-has-children .mobile-dropdown").click(function() { 300 $(this).closest(".menu-item-has-children").toggleClass('mobile-visible'); 301 }); 302 303 $(".navbar-nav .menu-item-has-children .mobile-dropdown").on("tap", function() { 304 $(this).closest(".menu-item-has-children").toggleClass('mobile-visible'); 305 }); 306 307 // ------------------------------------------------------------------------ 308 // Bbpress Breadcrumbs 309 // ------------------------------------------------------------------------ 310 311 if ($('.bbp-breadcrumb').length > 0) { 312 $( '.bbp-breadcrumb' ).appendTo( $(".bbpress-breadcrumbs")); 313 } 314 315 // ------------------------------------------------------------------------ 316 // Main Smooth Scroll and Scroll Spy 317 // ------------------------------------------------------------------------ 318 $('.navbar-collapse ul li a, .navbar-collapse .modal-menu-item.scroll-section').click(function() { 319 $('.navbar-toggle:visible').click(); 320 $(this).closest(".menu-item-has-children").toggleClass('mobile-visible'); 321 }); 322 323 $('.navbar-collapse ul li a, .navbar-collapse .modal-menu-item.scroll-section').on("tap", function() { 324 $('.navbar-toggle:visible').click(); 325 $(this).closest(".menu-item-has-children").toggleClass('mobile-visible'); 326 }); 327 328 $(function() { 329 $('.navbar-nav .one-page-link a, .footer_widget .menu li a, .scroll-section a, .btn-smooth-scroll, .modal-menu-item.scroll-section, .demo-button').bind('click', function(event) { 330 if ($("body").hasClass("home")) { 331 var $anchor = $(this); 332 $('html, body').stop().animate({ 333 scrollTop: $($anchor.attr('href')).offset().top - 90 334 }, 1500, 'easeInOutExpo'); 335 event.preventDefault(); 336 } 337 }); 338 }); 339 $(function() { 340 $('.portfolio-demo-button').bind('click', function(event) { 341 var $anchor = $(this); 342 $('html, body').stop().animate({ 343 scrollTop: $($anchor.attr('href')).offset().top - 250 344 }, 1500, 'easeInOutExpo'); 345 event.preventDefault(); 346 }); 347 }); 348 $('body').scrollspy({ 349 offset: 100, 350 target: '.navbar-fixed-top' 351 }); 352 353 // ------------------------------------------------------------------------ 354 // WPGlobus compatibility - NavWalker conflict 355 // ------------------------------------------------------------------------ 356 357 if ($('.wpglobus-selector-link').length > 0) { 358 $('.wpglobus-selector-link .dropdown-menu').addClass('sub-menu'); 359 } 360 361 // ------------------------------------------------------------------------ 362 // Back to top button 363 // ------------------------------------------------------------------------ 364 $(window).bind("scroll", function() { 365 if ($(window).scrollTop() > $(window).height()) { 366 $('.back-to-top').addClass('active'); 367 } 368 if ($(window).scrollTop() < $(window).height()) { 369 $('.back-to-top').removeClass('active'); 370 } 371 }); 372 $('.back-to-top').click(function(event) { 373 event.preventDefault(); 374 $('html, body').animate({ 375 scrollTop: 0 376 }, 500); 377 return false;
378 }); 379 380 }); 381 382 // ------------------------------------------------------------------------ 383 // Blog image carousel 384 // ------------------------------------------------------------------------ 385 386 if (jQuery().owlCarousel) { 387 jQuery('.post .entry-gallery .gallery').addClass('post-gallery-carousel'); 388 jQuery('.single-post .gallery').addClass('post-gallery-carousel'); 389 } 390 391 if ($(".post .entry-gallery .post-gallery-carousel").length || $(".single-post .post-gallery-carousel").length) { 392 $(".post .entry-gallery .post-gallery-carousel, .single-post .post-gallery-carousel").owlCarousel({ 393 stageClass: "owl-wrapper", 394 stageOuterClass: "owl-wrapper-outer", 395 loadedClass: "owl-carousel", 396 items: 1, 397 dots: true, 398 dotsSpeed: 500, 399 dotsEach: true, 400 }); 401 } 402 403 // ------------------------------------------------------------------------ 404 // Portfolio & Blog related posts slider 405 // ------------------------------------------------------------------------ 406 407 if ($(".related-content.owlslider-related-posts").length) { 408 $(".related-content.owlslider-related-posts").owlCarousel({ 409 stageClass: "owl-wrapper", 410 stageOuterClass: "owl-wrapper-outer", 411 loadedClass: "owl-carousel", 412 responsive:{ 413 0:{ 414 items: 1, 415 nav: false, 416 dots: true, 417 }, 418 767:{ 419 items: 3, 420 nav: false, 421 dots: true, 422 }, 423 960:{ 424 nav: true, 425 navSpeed: 500, 426 dots: false, 427 } 428 }, 429 nav: true, 430 navSpeed: 500, 431 dots: false, 432 rewind: true, 433 loop: true, 434 }); 435 } 436 437 // ------------------------------------------------------------------------ 438 // Portfolio photoSwipe init 439 // ------------------------------------------------------------------------ 440 var PhotoSwipe = window.PhotoSwipe, 441 PhotoSwipeUI_Default = window.PhotoSwipeUI_Default; 442 443 $('body').on('click', 'a[data-size]', function(e) { 444 if (!PhotoSwipe || !PhotoSwipeUI_Default) { 445 return; 446 } 447 448 e.preventDefault(); 449 openPhotoSwipe(this); 450 }); 451 452 var parseThumbnailElements = function(gallery, el) { 453 var elements = $(gallery).find('a[data-size]').has('img'), 454 galleryItems = [], 455 index; 456 457 elements.each(function(i) { 458 var $el = $(this), 459 size = $el.data('size').split('x'), 460 caption; 461 462 if ($el.next().is('.wp-caption-text')) { 463 // image with caption 464 caption = $el.next().text(); 465 } else if ($el.parent().next().is('.wp-caption-text')) { 466 // gallery icon with caption 467 caption = $el.parent().next().text(); 468 } else { 469 caption = $el.attr('title'); 470 } 471 472 galleryItems.push({ 473 src: $el.attr('href'), 474 w: parseInt(size[0], 10), 475 h: parseInt(size[1], 10), 476 title: caption, 477 msrc: $el.find('img').attr('src'), 478 el: $el 479 }); 480 if (el === $el.get(0)) { 481 index = i; 482 } 483 }); 484 485 return [galleryItems, parseInt(index, 10)]; 486 }; 487 488 var openPhotoSwipe = function(element, disableAnimation) { 489 var pswpElement = $('.pswp').get(0), 490 galleryElement = $(element).parents('.gallery, .hentry, .main, body').first(), 491 gallery, 492 options, 493 items, index; 494 495 items = parseThumbnailElements(galleryElement, element); 496 index = items[1]; 497 items = items[0]; 498 499 options = { 500 index: index, 501 getThumbBoundsFn: function(index) { 502 var image = items[index].el.find('img'), 503 offset = image.offset(); 504 505 return { 506 x: offset.left, 507 y: offset.top, 508 w: image.width() 509 }; 510 }, 511 showHideOpacity: true, 512 history: false 513 }; 514 515 if (disableAnimation) { 516 options.showAnimationDuration = 0; 517 } 518 519 // Pass data to PhotoSwipe and initialize it 520 gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); 521 gallery.init(); 522 }; 523 524 525 // ------------------------------------------------------------------------ 526 // Classie Script 527 // ------------------------------------------------------------------------ 528 (function(window) { 529 530 function classReg(className) { 531 return new RegExp("(^|\\s+)" + className + "(\\s+|$)"); 532 } 533 var hasClass, addClass, removeClass;
534 if ('classList' in document.documentElement) { 535 hasClass = function(elem, c) { 536 return elem.classList.contains(c); 537 }; 538 addClass = function(elem, c) { 539 elem.classList.add(c); 540 }; 541 removeClass = function(elem, c) { 542 elem.classList.remove(c); 543 }; 544 } else { 545 hasClass = function(elem, c) { 546 return classReg(c).test(elem.className); 547 }; 548 addClass = function(elem, c) { 549 if (!hasClass(elem, c)) { 550 elem.className = elem.className + ' ' + c; 551 } 552 }; 553 removeClass = function(elem, c) { 554 elem.className = elem.className.replace(classReg(c), ' '); 555 }; 556 } 557 558 function toggleClass(elem, c) { 559 var fn = hasClass(elem, c) ? removeClass : addClass; 560 fn(elem, c); 561 } 562 var classie = { 563 hasClass: hasClass, 564 addClass: addClass, 565 removeClass: removeClass, 566 toggleClass: toggleClass, 567 has: hasClass, 568 add: addClass, 569 remove: removeClass, 570 toggle: toggleClass 571 }; 572 if (typeof define === 'function' && define.amd) { 573 define(classie); 574 } else { 575 window.classie = classie; 576 } 577 578 })(window); 579 // ------------------------------------------------------------------------ 580 // Animated Header 581 // ------------------------------------------------------------------------ 582 583 var cbpAnimatedHeader = (function() { 584 var docElem = document.documentElement, 585 header = document.querySelector('.navbar-default'), 586 didScroll = false, 587 changeHeaderOn = 50; 588 589 function init() { 590 window.addEventListener('scroll', function(event) { 591 if (!didScroll) { 592 didScroll = true; 593 setTimeout(scrollPage, 100); 594 } 595 }, false); 596 window.addEventListener('load', function(event) { 597 if (!didScroll) { 598 didScroll = true; 599 setTimeout(scrollPage, 100); 600 } 601 }, false); 602 } 603 604 function scrollPage() { 605 var sy = scrollY(); 606 if (sy >= changeHeaderOn) { 607 classie.add(header, 'navbar-shrink'); 608 $(".topbar-search-container").removeClass('active'); 609 $(".topbar-search .toggle-search").removeClass('fa-times'); 610 } else { 611 if (!$(".panel-screen-overlay.active").length) { 612 classie.remove(header, 'navbar-shrink'); 613 } 614 } 615 didScroll = false; 616 } 617 618 function scrollY() { 619 return window.pageYOffset || docElem.scrollTop; 620 } 621 if (!$(header).hasClass("fixed-menu")) { 622 init(); 623 } 624 })(); 625 626 627})(jQuery); 628 629 630 631function scrollEvent() { 632 633 if (!is_touch_device()) { 634 viewportTop = jQuery(window).scrollTop(); 635 636 if (jQuery(window).width()) 637 638 jQuery('.parallax-overlay').each(function() { 639 elementOffset = jQuery(this).offset().top; 640 var size = jQuery(this).attr('data-vc-kd-parallax'); 641 distance = (elementOffset - viewportTop) * ( 1 - size ); 642 jQuery(this).css('transform', 'translate3d(0, ' + distance + 'px,0)'); 643 }); 644 645 jQuery('.kd-parallax-image .vc_figure img').each(function() { 646 elementOffset = jQuery(this).offset().top; 647 distance = (elementOffset - viewportTop) * -0.5; 648 jQuery(this).css('transform', 'translateY(' + distance + 'px)'); 649 }); 650 651 } 652} 653 654function is_touch_device() { 655 return 'ontouchstart' in window || 'onmsgesturechange' in window; 656}
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.