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 // On window load 54 // ------------------------------------------------------------------------ 55 $(window).on('load', function() { 56 if ($('#kd-preloader').length > 0) { 57 $('#kd-preloader').fadeOut('slow', function() { 58 $(this).remove(); 59 }); 60 } 61 // Add class on body when window is loaded 62 $('body').addClass('kd-window-loaded'); 63 }); 64 65 $(document).ready(function() { 66 67 if ($('.entry-header .breadcrumbs').length > 0) { 68 var str = $(".entry-header .breadcrumbs").html(); 69 $(".entry-header .breadcrumbs").html(str.replace(/>/g, '<span class="fa fa-angle-right"></span>')); 70 } 71 72 73 $('.parallax-overlay').each(function() { 74 var size = $(this).attr('data-vc-kd-parallax'); 75 var height = $(this).closest('.kd_vc_parallax').innerHeight(); 76 $(this).css('height', size * height + 'px'); 77 }); 78 79 80 if ($('#single-page').length > 0) { 81 $('body').addClass('single-post'); 82 } 83 84 // ------------------------------------------------------------------------ 85 // Live Preview Customizer 86 // ------------------------------------------------------------------------ 87 88 $("#customizer .switcher, .demo-switcher ").click(function() { 89 $("#customizer").toggleClass('active'); 90 }); 91 92 // ------------------------------------------------------------------------ 93 // Topbar search 94 // ------------------------------------------------------------------------ 95 96 97 $(".topbar-search .toggle-search").click(function() { 98 $(".topbar-search .search-form").toggleClass('active'); 99 $(this).toggleClass('fa-times'); 100 if ($('.search-form.active .search-field').length) { 101 $('.search-form.active .search-field').focus(); 102 } 103 }); 104 105 function draw() { 106 requestAnimationFrame(draw); 107 scrollEvent(); 108 } 109 draw(); 110 111 // ------------------------------------------------------------------------ 112 // Fixed Footer 113 // ------------------------------------------------------------------------ 114 if ($("#footer.fixed").length) { 115 var footerHeight = $("#footer.fixed").height(); 116 $("#wrapper").css("margin-bottom", footerHeight); 117 } 118 119 // ------------------------------------------------------------------------ 120 // Custom Search Field 121 // ------------------------------------------------------------------------ 122 $("#s").each(function(index, elem) { 123 var eId = $(elem).attr("id"); 124 var label = null; 125 if (eId && (label = $(elem).parents("form").find("label[for=" + eId + "]")).length == 1) { 126 $(elem).attr("placeholder", 'Search'); 127 $(label).remove(); 128 } 129 }); 130 $(".search-submit, .blog_widget #bbp_search_submit").val('ï'); 131 $(".woocommerce-product-search input[type='submit']").val('ï'); 132 // ------------------------------------------------------------------------ 133 // Contact Form Buttons 134 // ------------------------------------------------------------------------ 135 $(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", function() { 136 $(this).fadeOut(); 137 }); 138 // ------------------------------------------------------------------------ 139 // Reset reCaptcha for modal window 140 // ------------------------------------------------------------------------ 141 if ($('.wpcf7-recaptcha').length > 0) { 142 $(document).on("click", ".modal-menu-item", function() { 143 grecaptcha.reset(); 144 }); 145 } 146 // ------------------------------------------------------------------------ 147 // Blog video cover 148 // ------------------------------------------------------------------------ 149 $('.background-video-image').each(function() { 150 var imgSrc = $(this).children('img').attr('src'); 151 $(this).css('background', 'url("' + imgSrc + '")').css('background-position', 'initial'); 152 }); 153 154 $('.video-cover').each(function(){ 155 var videoCover = $(this); 156 if(videoCover.find('iframe').length){ 157 videoCover.find('iframe').attr('data-src', videoCover.find('iframe').attr('src')); 158 videoCover.find('iframe').attr('src',''); 159 } 160 }); 161 162 $('.video-cover .play-video').on("click", function(){ 163 var playIcon = $(this); 164 var videoCover = playIcon.closest('.video-cover'); 165 if(videoCover.find('video').length){ 166 var video = videoCover.find('video').get(0); 167 videoCover.addClass('show-video'); 168 video.play(); 169 return false;
170 } else if(videoCover.find('iframe').length){ 171 var iframe = videoCover.find('iframe'); 172 var videoSrc = iframe.attr('data-src'); 173 var videoSrcAuto = videoSrc.replace('?feature=oembed', '?autoplay=1'); 174 iframe.attr('src', videoSrcAuto); 175 videoCover.addClass('show-video'); 176 return false; 177 } 178 }); 179 180 // ------------------------------------------------------------------------ 181 // Main Menu One Page Links 182 // ------------------------------------------------------------------------ 183 184 $( "<span class='mobile-dropdown'></span>" ).appendTo( $( ".navbar-nav .menu-item-has-children" ) ); 185 186 $(".navbar-nav .menu-item-has-children .mobile-dropdown").click(function() { 187 $(this).closest(".menu-item-has-children").toggleClass('mobile-visible'); 188 }); 189 190 // ------------------------------------------------------------------------ 191 // Bbpress Breadcrumbs 192 // ------------------------------------------------------------------------ 193 194 if ($('.bbp-breadcrumb').length > 0) { 195 $( '.bbp-breadcrumb' ).appendTo( $(".bbpress-breadcrumbs")); 196 } 197 198 // ------------------------------------------------------------------------ 199 // Main Smooth Scroll and Scroll Spy 200 // ------------------------------------------------------------------------ 201 $('.navbar-collapse ul li a, .navbar-collapse .modal-menu-item.scroll-section').click(function() { 202 $('.navbar-toggle:visible').click(); 203 }); 204 $(function() { 205 $('.navbar-nav .one-page-link a, .footer_widget .menu li a, .scroll-section a, .modal-menu-item.scroll-section, .demo-button').bind('click', function(event) { 206 if ($("body").hasClass("home")) { 207 var $anchor = $(this); 208 $('html, body').stop().animate({ 209 scrollTop: $($anchor.attr('href')).offset().top - 90 210 }, 1500, 'easeInOutExpo'); 211 event.preventDefault(); 212 } 213 }); 214 }); 215 $(function() { 216 $('.portfolio-demo-button').bind('click', function(event) { 217 var $anchor = $(this); 218 $('html, body').stop().animate({ 219 scrollTop: $($anchor.attr('href')).offset().top - 250 220 }, 1500, 'easeInOutExpo'); 221 event.preventDefault(); 222 }); 223 }); 224 $('body').scrollspy({ 225 offset: 100, 226 target: '.navbar-fixed-top' 227 }); 228 229 // ------------------------------------------------------------------------ 230 // WPGlobus compatibility - NavWalker conflict 231 // ------------------------------------------------------------------------ 232 233 if ($('.wpglobus-selector-link').length > 0) { 234 $('.wpglobus-selector-link .dropdown-menu').addClass('sub-menu'); 235 } 236 237 // ------------------------------------------------------------------------ 238 // Back to top button 239 // ------------------------------------------------------------------------ 240 $(window).bind("scroll", function() { 241 if ($(window).scrollTop() > $(window).height()) { 242 $('.back-to-top').addClass('active'); 243 } 244 if ($(window).scrollTop() < $(window).height()) { 245 $('.back-to-top').removeClass('active'); 246 } 247 }); 248 $('.back-to-top').click(function(event) { 249 event.preventDefault(); 250 $('html, body').animate({ 251 scrollTop: 0 252 }, 500); 253 return false; 254 }); 255 256 }); 257 258 // ------------------------------------------------------------------------ 259 // Blog image carousel 260 // ------------------------------------------------------------------------ 261 262 if (jQuery().owlCarousel) { 263 jQuery('.post .entry-gallery .gallery').addClass('post-gallery-carousel'); 264 jQuery('.single-post .gallery').addClass('post-gallery-carousel'); 265 } 266 267 if ($(".post .entry-gallery .post-gallery-carousel").length || $(".single-post .post-gallery-carousel").length) { 268 $(".post .entry-gallery .post-gallery-carousel, .single-post .post-gallery-carousel").owlCarousel({ 269 stageClass: "owl-wrapper", 270 stageOuterClass: "owl-wrapper-outer", 271 loadedClass: "owl-carousel", 272 items: 1, 273 rewind: true, 274 dots: true, 275 dotsSpeed: 500, 276 }); 277 } 278 279 // ------------------------------------------------------------------------ 280 // Portfolio & Blog related posts slider 281 // ------------------------------------------------------------------------ 282 283 if ($(".related-content.owlslider-related-posts").length) { 284 $(".related-content.owlslider-related-posts").owlCarousel({ 285 stageClass: "owl-wrapper", 286 stageOuterClass: "owl-wrapper-outer", 287 loadedClass: "owl-carousel", 288 responsive:{ 289 0:{ 290 items:1, 291 }, 292 767:{ 293 items:3, 294 } 295 }, 296 nav: false, 297 dots: true, 298 dotsSpeed: 500, 299 items: 3, 300 rewind: true, 301 }); 302 } 303 304 // ------------------------------------------------------------------------ 305 // Portfolio photoSwipe init 306 // ------------------------------------------------------------------------ 307 var PhotoSwipe = window.PhotoSwipe, 308 PhotoSwipeUI_Default = window.PhotoSwipeUI_Default; 309 310 $('body').on('click', 'a[data-size]', function(e) { 311 if (!PhotoSwipe || !PhotoSwipeUI_Default) { 312 return; 313 } 314 315 e.preventDefault(); 316 openPhotoSwipe(this); 317 }); 318 319 var parseThumbnailElements = function(gallery, el) { 320 var elements = $(gallery).find('a[data-size]').has('img'), 321 galleryItems = [], 322 index; 323 324 elements.each(function(i) { 325 var $el = $(this), 326 size = $el.data('size').split('x'), 327 caption; 328 329 if($el.attr('data-caption-title') != null) { 330 caption = '<div class="pswp__caption__title">'+$el.attr('data-caption-title')+'</div>'; 331 } 332 333 if($el.attr('data-caption-desc') != null) { 334 if(caption == null) caption = ''; 335 caption = caption + '<div class="pswp__caption__desc">'+$el.attr('data-caption-desc')+'</div>'; 336 } 337 338 galleryItems.push({ 339 src: $el.attr('href'), 340 w: parseInt(size[0], 10), 341 h: parseInt(size[1], 10), 342 title: caption, 343 msrc: $el.find('img').attr('src'), 344 el: $el 345 }); 346 if (el === $el.get(0)) { 347 index = i; 348 } 349 }); 350 351 return [galleryItems, parseInt(index, 10)]; 352 }; 353 354 var openPhotoSwipe = function(element, disableAnimation) { 355 var pswpElement = $('.pswp').get(0), 356 galleryElement = $(element).parents('.gallery, .hentry, .main, body').first(), 357 gallery, 358 options, 359 items, index; 360 361 items = parseThumbnailElements(galleryElement, element); 362 index = items[1]; 363 items = items[0]; 364 365 options = { 366 index: index, 367 getThumbBoundsFn: function(index) { 368 var image = items[index].el.find('img'), 369 offset = image.offset(); 370 371 return { 372 x: offset.left, 373 y: offset.top, 374 w: image.width() 375 }; 376 }, 377 showHideOpacity: true, 378 history: false 379 }; 380 381 if (disableAnimation) { 382 options.showAnimationDuration = 0; 383 } 384 385 // Pass data to PhotoSwipe and initialize it 386 gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); 387 gallery.init(); 388 }; 389 390 391 // ------------------------------------------------------------------------ 392 // Classie Script 393 // ------------------------------------------------------------------------ 394 (function(window) { 395 396 function classReg(className) { 397 return new RegExp("(^|\\s+)" + className + "(\\s+|$)"); 398 } 399 var hasClass, addClass, removeClass;
400 if ('classList' in document.documentElement) { 401 hasClass = function(elem, c) { 402 return elem.classList.contains(c); 403 }; 404 addClass = function(elem, c) { 405 elem.classList.add(c); 406 }; 407 removeClass = function(elem, c) { 408 elem.classList.remove(c); 409 }; 410 } else { 411 hasClass = function(elem, c) { 412 return classReg(c).test(elem.className); 413 }; 414 addClass = function(elem, c) { 415 if (!hasClass(elem, c)) { 416 elem.className = elem.className + ' ' + c; 417 } 418 }; 419 removeClass = function(elem, c) { 420 elem.className = elem.className.replace(classReg(c), ' '); 421 }; 422 } 423 424 function toggleClass(elem, c) { 425 var fn = hasClass(elem, c) ? removeClass : addClass; 426 fn(elem, c); 427 } 428 var classie = { 429 hasClass: hasClass, 430 addClass: addClass, 431 removeClass: removeClass, 432 toggleClass: toggleClass, 433 has: hasClass, 434 add: addClass, 435 remove: removeClass, 436 toggle: toggleClass 437 }; 438 if (typeof define === 'function' && define.amd) { 439 define(classie); 440 } else { 441 window.classie = classie; 442 } 443 444 })(window); 445 // ------------------------------------------------------------------------ 446 // Animated Header 447 // ------------------------------------------------------------------------ 448 449 var cbpAnimatedHeader = (function() { 450 var docElem = document.documentElement, 451 header = document.querySelector('.navbar-default'), 452 didScroll = false, 453 changeHeaderOn = 50; 454 455 function init() { 456 window.addEventListener('scroll', function(event) { 457 if (!didScroll) { 458 didScroll = true; 459 setTimeout(scrollPage, 100); 460 } 461 }, false); 462 window.addEventListener('load', function(event) { 463 if (!didScroll) { 464 didScroll = true; 465 setTimeout(scrollPage, 100); 466 } 467 }, false); 468 } 469 470 function scrollPage() { 471 var sy = scrollY(); 472 if (sy >= changeHeaderOn) { 473 classie.add(header, 'navbar-shrink'); 474 } else { 475 if ( typeof(header) != 'undefined' && header != null ) { 476 classie.remove(header, 'navbar-shrink'); 477 } 478 } 479 didScroll = false; 480 } 481 482 function scrollY() { 483 return window.pageYOffset || docElem.scrollTop; 484 } 485 if (!$(header).hasClass("fixed-menu")) { 486 init(); 487 } 488 })(); 489 490 491})(jQuery); 492 493 494 495function scrollEvent() { 496 497 if (!is_touch_device()) { 498 viewportTop = jQuery(window).scrollTop(); 499 500 if (jQuery(window).width()) 501 502 jQuery('.parallax-overlay').each(function() { 503 elementOffset = jQuery(this).offset().top; 504 distance = -(elementOffset - viewportTop) * 0.35; 505 jQuery(this).css('transform', 'translate3d(0, ' + distance + 'px,0)'); 506 }); 507 508 } 509} 510 511function is_touch_device() { 512 return 'ontouchstart' in window || 'onmsgesturechange' in window; 513}
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.