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