1"use strict"; 2 3jQuery(document).on('ready', function() { 4 5 initEvents(); 6 initStyles(); 7 initCollapseMenu(); 8 checkCountUp(); 9 initScrollReveal(); 10 checkScrollAnimation(); 11}); 12 13jQuery(window).on('scroll', function (event) { 14 15 checkNavbar(); 16 checkGoTop(); 17 checkScrollAnimation(); 18}).scroll(); 19 20jQuery(window).on('load', function(){ 21 22 initMasonry(); 23 initParallax(); 24}); 25 26jQuery(window).on("resize", function () { 27 28 setResizeStyles(); 29}).resize(); 30 31/* Navbar menu initialization */ 32function initCollapseMenu() { 33 34 var navbar = jQuery('.lte-navbar-items'), 35 navbar_toggle = jQuery('.lte-navbar-toggle'), 36 navbar_wrapper = jQuery("#lte-nav-wrapper"); 37 38 navbar_wrapper.on('click', '.lte-navbar-toggle', function (e) { 39 40 navbar_toggle.toggleClass('collapsed'); 41 navbar.toggleClass('collapse'); 42 navbar_wrapper.toggleClass('mob-visible'); 43 }); 44 45 // Anchor mobile menu 46 navbar.on('click', '.menu-item-type-custom > a', function(e) { 47 48 var el = jQuery(this); 49 50 if ( typeof jQuery(this).attr('href') !== 'undefined' && jQuery(this).attr('href') !== '#' && jQuery(this).attr('href').indexOf("#") != -1 && 51 ( ( el.closest('li').hasClass('menu-item-has-children') && e.target.tagName != 'A') || 52 ( !el.closest('li').hasClass('menu-item-has-children') && e.target.tagName == 'A')) ) { 53 54 navbar_toggle.addClass('collapsed'); 55 navbar.addClass('collapse'); 56 navbar_wrapper.removeClass('mob-visible'); 57 } 58 }); 59 60 navbar.on('click', '.menu-item-has-children > a', function(e) { 61 62 var el = jQuery(this); 63 64 if (!el.closest('.lte-navbar-items').hasClass('collapse')) { 65 66 if ((el.attr('href') === undefined || el.attr('href') === '#') || e.target.tagName == 'A') { 67 68 el.next().toggleClass('show'); 69 el.parent().toggleClass('show'); 70 71 return false; 72 } 73 } 74 }); 75 76 var lastWidth; 77 jQuery(window).on("resize", function () { 78 79 checkNavbar(); 80 81 var winWidth = jQuery(window).width(), 82 winHeight = jQuery(window).height(); 83 84 lastWidth = winWidth; 85 }); 86} 87 88/* Navbar attributes with dependency on resolution and scroll status */ 89function checkNavbar() { 90 91 var navbar = jQuery('.lte-navbar-items'), 92 scroll = jQuery(window).scrollTop(), 93 navBar = jQuery('.lte-navbar'), 94 topBar = jQuery('.lte-topbar-block'), 95 navbar_toggle = jQuery('.lte-navbar-toggle'), 96 navbar_wrapper = jQuery("#lte-nav-wrapper"), 97 slideDiv = jQuery('.slider-full'), 98 winWidth = jQuery(window).width(), 99 winHeight = jQuery(window).height(), 100 navbar_mobile_width = navbar.data('mobile-screen-width'); 101 102 if ( winWidth < navbar_mobile_width ) { 103 104 navbar.addClass('navbar-mobile').removeClass('navbar-desktop'); 105 navbar_wrapper.addClass('lte-navwrapper-mobile').removeClass('lte-navwrapper-desktop'); 106 } 107 else { 108 109 navbar.addClass('navbar-desktop').removeClass('navbar-mobile'); 110 navbar_wrapper.addClass('lte-navwrapper-desktop').removeClass('lte-navwrapper-mobile'); 111 } 112 113 114 navbar_wrapper.addClass('inited'); 115 116 if ( topBar.length ) { 117 118 navBar.data('offset-top', topBar.height()); 119 } 120 121 if (winWidth > navbar_mobile_width && navbar_toggle.is(':hidden')) { 122 123 navbar.addClass('collapse'); 124 navbar_toggle.addClass('collapsed'); 125 navbar_wrapper.removeClass('mob-visible'); 126 } 127 128 jQuery("#lte-nav-wrapper.navbar-layout-transparent + .lte-page-header, #lte-nav-wrapper.navbar-layout-transparent + .main-wrapper").css('margin-top', '-' + navbar_wrapper.height() + 'px'); 129 130 jQuery(".lte-image-preview img").each(function(i, el) { 131 132 var height = jQuery(el).height() - 700; 133 134 jQuery(el) 135 .on('mouseover', function() { 136 137 jQuery(this).css( { '-webkit-transform' : 'translateY(-' + height + 'px)', 'transform' : 'translateY(-' + height + 'px)' } ); 138 }) 139 .on('mouseout', function() { 140 141 jQuery(this).css( { '-webkit-transform' : 'translateY(0px)', 'transform' : 'translateY(0px)' } ); 142 });
143 }); 144} 145 146 147/* Check GoTop Visibility */ 148function checkGoTop() { 149 150 var gotop = jQuery('.lte-go-top'), 151 scrollBottom = jQuery(document).height() - jQuery(window).height() - jQuery(window).scrollTop(); 152 153 if ( gotop.length ) { 154 155 if ( jQuery(window).scrollTop() > 400 ) { 156 157 gotop.addClass('show'); 158 } 159 else { 160 161 gotop.removeClass('show'); 162 } 163 164 if ( scrollBottom < 50 ) { 165 166 gotop.addClass('scroll-bottom'); 167 } 168 else { 169 170 gotop.removeClass('scroll-bottom'); 171 } 172 } 173} 174 175/* All keyboard and mouse events */ 176function initEvents() { 177 178 initSearch(); 179 180 setTimeout(function() { if ( typeof Pace !== 'undefined' ) { Pace.stop(); } }, 3000); 181 182 jQuery('.swipebox.photo').magnificPopup({type:'image', gallery: { enabled: true }}); 183 jQuery('.swipebox.lte-video-popup').magnificPopup({type:'iframe'}); 184 185 jQuery('.swipebox-gallery').each(function() { 186 187 jQuery(this).magnificPopup({type:'image', delegate: '.lte-gallery', gallery: { enabled: true }}); 188 }); 189 190 if (!/Mobi/.test(navigator.userAgent) && jQuery(window).width() > 768) { 191 192 jQuery('.matchHeight').matchHeight(); 193 jQuery('.items-matchHeight article').matchHeight(); 194 } 195 196 jQuery('.lte-sidebar-filter').on('click', function() { 197 198 jQuery(this).parent().toggleClass('lte-show'); 199 }); 200 201 jQuery('.lte-sidebar-close').on('click', function() { 202 203 jQuery(this).parent().parent().removeClass('lte-show'); 204 }); 205 206 jQuery('.lte-sidebar-overlay').on('click', function() { 207 208 jQuery(this).parent().removeClass('lte-show'); 209 }); 210 211 212 /* Scrolling to navbar from "go top" button in footer */ 213 jQuery('.lte-go-top').on('click', function() { 214 215 jQuery('html, body').animate({ scrollTop: 0 }, 1200); 216 217 return false; 218 }); 219 220 // WooCommerce grid-list toggle 221 jQuery('.gridlist-toggle').on('click', 'a', function() { 222 223 jQuery('.matchHeight').matchHeight(); 224 }); 225 226 jQuery('.woocommerce').on('click', 'div.quantity > span', function(e) { 227 228 var f = jQuery(this).siblings('input'); 229 if (jQuery(this).hasClass('more')) { 230 f.val(Math.max(0, parseInt(f.val()))+1); 231 } else { 232 f.val(Math.max(1, Math.max(0, parseInt(f.val()))-1)); 233 } 234 e.preventDefault(); 235 236 jQuery(this).siblings('input').change(); 237 238 return false; 239 }); 240 241 if ( jQuery('.lte-mouse-move-object').length ) { 242 243 jQuery('.lte-mouse-move-object').each(function(i, el) { 244 245 jQuery('body').on('mousemove', function(e){ 246 247 jQuery(el)[0].style.WebkitTransform = 'translate3d(' + '-' + (((e.pageX - jQuery(this).offset().left) / jQuery(el).width()) * 10) + 'px, 0, 0)'; 248 }); 249 }); 250 } 251 252 jQuery('.lte-mouse-move .elementor-column-wrap') 253 .on('mouseover', function() { 254 255 if ( typeof jQuery(this).data('bg-size') === 'undefined' ) { 256 jQuery(this).data('bg-size', jQuery(this).css('background-size')); 257 } 258 259 if ( jQuery(this).css( 'background-size' ) != 'cover' ) { 260 261 jQuery(this)[0].style.setProperty( 'background-size', parseInt(jQuery(this).data('bg-size')) + 10 + '%', 'important' ); 262 } 263 }) 264 .on('mouseout', function(){ 265 266 if ( jQuery(this).css( 'background-size' ) != 'cover' ) { 267 268 jQuery(this)[0].style.setProperty( 'background-size', jQuery(this).data('bg-size'), 'important' ); 269 } 270 }) 271 .on('mousemove', function(e){ 272 273 if ( jQuery(this).css( 'background-size' ) != 'cover' ) { 274 275 jQuery(this)[0].style.setProperty( 'background-position', ((e.pageX - jQuery(this).offset().left) / jQuery(this).width()) * 100 + '% ' + ((e.pageY - jQuery(this).offset().top) / jQuery(this).height()) * 100 + '%', 'important' ); 276 } 277 }); 278 279 280 jQuery('.lte-navbar').on( 'affix.bs.affix', function(){ 281 282 if (!jQuery( window ).scrollTop()) return false; 283 }); 284 285 if ( jQuery('.lte-particles-ripples').length ) { 286 287 jQuery('.lte-particles-ripples').ripples({ 288 resolution: 512, 289 dropRadius: 20, 290 perturbance: 0.04, 291 }); 292 293 setInterval(function() { 294 295 if ( !document.hidden ) { 296 297 var $el = jQuery('.lte-particles-ripples'); 298 var x = Math.random() * $el.outerWidth(); 299 var y = Math.random() * $el.outerHeight(); 300 var dropRadius = 20; 301 var strength = 0.04 + Math.random() * 0.04; 302 303 $el.ripples('drop', x, y, dropRadius, strength); 304 } 305 }, 400); 306 } 307} 308 309function initSearch() { 310 311 let searchHandler = function(event){ 312 313 if (jQuery(event.target).is(".lte-top-search-wrapper, .lte-top-search-wrapper *")) return;
314 jQuery(document).off("click", searchHandler); 315 jQuery('.lte-top-search-wrapper').removeClass('show-field'); 316 jQuery('.lte-navbar-items').removeClass('muted'); 317 } 318 319 let search_href = jQuery('.lte-top-search-wrapper').data('base-href'), 320 search_soruce = jQuery('.lte-top-search-wrapper').data('source'); 321 322 323 jQuery('.lte-top-search-ico').on('click', function (e) { 324 325 e.preventDefault(); 326 jQuery(this).parent().toggleClass('show-field'); 327 jQuery('.lte-navbar-items').toggleClass('muted'); 328 329 if (jQuery(this).parent().hasClass('show-field')) { 330 331 jQuery(document).on("click", searchHandler); 332 } 333 else { 334 335 jQuery(document).off("click", searchHandler); 336 } 337 }); 338 339 jQuery('.lte-nav-search .lte-header').on('click', function(e) { 340 341 jQuery(this).prev().find('.lte-top-search-ico').click(); 342 343 return false; 344 }); 345 346 jQuery('.lte-top-search-ico-close').on('click', function (e) { 347 348 jQuery(this).parent().toggleClass('show-field'); 349 jQuery('.lte-navbar-items').toggleClass('muted'); 350 351 return false; 352 }); 353 354 355 jQuery('#lte-top-search-ico-mobile').on('click', function() { 356 357 if ( search_soruce == 'woocommerce' ) { 358 359 window.location = search_href + '?s=' + jQuery(this).next().val() + '&post_type=product'; 360 } 361 else { 362 363 window.location = search_href + '?s=' + jQuery(this).next().val(); 364 } 365 366 return false; 367 }); 368 369 jQuery('.lte-top-search-wrapper input').keypress(function (e) { 370 371 if (e.which == 13) { 372 373 if ( search_soruce == 'woocommerce' ) { 374 375 window.location = search_href + '?s=' + jQuery(this).val() + '&post_type=product'; 376 } 377 else { 378 379 window.location = search_href + '?s=' + jQuery(this).val(); 380 } 381 382 return false; 383 } 384 }); 385} 386 387function lteUrlDecode(str) { 388 389 return decodeURIComponent((str+'').replace(/\+/g, '%20')); 390} 391 392/* Parallax initialization */ 393function initParallax() { 394 395 // Only for desktop 396 if (/Mobi/.test(navigator.userAgent)) return false; 397 398 jQuery('.lte-parallax').parallax("50%", 0.2); 399 400 jQuery('section.lte-parallax-yes, div.lte-parallax-yes > .elementor-column-wrap').each(function(i, el) { 401 402 var val = jQuery(el).attr('class').match(/lte-bg-parallax-value-(\S+)/); 403 if ( val === null ) var val = [0, 0.2]; 404 405 jQuery(el).parallax("50%", parseFloat(val[1])); 406 }); 407 408 if (typeof jQuery().paroller === "function") { 409 410 jQuery("[data-paroller-factor]").paroller(); 411 } 412} 413 414/* Adding custom classes to element */ 415function initStyles() { 416 417 jQuery('form:not(.checkout, .woocommerce-shipping-calculator) select:not(#rating), .wpcf7-form select:not(#rating), .lte-wc-order select, aside select, .lte-footer-widget-area select').wrap('<div class="select-wrap"></div>'); 418 jQuery('.vrcdivsearch .select-wrap > select').unwrap(); 419 420 jQuery('.wpcf7-checkbox').parent().addClass('margin-none'); 421 422 jQuery('input[type="submit"], button[type="submit"]').not('.lte-btn').addClass('lte-btn'); 423 jQuery('#send_comment').removeClass('btn-xs'); 424 jQuery('#searchsubmit').removeClass('lte-btn'); 425 jQuery('blockquote').append('<span class="lte-triangle"></span>'); 426 427 jQuery('table:not([class])').addClass('lte-table'); 428 jQuery('ul:not([class]), ol:not([class])').addClass('lte-list'); 429 430 // WooCommerce styles 431 jQuery('.woocommerce .button').addClass('lte-btn btn-main').removeClass('button'); 432 jQuery('.woocommerce-message .lte-btn, .woocommerce-info .lte-btn').addClass('btn-xs'); 433 jQuery('.woocommerce .price_slider_amount .lte-btn').removeClass('btn-black color-hover-white').addClass('btn btn-main btn-xs'); 434 jQuery('.woocommerce .checkout-button').removeClass('btn-black color-hover-white').addClass('btn btn-main btn-xs'); 435 jQuery('button.single_add_to_cart_button').removeClass('btn-xs color-hover-white').addClass('color-hover-main'); 436 jQuery('.woocommerce .coupon .lte-btn').removeClass('color-hover-white').addClass('color-hover-main'); 437 jQuery('.woocommerce .product .wc-label-new').closest('.product').addClass('lte-wc-new'); 438 jQuery('.widget_product_search button').removeClass('lte-btn btn-xs'); 439 jQuery('.woocommerce .product_meta span').each(function(i, el) { 440 441 jQuery(el).html(jQuery(el).html().replace(/\,/gi, '<span class="lte-coma">,</span>')); 442 }); 443 444 // Cart quanity change 445 jQuery('.woocommerce div.quantity,.woocommerce-page div.quantity').append('<span class="more"></span><span class="less"></span>'); 446 jQuery(document).off('updated_wc_div').on('updated_wc_div', function () { 447 448 jQuery('.woocommerce div.quantity,.woocommerce-page div.quantity').append('<span class="more"></span><span class="less"></span>'); 449 initStyles(); 450 }); 451 452 jQuery('.input-group-append .lte-btn').removeClass('btn-xs'); 453 454 jQuery('.lte-hover-logos img').each(function(i, el) { jQuery(el).clone().addClass('lte-img-hover').insertAfter(el); }); 455 456 jQuery(".container input[type=\"submit\"], .container input[type=\"button\"], .container .lte-btn").wrap('<span class="lte-btn-wrap"></span');
457 jQuery(".woocommerce *:not(.lte-btn-wrap) > .lte-btn").wrap('<span class="lte-btn-wrap"></span'); 458 459 jQuery(".container .wpcf7-submit").removeClass('btn-xs').wrap('<span class="lte-btn-wrap"></span'); 460 461 jQuery('.blog-post .nav-links > a').wrapInner('<span></span>'); 462 jQuery('.blog-post .nav-links > a[rel="next"]').wrap('<span class="next"></span>'); 463 jQuery('.blog-post .nav-links > a[rel="prev"]').wrap('<span class="prev"></span>'); 464 465 jQuery('.lte-background-no-img').each(function() { 466 467 var rx = Math.floor((Math.random() * 1200)) + 'px', 468 ry = Math.floor((Math.random() * 900)) + 'px'; 469 470 jQuery(this).css('background-position', rx + ' ' + ry); 471 }); 472 473 var overlays = jQuery('*[class*="lte-overlay-wrapper-"]') 474 .each(function (i, el) { 475 476 var overlay = this.className.match(/lte-overlay-wrapper-(\S+)/); 477 478 if ( jQuery(this).hasClass('elementor-column') ) { 479 480 jQuery(el).children('.elementor-column-wrap').prepend('<div class="lte-background-overlay lte-overlay-' + overlay[1] + '"></div>'); 481 } 482 else { 483 484 jQuery(el).prepend('<div class="lte-background-overlay lte-overlay-' + overlay[1] + '"></div>'); 485 } 486 }); 487 488 var header_icon_class = jQuery('#lte-header-icon').data('icon'); 489 490 var update_width = jQuery('.woocommerce-cart-form__contents .product-subtotal').outerWidth(); 491 jQuery('button[name="update_cart"]').css('width', update_width); 492 493 jQuery('.wp-searchform .lte-btn').removeClass('lte-btn'); 494 495 // Settings copyrights overlay for non-default heights 496 var copyrights = jQuery('.copyright-block.copyright-layout-copyright-transparent'), 497 footer = jQuery('#lte-widgets-footer + .copyright-block'), 498 widgets_footer = jQuery('#lte-widgets-footer'), 499 footerHeight = footer.outerHeight(); 500 501 widgets_footer.css('padding-bottom', 0 + footerHeight + 'px'); 502 footer.css('margin-top', '-' + 0 + footerHeight + 'px'); 503 504 copyrights.css('margin-top', '-' + (copyrights.outerHeight()) + 'px') 505 506 var bodyStyles = window.getComputedStyle(document.body); 507 var niceScrollConf = {cursorcolor:bodyStyles.getPropertyValue('--white'),cursorborder:"0px",background:"#000",cursorwidth: "8px",cursorborderradius: "0px",autohidemode:false}; 508 509 jQuery('.lte-menu-sc.lte-scroll-yes .lte-items').niceScroll(niceScrollConf); 510 511} 512 513/* Styles reloaded then page has been resized */ 514function setResizeStyles() { 515 516 var videos = jQuery('.blog-post article.format-video iframe'), 517 container = jQuery('.blog-post'), 518 bodyWidth = jQuery(window).outerWidth(), 519 contentWrapper = jQuery('.lte-content-wrapper.lte-footer-parallax'), 520 footerWrapper = jQuery('.lte-content-wrapper.lte-footer-parallax + .lte-footer-wrapper'); 521 522 contentWrapper.css('margin-bottom', footerWrapper.outerHeight() + 'px'); 523 524 jQuery.each(videos, function(i, el) { 525 526 var height = jQuery(el).height(), 527 width = jQuery(el).width(), 528 containerW = jQuery(container).width(), 529 ratio = containerW / width; 530 531 jQuery(el).css('width', width * ratio); 532 jQuery(el).css('height', height * ratio); 533 }); 534 535 document.documentElement.style.setProperty( '--fullwidth', bodyWidth + 'px' ); 536} 537 538/* Starting countUp function */ 539function checkCountUp() { 540 541 if (jQuery(".lte-countup-animation").length){ 542 543 jQuery('.lte-countup-animation').counterUp(); 544 } 545} 546 547/* 548 Scroll Reveal Initialization 549 Catches the classes: lte-sr-fade_in lte-sr-text_el lte-sr-delay-200 lte-sr-duration-300 lte-sr-sequences-100 550*/ 551function initScrollReveal() { 552 553 if (/Mobi/.test(navigator.userAgent) || jQuery(window).width() < 768) return false; 554 555 window.sr = ScrollReveal(); 556 557 var srAnimations = { 558 zoom_in: { 559 560 opacity : 1, 561 scale : 0.01, 562 }, 563 zoom_in_large: { 564 565 opacity : 0, 566 scale : 5.01, 567 }, 568 fade_in: { 569 distance: 1, 570 opacity : 0, 571 scale : 1, 572 }, 573 slide_from_left: { 574 distance: '50%', 575 origin: 'left', 576 scale : 1, 577 }, 578 slide_from_right: { 579 distance: '50%', 580 origin: 'right', 581 scale : 1, 582 }, 583 slide_from_top: { 584 distance: '50%', 585 origin: 'top', 586 scale : 1, 587 }, 588 slide_from_bottom: { 589 distance: '50%', 590 origin: 'bottom', 591 scale : 1, 592 }, 593 slide_rotate: { 594 rotate: { x: 0, y: 0, z: 360 }, 595 }, 596 }; 597 598 var srElCfg = { 599 600 block: [''], 601 items: ['article', '.item'], 602 text_el: ['.heading', '.lte-btn', '.lte-btn-wrap', 'p', 'ul', 'img'], 603 list_el: ['li'] 604 }; 605 606 607 /* 608 Parsing elements class to get variables 609 */ 610 jQuery('.lte-sr').each(function() { 611 612 var el = jQuery(this), 613 srClass = el.attr('class'); 614 615 var srId = srClass.match(/lte-sr-id-(\S+)/), 616 srEffect = srClass.match(/lte-sr-effect-(\S+)/), 617 srEl = srClass.match(/lte-sr-el-(\S+)/), 618 srDelay = srClass.match(/lte-sr-delay-(\d+)/), 619 srDuration = srClass.match(/lte-sr-duration-(\d+)/), 620 srSeq = srClass.match(/lte-sr-sequences-(\d+)/); 621 622 var cfg = srAnimations[srEffect[1]]; 623 624 var srConfig = { 625 626 delay : parseInt(srDelay[1]), 627 duration : parseInt(srDuration[1]), 628 easing : 'ease-in-out', 629 afterReveal: function (domEl) { jQuery(domEl).css('transition', 'all .3s ease'); } 630 } 631 632 cfg = jQuery.extend({}, cfg, srConfig); 633 634 var initedEls = []; 635 jQuery.each(srElCfg[srEl[1]], function(i, e) { 636 637 initedEls.push('.lte-sr-id-' + srId[1] + ' ' + e); 638 }); 639 640 sr.reveal(initedEls.join(','), cfg, parseInt(srSeq[1])); 641 }); 642} 643 644 645 646/* Masonry initialization */ 647function initMasonry() { 648 649 jQuery('.masonry').masonry({ 650 itemSelector: '.item', 651 columnWidth: '.item' 652 }); 653 654 jQuery('.gallery-inner').masonry({ 655 itemSelector: '.mdiv', 656 columnWidth: '.mdiv' 657 }); 658} 659 660/* Scroll animation used for homepages */ 661function checkScrollAnimation() { 662 663 var scrollBlock = jQuery('.ltx-check-scroll:not(.done)'); 664 if (scrollBlock.length) { 665 666 jQuery.each(scrollBlock, function(i, el) { 667 668 var scrollTop = scrollBlock.offset().top - window.innerHeight; 669 if ( jQuery(window).scrollTop() >= scrollTop ) { 670 671 scrollBlock.addClass('done'); 672 } 673 });
674 } 675}
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.