1(function ($, window) { 2 'use strict'; 3 wglElementorExtensions(); 4 5 $(window).on('elementor/frontend/init', function () { 6 wglExtensionsParallax(); 7 wglExtensionsEditorStyle(); 8 wglExtensionsColumn(); 9 }); 10 11 $(window).on('load', function () { 12 if (typeof ScrollTrigger !== 'undefined' && ScrollTrigger.refresh) { 13 ScrollTrigger.refresh(); 14 } 15 }); 16 17 function wglExtensionsParallax(){ 18 function WGLSectionParallax($scope) { 19 $scope.WGLSectionParallaxInit(); 20 $scope.WGLSectionParallaxColInit(); 21 $scope.WGLSectionParticlesInit(); 22 $scope.WGLSectionParticlesImageInit(); 23 $scope.WGLSectionDynamicHighlightsInit(); 24 $scope.WGLSectionHoverHighlightsInit(); 25 $scope.WGLSectionMorphInit(); 26 $scope.WGLSection3DWaveInit(); 27 $scope.WGLSectionShapeDividerInit(); 28 $scope.WGLSectionAnimateScrollInit(); 29 $scope.WGLSectionLayeredInit(); 30 } 31 window.elementorFrontend.hooks.addAction('frontend/element_ready/section', WGLSectionParallax); 32 window.elementorFrontend.hooks.addAction('frontend/element_ready/container', WGLSectionParallax); 33 } 34 35 function wglExtensionsEditorStyle(){ 36 if(wgl_parallax_settings.elementorPro){ 37 return; 38 } 39 40 var globaPageSettings = true; 41 42 elementorFrontend.hooks.addFilter('editor/style/styleText', addCustomCss); 43 if(window.elementorFrontend.isEditMode()){ 44 elementorFrontend.hooks.addAction('frontend/element_ready/global', elementReady); 45 elementor.settings.page.model.on('change', changePageSettings); 46 } 47 48 function addCustomCss(css, context) { 49 if (!context) { 50 return; 51 } 52 var model = context.getEditModel(), 53 customCSS = model.get('settings').get('custom_css'); 54 var selector = '.elementor-element.elementor-element-' + model.get('id'); 55 if ('document' === model.get('elType')) { 56 selector = elementor.config.document.settings.cssWrapperSelector; 57 } 58 if (customCSS) { 59 css += customCSS.replace(/selector/g, selector); 60 } 61 return css; 62 } 63 64 function elementReady($scope){ 65 return $scope.each(function () { 66 var id = $(this).data('id'); 67 var obj = window.elementorFrontend.config.elements.data; 68 69 Object.entries(obj).forEach(entry => { 70 const [key, value] = entry; 71 72 for (var prop in value._listeners) { 73 var dataID = value._listeners[prop].listener.$el.get(0).dataset.id; 74 if(id === dataID){ 75 value.__itemID = dataID; 76 77 setTimeout(function () { 78 elementor.$previewContents.find('#elementor-style-' + value.__itemID).append(value.attributes.custom_css); 79 }, 1); 80 81 obj[key].on('change textInput input', onSettingsChange.bind(value)); 82 } 83 } 84 }); 85 86 if(globaPageSettings){ 87 var customCSS = elementor.settings.page.model.get('custom_css'); 88 if (customCSS) { 89 customCSS = customCSS.replace(/selector/g, elementor.config.settings.page.cssWrapperSelector); 90 elementor.settings.page.getControlsCSS().elements.$stylesheetElement.append(customCSS); 91 globaPageSettings = false; 92 } 93 } 94 }); 95 } 96 97 function onSettingsChange($scope){ 98 Object.entries($scope).forEach(entry => { 99 const [key, value] = entry; 100 if(key === 'changed' && value.custom_css){ 101 appendStyle($scope, value); 102 }else if(key === 'attributes' && value.custom_css){ 103 appendStyle($scope, value); 104 } 105 }); 106 } 107 108 function appendStyle($scope, value){ 109 setTimeout(function(){ 110 var styleElement = jQuery('#elementor-style-' + $scope.__itemID).text(); 111 jQuery('#elementor-style-' + $scope.__itemID).empty().append(styleElement + value.custom_css); 112 }, 1); 113 } 114 115 function changePageSettings() {
116 var customCSS = elementor.settings.page.model.get('custom_css'); 117 if (customCSS) { 118 customCSS = customCSS.replace(/selector/g, elementor.config.settings.page.cssWrapperSelector); 119 setTimeout(function(){ 120 elementor.settings.page.getControlsCSS().elements.$stylesheetElement.append(customCSS); 121 }, 1); 122 } 123 } 124 } 125 126 function wglExtensionsColumn(){ 127 if ( window.elementorFrontend.isEditMode() ) { 128 window.elementorFrontend.hooks.addAction( 'frontend/element_ready/column', 129 function( $scope ){ 130 wglStickySidebar(); 131 } 132 ); 133 } 134 } 135 136 function wglElementorExtensions (){ 137 138 jQuery.fn.is_visible = function (){ 139 var elementTop = jQuery(this).offset().top; 140 var elementBottom = elementTop + jQuery(this).outerHeight(); 141 var viewportTop = jQuery(window).scrollTop(); 142 var viewportBottom = viewportTop + jQuery(window).height(); 143 return elementBottom > viewportTop && elementTop < viewportBottom; 144 } 145 146 jQuery.fn.wglGlobalVariables = function (globalSetting){ 147 var settings = { 148 editorMode: window.elementorFrontend.isEditMode(), 149 itemId: $(this).data('id'), 150 options: false, 151 globalVars: globalSetting, 152 backEndVars: null, 153 items: [], 154 }; 155 156 return settings; 157 } 158 159 function findNodeItem(id, currentNode) { 160 let i, 161 currentChild, 162 result; 163 164 if (String(id) === String(currentNode.id)) { 165 return currentNode; 166 } else { 167 for (i = 0; i < currentNode.attributes.elements.models.length; i += 1) { 168 currentChild = currentNode.attributes.elements.models[i]; 169 result = findNodeItem(id, currentChild); 170 if (result !== false) { 171 return result; 172 } 173 } 174 return false; 175 } 176 } 177 178 jQuery.fn.settingsEffectEnabled = function (option){ 179 var settings = {}; 180 181 182 if (!option.editorMode) { 183 settings = wgl_parallax_settings[0][option.itemId]; 184 185 if ( 186 settings 187 && (!settings.hasOwnProperty(option.globalVars) 188 || !settings[option.globalVars]) 189 ) { 190 return; 191 } 192 } else { 193 194 if ( 195 !window.elementor.elements 196 && !window.elementor.elements.models 197 ) { 198 return; 199 } 200 201 window.elementor.elements.models.forEach(function (value) { 202 if(findNodeItem(option.itemId, value)){ 203 option.backEndVars = findNodeItem(option.itemId, value).attributes.settings.attributes; 204 } 205 }); 206 207 if ( 208 option.backEndVars 209 && (!option.backEndVars.hasOwnProperty(option.globalVars) 210 || !option.backEndVars[option.globalVars]) 211 ) { 212 return; 213 } 214 215 settings = option.backEndVars; 216 } 217 218 return settings; 219 } 220 221 jQuery.fn.buildFront = function (option, value) { 222 var settings = wgl_parallax_settings[0][option.itemId]; 223 settings = settings[value]; 224 return settings; 225 } 226 227 jQuery.fn.buildBackend = function (option, value) { 228 if (!window.elementor.elements.models 229 && !option.backEndVars.hasOwnProperty(value) 230 ) 231 { 232 return; 233 } 234 235 var arr = []; 236 237 option.backEndVars[value].models.forEach(function (val) { 238 arr.push(val.attributes); 239 }); 240 241 return arr; 242 } 243 } 244 245 // Add WGL Parallax Section 246 $.fn.WGLSectionParallaxInit = function (options) { 247 248 return this.each(function () { 249 250 var self = $(this), 251 wglParallax = self.wglGlobalVariables('add_background_animation'); 252 253 var init = function () { 254 setParallaxItem(); 255 }, 256 setParallaxItem = function () { 257 var settings; 258 259 wglParallax.backEndVars = self.settingsEffectEnabled(wglParallax); 260 261 if (!wglParallax.backEndVars) { 262 return; 263 } 264 265 if (!wglParallax.editorMode) { 266 settings = self.buildFront(wglParallax, 'items_parallax'); 267 } else {
268 settings = self.buildBackend(wglParallax, 'items_parallax'); 269 } 270 271 if (!settings) { 272 return; 273 } 274 275 build(settings); 276 hideMobile(); 277 278 }, 279 280 appendElement = function (settings) { 281 var node_str = ''; 282 283 if (settings.image_bg.url) { 284 node_str = '<div data-item-id="' + settings._id + '" class="extended-parallax elementor-repeater-item-' + settings._id + '">'; 285 286 if (settings.parallax_image_mask_color) { 287 node_str += '<div class="wgl_mask_image" style="-webkit-mask-image:url(' + settings.image_bg.url + ');">'; 288 } 289 290 node_str += '<img src="' + settings.image_bg.url + '" alt="' + settings.image_bg.alt + '"/>'; 291 292 if (settings.parallax_image_mask_color) { 293 node_str += '</div>'; 294 } 295 296 node_str += '</div>'; 297 } 298 299 if (!$(self).find('.elementor-repeater-item-' + settings._id).length > 0) { 300 $(self).append(node_str); 301 } 302 303 wglParallax.items.push(settings); 304 305 var item = jQuery(self).find('.extended-parallax'); 306 if (item.length !== 0) { 307 item.each(function () { 308 var $this = jQuery(this); 309 if (settings._id === $this.data('itemId')) { 310 if (settings.image_effect === 'mouse') { 311 if (!$this.closest('.elementor-section').hasClass('wgl-parallax-mouse')) { 312 $this.closest('.elementor-section').addClass('wgl-parallax-mouse'); 313 } 314 if(!$this.closest('.e-con').hasClass('wgl-parallax-mouse')){ 315 $this.closest('.e-con').addClass('wgl-parallax-mouse'); 316 } 317 318 $this.wrapInner('<div class="wgl-parallax-layer layer" data-depth="' + settings.parallax_factor + '"></div>'); 319 } else if (settings.image_effect === 'scroll') { 320 if (wglParallax.editorMode) { 321 $this.paroller({ 322 factor: settings.parallax_factor, 323 type: 'foreground', // background, foreground 324 direction: settings.parallax_dir, // vertical, horizontal 325 326 }); 327 $this.css({ 'transform': 'unset' }); 328 } else { 329 $this.paroller({ 330 factor: settings.parallax_factor, 331 type: 'foreground', // background, foreground 332 direction: settings.parallax_dir, // vertical, horizontal 333 }); 334 335 if ( 336 !wgl_core || 337 !wgl_core.smoothScroll || 338 !wgl_core.smoothScroll.enabled || 339 ( 340 wgl_core && 341 wgl_core.smoothScroll && 342 wgl_core.smoothScroll.disableMac === '1' && 343 navigator.userAgent.includes('Mac OS X') 344 ) 345 ) { 346 jQuery(window).trigger('scroll'); 347 } 348 } 349 } else if (settings.image_effect === 'css_animation') { 350 let self = $(this), 351 image = self.find('img'), 352 maskImage = self.find('.wgl_mask_image'); 353 354 self.addClass('wgl_animation_item'); 355 if (self.is_visible() && image.length !== 0) { 356 if(maskImage.length !== 0) maskImage.addClass(settings.animation_name); 357 else image.addClass(settings.animation_name); 358 } 359 jQuery(window).on('resize scroll', function () { 360 if (self.is_visible() && image.length !== 0) { 361 if(maskImage.length !== 0) maskImage.addClass(settings.animation_name); 362 else image.addClass(settings.animation_name); 363 } 364 }); 365 } 366 } 367 }); 368 369 if (settings.image_effect === 'mouse') { 370 jQuery('.wgl-parallax-mouse').each(function () { 371 var scene = jQuery(this).get(0); 372 var parallaxInstance = new Parallax(scene, { hoverOnly: true, selector: '.wgl-parallax-layer', pointerEvents: true });
373 }); 374 } 375 } 376 }, 377 hideMobile = function () { 378 if (wglParallax.items) { 379 $.each(wglParallax.items, function (index, value) { 380 if (value.hide_on_mobile) { 381 if (jQuery(window).width() <= value.hide_mobile_resolution) { 382 jQuery('.extended-parallax[data-item-id="' + value._id + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 383 } else { 384 jQuery('.extended-parallax[data-item-id="' + value._id + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 385 } 386 } 387 }); 388 } 389 }, 390 build = function (settings) { 391 $.each(settings, function (index, value) { 392 appendElement(value); 393 }); 394 }; 395 396 /*Init*/ 397 init(); 398 399 jQuery(window).resize( 400 function () { 401 hideMobile(); 402 } 403 ); 404 }); 405 }; 406 407 // Add WGL Parallax Section 408 $.fn.WGLSectionParallaxColInit = function (options) { 409 410 return this.each(function () { 411 412 var self = $(this), 413 settings, 414 wglParallax = self.wglGlobalVariables('add_section_parallax'); 415 416 var init = function () { 417 setParallaxItem(); 418 }, 419 setParallaxItem = function () { 420 421 wglParallax.backEndVars = self.settingsEffectEnabled(wglParallax); 422 423 if (!wglParallax.backEndVars) { 424 return; 425 } 426 427 if (!wglParallax.editorMode) { 428 settings = wgl_parallax_settings[0][wglParallax.itemId]; 429 } else { 430 settings = buildBackendSectionParallax().backEndVars; 431 } 432 433 if (!settings) { 434 return; 435 } 436 437 build(settings); 438 439 }, 440 441 buildBackendSectionParallax = function () { 442 if (!window.elementor.elements.models) return; 443 444 return wglParallax; 445 }, 446 447 appendElement = function (settings) { 448 449 if (!settings) return; 450 451 $(self).addClass('section_parallax'); 452 $(self).attr('data-paroller-factor-lg', settings.section_parallax_factor_tablet); 453 $(self).attr('data-paroller-factor-md', settings.section_parallax_factor_tablet); 454 $(self).attr('data-paroller-factor-sm', settings.section_parallax_factor_mobile); 455 $(self).attr('data-paroller-factor-xs', settings.section_parallax_factor_mobile); 456 457 if (wglParallax.editorMode) { 458 $(self).paroller({ 459 factor: settings.section_parallax_factor, 460 type: 'foreground', // background, foreground 461 direction: settings.section_parallax_dir, // vertical, horizontal 462 }); 463 $(self).css({ 'transform': 'unset' }); 464 } else { 465 $(self).paroller({ 466 factor: settings.section_parallax_factor, 467 type: 'foreground', // background, foreground 468 direction: settings.section_parallax_dir, // vertical, horizontal 469 }); 470 if ( 471 !wgl_core || 472 !wgl_core.smoothScroll || 473 !wgl_core.smoothScroll.enabled || 474 ( 475 wgl_core && 476 wgl_core.smoothScroll && 477 wgl_core.smoothScroll.disableMac === '1' && 478 navigator.userAgent.includes('Mac OS X') 479 ) 480 ) { 481 jQuery(window).trigger('scroll'); 482 } 483 } 484 485 }, 486 build = function (settings) { 487 appendElement(settings); 488 }; 489 490 /*Init*/ 491 init(); 492 493 }); 494 }; 495 496 // Add WGL Particles Animation 497 $.fn.WGLSectionParticlesInit = function (options) { 498 return this.each(function () { 499 500 var self = $(this), 501 wglParallax = self.wglGlobalVariables('add_particles_animation'); 502 503 var init = function () { 504 setParallaxItem(); 505 }, 506 setParallaxItem = function () { 507 var settings; 508 509 wglParallax.backEndVars = self.settingsEffectEnabled(wglParallax); 510 511 if (!wglParallax.backEndVars) { 512 return; 513 } 514 515 if (!wglParallax.editorMode) { 516 settings = self.buildFront(wglParallax, 'items_particles'); 517 } else {
518 settings = self.buildBackend(wglParallax, 'items_particles'); 519 } 520 521 if (!settings) { 522 return; 523 } 524 525 build(settings); 526 hideMobile(); 527 }, 528 appendElement = function (settings) { 529 var node_str = '', 530 $data_attr = '', 531 $style_attr = ''; 532 533 $data_attr += ' data-particles-colors-type="' + settings.particles_effect + '"'; 534 $data_attr += ' data-particles-number="' + settings.particles_count + '"'; 535 $data_attr += ' data-particles-size="' + settings.particles_max_size + '"'; 536 $data_attr += ' data-particles-speed="' + settings.particles_speed + '"'; 537 538 if(settings.particles_line){ 539 $data_attr += ' data-particles-line="true"'; 540 }else{ 541 $data_attr += ' data-particles-line="false"'; 542 } 543 544 if(settings.particles_hover_animation === 'none'){ 545 $data_attr += ' data-particles-hover="false"'; 546 $data_attr += ' data-particles-hover-mode="grab"'; 547 }else{ 548 $data_attr += ' data-particles-hover="true"'; 549 $data_attr += ' data-particles-hover-mode="' + settings.particles_hover_animation + '"'; 550 } 551 552 if(settings.particles_effect !== 'random_colors'){ 553 if(settings.particles_color_one){ 554 $data_attr += ' data-particles-color="' + settings.particles_color_one + '"'; 555 } 556 }else{ 557 var $color_array = ''; 558 559 if(settings.particles_color_one){ 560 $color_array += settings.particles_color_one; 561 } 562 if(settings.particles_color_second){ 563 $color_array += ',' + settings.particles_color_second; 564 } 565 if(settings.particles_color_third){ 566 $color_array += ',' + settings.particles_color_third; 567 } 568 569 $data_attr += ' data-particles-color="' + $color_array + '"'; 570 } 571 572 $data_attr += ' data-particles-type="particles"'; 573 574 var style_array = '' 575 style_array += 'width:' + settings.particles_width + '%; '; 576 style_array += 'height:' + settings.particles_height + '%;'; 577 578 $style_attr += ' style="' + style_array + '"'; 579 580 node_str = '<div id="extended_' + settings._id + '" data-item-id="' + settings._id + '" class="wgl-particles-js particles-js elementor-repeater-item-' + settings._id + '"' + $data_attr + $style_attr + '>'; 581 node_str += '</div>'; 582 583 584 if (!$(self).find('.elementor-repeater-item-' + settings._id).length > 0) { 585 $(self).append(node_str); 586 } 587 588 var itemContainer = $(self).get(0); 589 $(itemContainer).addClass("wgl-row-animation"); 590 591 wglParallax.items.push(settings); 592 593 var item = jQuery(self).find('.wgl-particles-js'); 594 if (item.length !== 0) { 595 item.each(function () { 596 if (settings._id === jQuery(this).data('itemId')) { 597 //Call Particles WGL Theme 598 if(wglParallax.editorMode){ 599 wglParticlesCustom(); 600 }else{ 601 // Dispatch a custom event 602 const event = new CustomEvent("wglParticlesAdded"); 603 document.dispatchEvent(event); 604 } 605 } 606 }); 607 } 608 }, 609 hideMobile = function () { 610 if (wglParallax.items) { 611 $.each(wglParallax.items, function (index, value) { 612 if (value.hide_particles_on_mobile) { 613 if (jQuery(window).width() <= value.hide_particles_mobile_resolution) { 614 jQuery('.wgl-particles-js[data-item-id="' + value._id + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 615 } else { 616 jQuery('.wgl-particles-js[data-item-id="' + value._id + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 617 } 618 } 619 }); 620 } 621 }, 622 build = function (settings) { 623 $.each(settings, function (index, value) { 624 appendElement(value); 625 }); 626 627 628 }; 629 630 /*Init*/ 631 init(); 632 633 jQuery(window).resize( 634 function () { 635 hideMobile(); 636 } 637 ); 638 }); 639 }; 640 641 // Add WGL Particles Image Animation 642 $.fn.WGLSectionParticlesImageInit = function (options) { 643 return this.each(function () { 644 645 var self = $(this), 646 wglParallax = self.wglGlobalVariables('add_particles_img_animation'); 647 648 var init = function () { 649 setParallaxItem(); 650 }, 651 setParallaxItem = function () { 652 var settings; 653 654 wglParallax.backEndVars = self.settingsEffectEnabled(wglParallax); 655 656 if (!wglParallax.backEndVars) { 657 return; 658 } 659 660 if (!wglParallax.editorMode) { 661 settings = self.buildFront(wglParallax, 'items_particles_img'); 662 } else {
663 settings = self.buildBackend(wglParallax, 'items_particles_img'); 664 } 665 666 if (!settings.length) { 667 return; 668 } 669 670 build(settings); 671 hideMobile(); 672 673 }, 674 675 appendElement = function (settings, uniqId) { 676 677 var node_str = '', 678 $data_attr = '', 679 $style_attr = ''; 680 681 $data_attr += ' data-particles-number="' + wglParallax.backEndVars.particles_img_count + '"'; 682 $data_attr += ' data-particles-speed="' + wglParallax.backEndVars.particles_img_speed + '"'; 683 $data_attr += ' data-particles-color="' + wglParallax.backEndVars.particles_img_color + '"'; 684 $data_attr += ' data-particles-size="' + wglParallax.backEndVars.particles_img_max_size + '"'; 685 $data_attr += ' data-particles-rotate="' + wglParallax.backEndVars.particles_img_rotate + '"'; 686 $data_attr += ' data-particles-rotate-animation="' + wglParallax.backEndVars.particles_img_rotate_speed + '"'; 687 688 if(wglParallax.backEndVars.particles_img_line){ 689 $data_attr += ' data-particles-line="true"'; 690 }else{ 691 $data_attr += ' data-particles-line="false"'; 692 } 693 694 if(wglParallax.backEndVars.particles_img_hover_animation === "none"){ 695 $data_attr += ' data-particles-hover="false"'; 696 $data_attr += ' data-particles-hover-mode="grab"'; 697 }else{ 698 $data_attr += ' data-particles-hover="true"'; 699 $data_attr += ' data-particles-hover-mode="' + wglParallax.backEndVars.particles_img_hover_animation + '"'; 700 } 701 702 $data_attr += ' data-particles-type="image"'; 703 704 var style_array = '' 705 style_array += 'width:' + wglParallax.backEndVars.particles_img_container_width + '%; '; 706 style_array += 'height:' + wglParallax.backEndVars.particles_img_container_height + '%;'; 707 708 $style_attr += ' style="' + style_array + '"'; 709 710 var $string_url = []; 711 $.each(settings, function (index, value) { 712 $string_url.push(value.particles_image.url + '?width=' + value.particles_img_width + '&height=' + value.particles_img_height); 713 }); 714 715 $data_attr += ' data-image="' + $string_url.join() + '"'; 716 717 node_str = '<div id="extended_' + uniqId + '" data-item-id="' + uniqId + '" class="wgl-particles-img-js particles-js elementor-repeater-item-' + uniqId + '"' + $data_attr + $style_attr + '>'; 718 node_str += '</div>'; 719 720 if (!$(self).find('.elementor-repeater-item-' + uniqId).length > 0) { 721 $(self).append(node_str); 722 } 723 724 var itemContainer = $(self).get(0); 725 $(itemContainer).addClass("wgl-row-animation"); 726 727 wglParallax.backEndVars.__itemID = uniqId; 728 729 var item = jQuery(self).find('.wgl-particles-img-js'); 730 731 if (item.length !== 0) { 732 if(wglParallax.editorMode){ 733 wglParticlesImageCustom(); 734 }else{ 735 // Dispatch a custom event 736 const event = new CustomEvent("wglParticlesAdded"); 737 document.dispatchEvent(event); 738 } 739 } 740 }, 741 hideMobile = function () { 742 if (wglParallax.backEndVars) { 743 if (wglParallax.backEndVars.hide_particles_img_on_mobile) { 744 if (jQuery(window).width() <= wglParallax.backEndVars.hide_particles_img_mobile_resolution) { 745 jQuery('.wgl-particles-img-js[data-item-id="' + wglParallax.backEndVars.__itemID + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 746 } else { 747 jQuery('.wgl-particles-img-js[data-item-id="' + wglParallax.backEndVars.__itemID + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 748 } 749 } 750 751 } 752 }, 753 build = function (settings) { 754 var uniqId = Math.random().toString(36).substr(2, 9); 755 appendElement(settings, uniqId); 756 }; 757 758 /*Init*/ 759 init(); 760 761 jQuery(window).resize( 762 function () { 763 hideMobile(); 764 } 765 ); 766 }); 767 }; 768 769 // Add WGL Dynamic Highlights Animation 770 $.fn.WGLSectionDynamicHighlightsInit = function (options) { 771 return this.each(function () { 772 773 var self = $(this), 774 wglDynamicHighlights = self.wglGlobalVariables('add_dynamic_highlights_animation'); 775 776 var initDynamicHighlights = function () { 777 setDynamicHighlightsItem(); 778 }, 779 setDynamicHighlightsItem = function () { 780 var settings; 781 782 wglDynamicHighlights.backEndVars = self.settingsEffectEnabled(wglDynamicHighlights); 783 784 if (!wglDynamicHighlights.backEndVars) { 785 return; 786 } 787 788 if (!wglDynamicHighlights.editorMode) { 789 settings = self.buildFront(wglDynamicHighlights, 'items_dynamic_highlights'); 790 } else {
791 settings = self.buildBackend(wglDynamicHighlights, 'items_dynamic_highlights'); 792 } 793 794 if (!settings) { 795 return; 796 } 797 798 build(settings); 799 hideMobile(); 800 801 }, 802 appendElement = function (settings) { 803 var node_str, 804 $data_attr = '', 805 $style_attr = ''; 806 807 if(settings.dynamic_highlights_color_first){ 808 $data_attr += ' data-dynamic-highlights-color-first="' + settings.dynamic_highlights_color_first + '"'; 809 } 810 if(settings.dynamic_highlights_color_second){ 811 $data_attr += ' data-dynamic-highlights-color-second="' + settings.dynamic_highlights_color_second + '"'; 812 } 813 814 node_str = '<div id="extended_' + settings._id + '" data-item-id="' + settings._id + '" class="wgl-dynamic-highlights-js elementor-repeater-item-' + settings._id + '"' + $data_attr + $style_attr + '>'; 815 node_str += '</div>'; 816 817 818 if (!$(self).find('.elementor-repeater-item-' + settings._id).length > 0) { 819 $(self).append(node_str); 820 } 821 822 var itemContainer = $(self).get(0); 823 $(itemContainer).addClass("wgl-row-animation"); 824 825 wglDynamicHighlights.items.push(settings); 826 827 var item = jQuery(self).find('.wgl-dynamic-highlights-js'); 828 if (item.length !== 0) { 829 item.each(function () { 830 if (settings._id === jQuery(this).data('itemId')) { 831 //Call Particles WGL Theme 832 if(wglDynamicHighlights.editorMode){ 833 jsDynamicHighlights(); 834 } 835 } 836 }); 837 } 838 }, 839 hideMobile = function () { 840 if (wglDynamicHighlights.items) { 841 $.each(wglDynamicHighlights.items, function (index, value) { 842 if (value.hide_dynamic_highlights_on_mobile) { 843 if (jQuery(window).width() <= value.hide_dynamic_highlights_mobile_resolution) { 844 jQuery('.wgl-dynamic-highlights-js[data-item-id="' + value._id + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 845 } else { 846 jQuery('.wgl-dynamic-highlights-js[data-item-id="' + value._id + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 847 } 848 } 849 }); 850 } 851 }, 852 build = function (settings) { 853 $.each(settings, function (index, value) { 854 appendElement(value); 855 }); 856 }, 857 jsDynamicHighlights = function (settings) { 858 var item = jQuery(self).find('.wgl-dynamic-highlights-js'); 859 if (item.length !== 0) { 860 item.each(function () { 861 var $this = jQuery(this), 862 $window = jQuery(window).height(); 863 var color1 = $this.data('dynamic-highlights-color-first'), 864 color2 = $this.data('dynamic-highlights-color-second'); 865 866 if (color1 === color2 || !color1 || !color2) { 867 return; 868 } 869 870 color1 = hexToRGB(color1); 871 color2 = hexToRGB(color2); 872 873 window.addEventListener("scroll", scrollThrottler, {passive: true}); 874 actualScrollHandler(); 875 876 var scrollTimeout; 877 function scrollThrottler() { 878 if (!scrollTimeout) { 879 scrollTimeout = setTimeout(function () { 880 scrollTimeout = null; 881 actualScrollHandler(); 882 }, 33); // 30fps 883 } 884 } 885 886 function actualScrollHandler() { 887 let getheight = $this.height(), 888 offset_top = $this.offset().top, 889 middle_of_item = offset_top - $window + (getheight / 2), 890 scrolly = window.scrollY, 891 scroll = scrolly - middle_of_item; 892 893 if (middle_of_item <= scrolly && offset_top + (getheight / 2) > scrolly) { 894 895 const [r, g, b] = [ 896 color1[0] + ((color2[0] - color1[0]) / $window) * scroll, 897 color1[1] + ((color2[1] - color1[1]) / $window) * scroll, 898 color1[2] + ((color2[2] - color1[2]) / $window) * scroll, 899 ].map(Math.round); 900 901 const [a] = [ 902 color1[3] + ((color2[3] - color1[3]) / $window) * scroll 903 ]; 904 905 $this.css("color", `rgba(${r}, ${g}, ${b}, ${a})`); 906 } 907 } 908 }); 909 } 910 }, 911 hexToRGB = function (h) { 912 if (!h) return [255,255,255,0];
913 let rgba = [255,255,255,1]; 914 915 if (h.length === 4) { 916 // 3 digits 917 rgba[0] = "0x" + h[1] + h[1]; 918 rgba[1] = "0x" + h[2] + h[2]; 919 rgba[2] = "0x" + h[3] + h[3]; 920 921 } else if (h.length === 7) { 922 // 6 digits 923 rgba[0] = "0x" + h[1] + h[2]; 924 rgba[1] = "0x" + h[3] + h[4]; 925 rgba[2] = "0x" + h[5] + h[6]; 926 927 } else if (h.length === 5) { 928 // 4 digits 929 rgba[0] = "0x" + h[1] + h[1]; 930 rgba[1] = "0x" + h[2] + h[2]; 931 rgba[2] = "0x" + h[3] + h[3]; 932 rgba[3] = "0x" + h[4] + h[4]; 933 rgba[3] = +(rgba[3] / 255).toFixed(3); 934 935 } else if (h.length === 9) { 936 // 8 digits 937 rgba[0] = "0x" + h[1] + h[2]; 938 rgba[1] = "0x" + h[3] + h[4]; 939 rgba[2] = "0x" + h[5] + h[6]; 940 rgba[3] = "0x" + h[7] + h[8]; 941 rgba[3] = +(rgba[3] / 255).toFixed(3); 942 943 } 944 rgba[0] = +rgba[0]; 945 rgba[1] = +rgba[1]; 946 rgba[2] = +rgba[2]; 947 948 return rgba; 949 }; 950 951 /*Init*/ 952 initDynamicHighlights(); 953 jsDynamicHighlights(); 954 955 jQuery(window).resize( 956 function () { 957 hideMobile(); 958 } 959 ); 960 }); 961 }; 962 963 // Add WGL Hover Highlights 964 $.fn.WGLSectionHoverHighlightsInit = function (options) { 965 return this.each(function () { 966 967 var self = $(this), 968 wglHoverHighlights = self.wglGlobalVariables('add_hover_highlights_animation'); 969 970 var initHoverHighlights = function () { 971 setHoverHighlightsItem(); 972 }, 973 setHoverHighlightsItem = function () { 974 var settings; 975 976 wglHoverHighlights.backEndVars = self.settingsEffectEnabled(wglHoverHighlights); 977 978 if (!wglHoverHighlights.backEndVars) { 979 return; 980 } 981 982 if (!wglHoverHighlights.editorMode) { 983 settings = self.buildFront(wglHoverHighlights, 'items_hover_highlights'); 984 } else { 985 settings = self.buildBackend(wglHoverHighlights, 'items_hover_highlights'); 986 } 987 988 if (!settings) { 989 return; 990 } 991 992 build(settings); 993 hideMobile(); 994 995 }, 996 appendElement = function (settings) { 997 var node_str, 998 $data_attr = '', 999 $style_attr = ''; 1000 1001 if(settings.hover_highlights_color_first){ 1002 $data_attr += ' data-hover-highlights-color-first="' + settings.hover_highlights_color_first + '"'; 1003 } 1004 if(settings.hover_highlights_color_second){ 1005 $data_attr += ' data-hover-highlights-color-second="' + settings.hover_highlights_color_second + '"'; 1006 } 1007 1008 node_str = '<div id="extended_' + settings._id + '" data-item-id="' + settings._id + '" class="wgl-hover-highlights-js elementor-repeater-item-' + settings._id + '"' + $data_attr + $style_attr + '>'; 1009 node_str += '</div>'; 1010 1011 1012 if (!$(self).find('.elementor-repeater-item-' + settings._id).length > 0) { 1013 $(self).append(node_str); 1014 } 1015 1016 wglHoverHighlights.items.push(settings); 1017 }, 1018 hideMobile = function () { 1019 if (wglHoverHighlights.items) { 1020 $.each(wglHoverHighlights.items, function (index, value) { 1021 if (value.hide_hover_highlights_on_mobile) { 1022 if (jQuery(window).width() <= value.hide_hover_highlights_mobile_resolution) { 1023 jQuery('.wgl-hover-highlights-js[data-item-id="' + value._id + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 1024 } else { 1025 jQuery('.wgl-hover-highlights-js[data-item-id="' + value._id + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 1026 } 1027 } 1028 }); 1029 } 1030 }, 1031 build = function (settings) { 1032 $.each(settings, function (index, value) { 1033 appendElement(value); 1034 }); 1035 }; 1036 1037 initHoverHighlights();
1038 jQuery(window).resize( 1039 function () { 1040 hideMobile(); 1041 } 1042 ); 1043 }); 1044 }; 1045 1046 $.fn.WGLSectionMorphInit = function (options) { 1047 return this.each(function () { 1048 1049 var self = $(this), 1050 wglMorph = self.wglGlobalVariables('add_morph_animation'); 1051 1052 var initMorph = function () { 1053 setMorphItem(); 1054 }, 1055 setMorphItem = function () { 1056 var settings; 1057 1058 var checkEnabledMorph = wglMorph.backEndVars = self.settingsEffectEnabled(wglMorph); 1059 1060 if (!checkEnabledMorph) { 1061 return; 1062 } 1063 1064 if (!wglMorph.editorMode) { 1065 settings = self.buildFront(wglMorph, 'items_morph'); 1066 } else { 1067 settings = self.buildBackend(wglMorph, 'items_morph'); 1068 } 1069 1070 if (!settings) { 1071 return; 1072 } 1073 1074 build(settings); 1075 hideMobile(); 1076 1077 }, 1078 appendElement = function (settings) { 1079 var $morph_value_1 = 'M161.5,95.7c-0.6-1.5-1.2-2.9-1.9-4.3c-4.1-8.1-4.7-17.5-2.1-26.6c3.8-13.2,1.3-20.5,0.1-25.1' + 1080 'c-3.2-12.6-12.8-20.4-15.4-22.4C126.5,5,105.2,5.7,90.9,11.8c-0.2,0.1-0.1,0-0.5,0.2c-12.2,5.3-25,9.3-38,11.1' + 1081 'c-6.4,0.9-12.8,2.9-18.9,6.3C10.4,41.9-0.2,68.5,8.9,90.6c6,14.4,18.7,23.8,33.4,26.8c11.1,2.3,20.3,9,24.8,18.7' + 1082 'c0.1,0.3,0.3,0.6,0.4,0.9c11.6,24,42.7,32.7,68.6,19C158.9,144,169.9,117.9,161.5,95.7z;' + 1083 1084 'M163.7,95.5c0.2-2,0.3-4,0.3-4c0.5-7.2,1.2-15.6,0.3-24.7c-1.1-12-4.4-21.6-6.6-27.1c-2.4-5.8-4-9.7-7.1-13.8' + 1085 'C138.2,9.3,113.4,3.8,95.3,8.2c-2.5,0.6-1.8,0.6-6.7,2c-16.3,4.5-23.5,3.9-32.3,6.3c0,0-12.6,3.5-23,12.9' + 1086 'c-17.4,16-26.2,47.3-14.7,63.4c8.4,11.8,20.7,5.7,29,19.7c3.5,5.9,5.8,14.5,15.3,24.7c0,0,1.4,1.5,3,3c9.4,8.8,52.1,35.9,76.3,19.3' + 1087 'C158.7,148.2,161.3,120.5,163.7,95.5z;' + 1088 1089 'M161.5,95.7c-0.3-0.7-0.8-2.2-1.9-4.3c-4.1-8.1-4.7-17.5-2.1-26.6c3.8-13.2,1.3-20.5,0.1-25.1' + 1090 'c-3.2-12.6-12.8-20.4-15.4-22.4c-15.7-12.3-37-11.6-51.3-5.5c-0.2,0.1-0.1,0-0.5,0.2c-12.2,5.3-25,9.3-38,11.1' + 1091 'C46,24,39.6,26,33.5,29.4C14,40.3-1,72.5,8.9,90.6c11.4,21,51.5,14.4,57.8,36.1c1.1,3.9,0.8,7.3,0.4,9.4c0.1,0.3,0.3,0.6,0.4,0.9' + 1092 'c12.2,24.8,41.2,35.8,65.5,26.3C166.2,150.1,167.2,107.6,161.5,95.7z;' + 1093 1094 'M161.5,95.7c-0.6-1.5-1.2-2.9-1.9-4.3c-4.1-8.1-4.7-17.5-2.1-26.6c3.8-13.2,1.3-20.5,0.1-25.1' + 1095 'c-3.2-12.6-12.8-20.4-15.4-22.4C126.5,5,105.2,5.7,90.9,11.8c-0.2,0.1-0.1,0-0.5,0.2c-12.2,5.3-25,9.3-38,11.1' + 1096 'c-6.4,0.9-12.8,2.9-18.9,6.3C10.4,41.9-0.2,68.5,8.9,90.6c6,14.4,18.7,23.8,33.4,26.8c11.1,2.3,20.3,9,24.8,18.7' + 1097 'c0.1,0.3,0.3,0.6,0.4,0.9c11.6,24,42.7,32.7,68.6,19C158.9,144,169.9,117.9,161.5,95.7z'; 1098 1099 var $morph_value_2 = 'M78.8,23.2c-3.5,3-8.7,7.6-14.9,13.3c-8.9,8.3-13.5,12.4-17.5,16.6c-5,5.3-10.5,11-15.9,19c-4.9,7.2-11.9,17.7-14.5,32.8' + 1100 'c-1.4,8.1-3.6,21.1,3.3,34.2c7.9,14.9,22.7,20.5,30.2,23.3c14.7,5.5,27.3,4.4,36,3.5c17.8-1.8,30.5-8.1,37-11.4' + 1101 'c14.4-7.4,22.8-15.7,24.8-17.7c7-7.1,16.6-16.8,15.4-29c-0.3-3.1-1.2-5.6-2-7.3c-3.8-7.8-12-10.7-19.7-21.8c-9.7-13.9,9-32.9,3-47.9' + 1102 'c-2.7-6.7-8.7-10.3-10.8-11.8c-9.6-6.7-19.7-6.7-24-6.7C95.2,12.3,84.5,18.3,78.8,23.2z;' + 1103 1104 'M78.8,23.2c-3.5,3-8.7,7.6-14.9,13.3c-8.9,8.3-13.5,12.4-17.5,16.6c-8.6,9-12.9,13.5-15.9,19c-7,12.9-6.5,25.7-6.2,32.6' + 1105 'c0.3,7.5,0.7,18.7,8,30.7C40,148,50.8,153.8,55,156c6.4,3.3,23.5,12.3,35.7,5.3c9-5.2,5.4-13.5,14.3-20c13.1-9.5,26.7,4.6,42.3-4.7' + 1106 'c9.8-5.8,16.7-18.6,15.4-29c-0.5-3.5-1.4-3.4-2-7.3c-1.8-12.1,7.2-17.3,9.3-28c3.1-16.1-11.2-35.8-25.9-41.7c-5-2-6.1-0.8-12.7-3.7' + 1107 'c-13.5-5.8-13.6-12.6-22.1-14.8C98.4,9.4,86.4,16.7,78.8,23.2z;' + 1108 1109 'M82,8.3c-4.8,3-9.3,11.4-18.1,28.2c-5.2,9.9-5.8,12-10.2,19.5C47.4,66.7,44.3,72,40,76C27.5,87.6,16.6,81.5,8.7,89.7' + 1110 'c-10.8,11.1-6.6,38.7,7,55c20,23.9,57.6,20,64,18.7c0.8-0.2,5.1-1.1,11-2c6.6-1,11.4-1.2,12.7-1.3c13.9-1.1,31.1-16,40.7-27.3' + 1111 'c3.5-4.2,10.2-12.3,14.3-24.3c1.3-3.8,1-4.2,2.4-8c5.1-14.4,11.6-16.6,14-24c4.9-15.3-12.2-40-30.6-45.7c-5.1-1.5-7.5-0.8-12.7-3.7' + 1112 'c-10.8-5.9-10-14.3-18.3-19.7C104.1,1.6,90.5,3,82,8.3z;' + 1113 1114 'M78.8,23.2c-3.5,3-8.7,7.6-14.9,13.3c-8.9,8.3-13.5,12.4-17.5,16.6c-5,5.3-10.5,11-15.9,19c-4.9,7.2-11.9,17.7-14.5,32.8' + 1115 'c-1.4,8.1-3.6,21.1,3.3,34.2c7.9,14.9,22.7,20.5,30.2,23.3c14.7,5.5,27.3,4.4,36,3.5c17.8-1.8,30.5-8.1,37-11.4' + 1116 'c14.4-7.4,22.8-15.7,24.8-17.7c7-7.1,16.6-16.8,15.4-29c-0.3-3.1-1.2-5.6-2-7.3c-3.8-7.8-12-10.7-19.7-21.8c-9.7-13.9,9-32.9,3-47.9' + 1117 'c-2.7-6.7-8.7-10.3-10.8-11.8c-9.6-6.7-19.7-6.7-24-6.7C95.2,12.3,84.5,18.3,78.8,23.2z'; 1118 1119 var $morph_value_3 = 'M6.5,39.4C7.9,62.9,6,81.5,3.8,94.8c-2.9,17.7-7.2,30.9,0.4,41.9c5.9,8.5,15.7,11,17.6,11.5' + 1120 'c17.9,4.5,26.2-9.4,64-27c25.6-11.9,39.7-13.9,45.3-28c3.1-7.9,1.9-15.3,1.5-17.3c-2.7-12.7-14.2-21.9-28.5-30.4' + 1121 'c-20-12-39.7-48.3-72-45.2C29.1,0.5,21.6,1.3,15.3,7C3.2,17.7,6,36.7,6.5,39.4z;' + 1122 1123 'M6.5,39.4C7.9,62.9,6,81.5,3.8,94.8c-4.1,24.8-5.6,33.6,0.4,41.9c10.6,14.8,41.6,17.2,56,4.3' +
1124 'c11.2-9.9,4.2-21.5,15.8-31c13.8-11.4,29.9,0.5,45-12.3c9-7.6,11.1-18.4,11.7-21.9c2.5-17.1-9-30.9-16.7-40.1' + 1125 'C92.4,7.4,57-3,32.2,0.2C25,1.1,19.7,3.1,15.3,7C3.2,17.7,6,36.7,6.5,39.4z;' + 1126 1127 'M6.5,39.4C4.9,52.6,3.2,71.6,3.8,94.8c1,39.1,7.2,45.3,10.4,47.7c9.5,7.1,18.1-0.1,46-1.5' + 1128 'c38.4-1.9,56.7,10.1,63.5,0.8c6.6-9.2-9.5-22.7-2.8-44c3.6-11.4,9.7-11.7,11.7-21.9c3.5-17.9-11.9-34.9-16.7-40.1' + 1129 'C91.8,9,56.5,9.9,47.7,10.2c-11.3,0.3-25.1,0.9-34,11.3C8.4,27.6,7,34.8,6.5,39.4z;' + 1130 1131 'M6.5,39.4C7.9,62.9,6,81.5,3.8,94.8c-2.9,17.7-7.2,30.9,0.4,41.9c5.9,8.5,15.7,11,17.6,11.5' + 1132 'c17.9,4.5,26.2-9.4,64-27c25.6-11.9,39.7-13.9,45.3-28c3.1-7.9,1.9-15.3,1.5-17.3c-2.7-12.7-14.2-21.9-28.5-30.4' + 1133 'c-20-12-39.7-48.3-72-45.2C29.1,0.5,21.6,1.3,15.3,7C3.2,17.7,6,36.7,6.5,39.4z'; 1134 1135 var node_str, 1136 $morph_value = '', 1137 $morph_speed = settings.morph_animation_speed ? settings.morph_animation_speed : 10; 1138 1139 wglMorph.items.push(settings); 1140 1141 var morphStyle = settings.morph_style; 1142 switch (morphStyle) { 1143 case 'style_1': 1144 default: 1145 $morph_value = $morph_value_1; 1146 break; 1147 1148 case 'style_2': 1149 $morph_value = $morph_value_2; 1150 break; 1151 1152 case 'style_3': 1153 $morph_value = $morph_value_3; 1154 break; 1155 } 1156 1157 node_str = '<div id="extended_' + settings._id + '" data-item-id="' + settings._id + '" class="wgl-morph-js elementor-repeater-item-' + settings._id + '"' + '>'; 1158 node_str += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 180 180">'; 1159 node_str += '<path d=""><animate repeatCount="indefinite" attributeName="d" dur="' + $morph_speed + '" values="' + $morph_value + '"/></path>'; 1160 node_str += '</svg>'; 1161 node_str += '</div>'; 1162 1163 if (!$(self).find('.elementor-repeater-item-' + settings._id).length > 0) { 1164 $(self).append(node_str); 1165 } 1166 }, 1167 hideMobile = function () { 1168 if (wglMorph.items) { 1169 $.each(wglMorph.items, function (index, value) { 1170 if (value.hide_morph_on_mobile) { 1171 if (jQuery(window).width() <= value.hide_morph_mobile_resolution) { 1172 jQuery('.wgl-morph-js[data-item-id="' + value._id + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 1173 } else { 1174 jQuery('.wgl-morph-js[data-item-id="' + value._id + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 1175 } 1176 } 1177 }); 1178 } 1179 }, 1180 build = function (settings) { 1181 $.each(settings, function (index, value) { 1182 appendElement(value); 1183 }); 1184 }; 1185 1186 /*Init*/ 1187 initMorph(); 1188 1189 jQuery(window).resize( 1190 function () { 1191 hideMobile(); 1192 } 1193 ); 1194 }); 1195 }; 1196 1197 $.fn.WGLSection3DWaveInit = function (options) { 1198 return this.each(function () { 1199 1200 var self = $(this), 1201 settings, 1202 wglWave = self.wglGlobalVariables('add_wave'), 1203 init3DWave = function () { 1204 setWaveItem(); 1205 }, 1206 1207 setWaveItem = function () { 1208 1209 wglWave.backEndVars = self.settingsEffectEnabled(wglWave); 1210 if (!wglWave.backEndVars) { 1211 return; 1212 } 1213 1214 if (!wglWave.editorMode) { 1215 settings = wgl_parallax_settings[0][wglWave.itemId]; 1216 } else {
1217 settings = buildBackendWave().backEndVars; 1218 } 1219 1220 if (!settings) return; 1221 1222 build(settings); 1223 hideWaveOnMobile(settings); 1224 }, 1225 1226 buildBackendWave = function () { 1227 if (!window.elementor.elements.models) return; 1228 1229 return wglWave; 1230 }, 1231 1232 prependElement = function (settings) { 1233 1234 if (!settings) return; 1235 1236 var node_str = '<div id="wgl-elementor-wave-' + wglWave.itemId + '" class="wgl-wave" data-item-id="' + wglWave.itemId + '"></div>'; 1237 $(self).prepend(node_str); 1238 onDocumentReady(settings); 1239 animate(); 1240 }, 1241 build = function (settings) { 1242 prependElement(settings); 1243 }, 1244 1245 idA, camera, scene, renderer, 1246 container, particle, 1247 winHalfX, winHalfY, 1248 height, width, fieldOfView, 1249 aspectRatio, nearPlane, farPlane, 1250 cameraZ, material, 1251 i = 0, 1252 count = 0, 1253 Tau = Math.PI * 2, 1254 mouseX = 0, 1255 mouseY = 0, 1256 amtX = 50, 1257 amtY = 50, 1258 sep = 100, 1259 spriteOpts = {}, 1260 particles = [], 1261 1262 onDocumentReady = function (settings) { 1263 container = document.getElementById('wgl-elementor-wave-' + wglWave.itemId); 1264 height = container.parentElement.clientHeight; 1265 winHalfY = height / 2; 1266 width = container.parentElement.clientWidth; 1267 winHalfX = width / 2; 1268 fieldOfView = 75; 1269 aspectRatio = width / height; 1270 nearPlane = 1; 1271 farPlane = 10000; 1272 cameraZ = 750; 1273 1274 rendererer(onRendererRenderered,settings); 1275 }, 1276 rendererer = function (complete,settings) { 1277 var maxX = settings.wave_dots_max_x && settings.wave_dots_max_x['size'] ? settings.wave_dots_max_x['size'] : null, 1278 maxY = settings.wave_dots_max_y && settings.wave_dots_max_y['size'] ? settings.wave_dots_max_y['size'] : null, 1279 dots_color = !!settings.wave_dots_color ? settings.wave_dots_color : '#000', 1280 bg_color = !!settings.wave_bg_color ? settings.wave_bg_color : '#000'; 1281 1282 //lights (no lights!) camera, action! 1283 camera = new THREE.PerspectiveCamera(fieldOfView, aspectRatio, nearPlane, farPlane); 1284 camera.position.z = cameraZ; 1285 camera.position.x = maxX; 1286 camera.position.y = maxY; 1287 1288 scene = new THREE.Scene(); 1289 1290 //material settings 1291 spriteOpts = { 1292 color: dots_color, 1293 program: function (ctx) { 1294 ctx.beginPath(); 1295 ctx.arc(0, 0, 0.5, 0, Tau, true); 1296 ctx.fill(); 1297 } 1298 }; 1299 1300 material = new THREE.SpriteCanvasMaterial(spriteOpts); 1301 1302 // Stop! particle time! 1303 for (var ix = 0, lx = amtX; ix < lx; ix++) { 1304 1305 for (var iy = 0, ly = amtY; iy < ly; iy++) { 1306 particle = particles[i++] = new THREE.Sprite(material); 1307 particle.position.x = ix * sep - ((amtX * sep) / 2); 1308 particle.position.z = iy * sep - ((amtY * sep) / 2); 1309 scene.add(particle); 1310 } 1311 } 1312 1313 //render the scene 1314 renderer = new THREE.CanvasRenderer(); 1315 renderer.setClearColor(bg_color, 1); 1316 1317 renderer.setPixelRatio(window.devicePixelRatio); 1318 renderer.setSize(width, height); 1319 1320 // append the rendered scene to the container 1321 container.appendChild(renderer.domElement); 1322
1323 // Scene! 1324 if (complete) { 1325 complete(settings); 1326 } 1327 }, 1328 onRendererRenderered = function (settings) { 1329 // bind events 1330 if (settings.wave_mouse_manipulation) { 1331 document.addEventListener('mousemove', onDocumentMouseMove); 1332 document.addEventListener('touchstart', onDocumentTouchStart); 1333 document.addEventListener('touchmove', onDocumentTouchMove); 1334 } 1335 window.addEventListener('resize', onWindowResize ); 1336 window.wglWaveSettings = settings; 1337 }, 1338 onDocumentMouseMove = function (e) { 1339 mouseX = e.clientX - winHalfX; 1340 mouseY = e.clientY - winHalfY; 1341 }, 1342 onDocumentTouchStart = function (e) { 1343 if (e.touches.length === 1) { 1344 e.preventDefault(); 1345 mouseX = e.touches[0].pageX - winHalfX; 1346 mouseY = e.touches[0].pageY - winHalfY; 1347 } 1348 }, 1349 onDocumentTouchMove = function (e) { 1350 if (e.touches.length === 1) { 1351 e.preventDefault(); 1352 mouseX = e.touches[0].pageX - winHalfX; 1353 mouseY = e.touches[0].pageY - winHalfY; 1354 } 1355 }, 1356 onWindowResize = function (event) { 1357 settings = event.currentTarget.wglWaveSettings; 1358 // update variables to new values 1359 container = document.getElementById('wgl-elementor-wave-' + wglWave.itemId); 1360 height = container.parentElement.clientHeight; 1361 winHalfY = height / 2; 1362 width = container.parentElement.clientWidth; 1363 winHalfX = width / 2; 1364 1365 camera.aspect = width / height; 1366 camera.updateProjectionMatrix(); 1367 renderer.setSize(width, height); 1368 hideWaveOnMobile(settings); 1369 if (wglWave.editorMode) { 1370 update(settings); 1371 } 1372 }, 1373 animate = function () { 1374 1375 idA = window.requestAnimationFrame(animate); 1376 if (wglWave.editorMode) { 1377 cancelAnimationFrame(idA); 1378 } 1379 1380 if (!(settings.wave_hide_on_mobile && jQuery(window).width() <= settings.wave_hide_mobile_resolution)) { // disable on mobile 1381 update(settings); 1382 } 1383 }, 1384 hideWaveOnMobile = function (settings) { 1385 if (settings.wave_hide_on_mobile) { 1386 if (jQuery(window).width() <= settings.wave_hide_mobile_resolution) { 1387 jQuery('.wgl-wave[data-item-id="' + wglWave.itemId + '"]').css({ 'visibility': 'hidden' }); 1388 } else { 1389 jQuery('.wgl-wave[data-item-id="' + wglWave.itemId + '"]').css({ 'visibility': 'visible' }); 1390 } 1391 } 1392 }, 1393 update = function (settings) { 1394 if (settings.wave_mouse_manipulation) { 1395 var maxX = settings.wave_dots_max_X && settings.wave_dots_max_x['size'] ? settings.wave_dots_max_x['size'] : null, 1396 miceX = !!maxX ? maxX + mouseX : mouseX, 1397 maxY = settings.wave_dots_max_y && settings.wave_dots_max_y['size'] ? settings.wave_dots_max_y['size'] : null, 1398 miceY = !!maxY ? maxY + mouseY : mouseY; 1399 1400 camera.position.x += (miceX - camera.position.x) * 0.003; 1401 camera.position.y += (miceY - camera.position.y) * 0.005; 1402 } 1403 camera.lookAt(scene.position); 1404 1405 i = 0; 1406 for (var ix = 0, lx = amtX; ix < lx; ix++) { 1407 1408 for (var iy = 0, ly = amtY; iy < ly; iy++) { 1409 particle = particles[i++]; 1410 particle.position.y = (Math.sin((ix + count) * 0.3) * 50) + (Math.sin((iy + count) * 0.5) * 50); 1411 particle.scale.x = particle.scale.y = (Math.sin((ix + count) * 0.3) + 1) * 4 + (Math.sin((iy + count) * 0.5) + 1) * 4; 1412 scene.add(particle); 1413 } 1414 } 1415 1416 renderer.render(scene, camera); 1417 count += 0.1; 1418 } 1419 1420 /*Init*/ 1421 init3DWave(); 1422 }); 1423 }; 1424 1425 // Add WGL Shape Divider 1426 $.fn.WGLSectionShapeDividerInit = function (options) { 1427 return this.each(function () { 1428 1429 var self = $(this), 1430 wglShapeDivider = { 1431 editorMode: window.elementorFrontend.isEditMode(), 1432 itemId: $(this).data('id'), 1433 options: false, 1434 globalVars: 'add_shape_divider', 1435 backEndVars: [], 1436 items: [], 1437 }; 1438 1439 var init = function () { 1440 setShapeDividerItem(); 1441 }, 1442 setShapeDividerItem = function () { 1443 var settings; 1444 1445 var checkEnabledParallax = ShapeDividerEnabled(); 1446 1447 if (!checkEnabledParallax) { 1448 return; 1449 } 1450 1451 if (!wglShapeDivider.editorMode) { 1452 settings = buildFrontShapeDivider(); 1453 } else {
1454 settings = buildBackendShapeDivider(); 1455 } 1456 1457 if (!settings) { 1458 return; 1459 } 1460 1461 build(settings); 1462 }, 1463 1464 ShapeDividerEnabled = function () { 1465 var settings = {}; 1466 1467 if (!wglShapeDivider.editorMode) { 1468 settings = wgl_parallax_settings[0][wglShapeDivider.itemId]; 1469 1470 if (!settings) { 1471 return; 1472 } 1473 1474 } else { 1475 if (!window.elementor.elements) { 1476 return; 1477 } 1478 1479 if (!window.elementor.elements.models) { 1480 return; 1481 } 1482 1483 window.elementor.elements.models.forEach(function (value) { 1484 if (wglShapeDivider.itemId == value.id) { 1485 wglShapeDivider.backEndVars[wglShapeDivider.itemId] = value.attributes.settings.attributes; 1486 settings = value.attributes.settings.attributes; 1487 } 1488 }); 1489 } 1490 1491 return settings; 1492 }, 1493 1494 buildFrontShapeDivider = function () { 1495 var settings = wgl_parallax_settings[0]; 1496 return settings; 1497 }, 1498 1499 buildBackendShapeDivider = function () { 1500 if (!window.elementor.elements.models) { 1501 return; 1502 } 1503 var arr = []; 1504 arr = wglShapeDivider.backEndVars; 1505 return arr; 1506 }, 1507 getSvgURL = function (fileName) { 1508 var svgURL = wgl_parallax_settings.svgURL + fileName + '.svg'; 1509 return svgURL; 1510 }, 1511 appendElement = function (settings) { 1512 var $item = settings[$(self).data('id')]; 1513 1514 if (!$item) { 1515 return; 1516 } 1517 1518 var node_str = '', 1519 svgURL = ''; 1520 1521 if ($item.wgl_shape_divider_top && $item.wgl_shape_divider_top !== '') { 1522 1523 svgURL = getSvgURL($item.wgl_shape_divider_top); 1524 1525 node_str = '<div class="wgl-divider wgl-elementor-shape wgl-elementor-shape-top"></div>'; 1526 $(self).prepend(node_str); 1527 1528 jQuery.get(svgURL, function (data) { 1529 $(self).find('.wgl-divider.wgl-elementor-shape-top').empty().append(data.childNodes[0]); 1530 }); 1531 } 1532 1533 if ($item.wgl_shape_divider_bottom && $item.wgl_shape_divider_bottom !== '') { 1534 1535 svgURL = getSvgURL($item.wgl_shape_divider_bottom); 1536 1537 node_str = '<div class="wgl-divider wgl-elementor-shape wgl-elementor-shape-bottom"></div>'; 1538 $(self).prepend(node_str); 1539 1540 jQuery.get(svgURL, function (data) { 1541 $(self).find('.wgl-divider.wgl-elementor-shape-bottom').empty().append(data.childNodes[0]); 1542 }); 1543 } 1544 }, 1545 build = function (settings) { 1546 appendElement(settings); 1547 }; 1548 1549 /*Init*/ 1550 init(); 1551 1552 }); 1553 }; 1554 // Add WGL Animate on Scroll 1555 $.fn.WGLSectionAnimateScrollInit = function (options) { 1556 return this.each(function () { 1557 1558 var self = $(this), 1559 settings, 1560 wglAnimScroll = self.wglGlobalVariables('add_extended_animate_scroll'); 1561 1562 var init = function () { 1563 setAnimScrollItem(); 1564 }, 1565 1566 setAnimScrollItem = function () { 1567 wglAnimScroll.backEndVars = self.settingsEffectEnabled(wglAnimScroll); 1568 if (!wglAnimScroll.backEndVars) { 1569 return; 1570 } 1571 1572 if (!wglAnimScroll.editorMode) { 1573 settings = wgl_parallax_settings[0][wglAnimScroll.itemId]; 1574 } else {
1575 settings = buildBackendAnimScroll().backEndVars; 1576 } 1577 1578 if (!settings) return; 1579 build(settings); 1580 }, 1581 1582 buildBackendAnimScroll = function () { 1583 if (!window.elementor.elements.models) return; 1584 1585 return wglAnimScroll; 1586 }, 1587 1588 isElementInViewport = function (el) { 1589 const rect = el.getBoundingClientRect(), 1590 viewportHeight = window.innerHeight; 1591 1592 return (viewportHeight - rect.top) / rect.height; 1593 }, 1594 1595 elementOpacity = function (el, opacity) { 1596 return Math.round( Math.min(1, Math.max( opacity, isElementInViewport(el) ) ) * 10000 ) / 10000; 1597 }, 1598 elementRotate = function (el, rotate) { 1599 return rotate - (rotate * ( Math.round( Math.min(1, Math.max( 0, isElementInViewport(el) ) ) * 10000 ) / 10000 ) ); 1600 }, 1601 1602 handleScroll = function (settings) { 1603 const animatedSection = self.get(0); 1604 let opacity = !(settings.extended_animate_scroll_opacity && settings.extended_animate_scroll_opacity['size']) ? 1 : settings.extended_animate_scroll_opacity['size'], 1605 1606 rotate = !(settings.extended_animate_scroll_rotate && settings.extended_animate_scroll_rotate['size']) ? 0 : settings.extended_animate_scroll_rotate['size']; 1607 1608 jQuery(animatedSection).css({ 1609 '--wgl-anim-scroll-opacity': elementOpacity(animatedSection, opacity), 1610 '--wgl-anim-scroll-rotate': elementRotate(animatedSection, rotate) + 'deg', 1611 }); 1612 }, 1613 1614 build = function (settings) { 1615 handleScroll(settings); 1616 document.addEventListener('scroll', function(){ handleScroll(settings) }, false); 1617 }; 1618 1619 init(); 1620 }); 1621 }; 1622 1623 // Add WGL Layered 1624 (function () { 1625 window.WGLLayeredInstances = window.WGLLayeredInstances || new Map(); 1626 window.WGLLastInnerWidth = window.WGLLastInnerWidth || window.innerWidth; 1627 1628 if (!window.WGLLayeredResizeRegistered) { 1629 let resizeTimer = null; 1630 let rafScheduled = false; 1631 1632 function handleResize() { 1633 clearTimeout(resizeTimer); 1634 resizeTimer = setTimeout(function () { 1635 if (!rafScheduled) { 1636 rafScheduled = true; 1637 requestAnimationFrame(function () { 1638 window.WGLLayeredInstances.forEach(function (inst) { 1639 try { 1640 inst.reinit(); 1641 } catch (e) { 1642 console.warn('WGLLayered reinit error', e); 1643 } 1644 }); 1645 requestAnimationFrame(function () { 1646 if ( 1647 typeof ScrollTrigger !== 'undefined' && 1648 ScrollTrigger.refresh 1649 ) { 1650 ScrollTrigger.refresh(); 1651 } 1652 }); 1653 rafScheduled = false; 1654 }); 1655 } 1656 }, 150); 1657 } 1658 1659 if (!('ontouchstart' in window)) { 1660 window.addEventListener('resize', handleResize, { passive: true }); 1661 } 1662 window.addEventListener('orientationchange', handleResize, { passive: true }); 1663 window.WGLLayeredResizeRegistered = true; 1664 } 1665 1666 $.fn.WGLSectionLayeredInit = function (options) { 1667 return this.each(function () { 1668 const self = jQuery(this); 1669 const itemId = self.data('id'); 1670 if (!itemId) return; 1671 1672 let instance = window.WGLLayeredInstances.get(itemId); 1673 if (!instance) { 1674 instance = { 1675 id: itemId, 1676 el: self, 1677 tween: null, 1678 pinST: null, 1679 inited: false, 1680 1681 kill: function () { 1682 try { 1683 this.tween?.scrollTrigger?.kill(); 1684 } catch (e) {} 1685 try { 1686 this.tween?.kill(); 1687 } catch (e) {} 1688 try { 1689 this.pinST?.kill(); 1690 } catch (e) {} 1691 this.tween = null; 1692 this.pinST = null; 1693 this.inited = false; 1694 }, 1695 1696 init: function () { 1697 if ( 1698 window.elementorFrontend && 1699 window.elementorFrontend.isEditMode && 1700 window.elementorFrontend.isEditMode() 1701 ) { 1702 return; 1703 } 1704 1705 let settings = 1706 typeof wgl_parallax_settings !== 'undefined' && 1707 wgl_parallax_settings[0] 1708 ? wgl_parallax_settings[0][this.id] 1709 : null; 1710 const checkEnabledLayered = function (settings) { 1711 return !!( 1712 settings && 1713 settings.hasOwnProperty('enable_layered') && 1714 '' !== settings.enable_layered 1715 ); 1716 }; 1717 1718 const hasProperty = checkEnabledLayered(settings); 1719 1720 if(!hasProperty){ 1721 return; 1722 } 1723 1724 if ( 1725 typeof gsap !== 'undefined' && 1726 typeof ScrollTrigger !== 'undefined' && 1727 !window.WGLScrollTriggerRegistered && 1728 hasProperty 1729 ) { 1730 gsap.registerPlugin(ScrollTrigger); 1731 ScrollTrigger.config({ 1732 ignoreMobileResize: 'ontouchstart' in window ? true : false, 1733 autoRefreshEvents: 'visibilitychange,resize',
1734 }); 1735 window.WGLScrollTriggerRegistered = true; 1736 } 1737 1738 settings = 1739 typeof wgl_parallax_settings !== 'undefined' && 1740 wgl_parallax_settings[0] 1741 ? wgl_parallax_settings[0] 1742 : {}; 1743 settings = settings[this.id] || {}; 1744 1745 let hideMobile = false; 1746 if ( 1747 hasProperty && 1748 settings['hide_layered_on_mobile'] && 1749 settings['hide_layered_mobile_resolution'] 1750 ) { 1751 if ( 1752 jQuery(window).width() <= 1753 parseInt(settings['hide_layered_mobile_resolution'], 10) 1754 ) { 1755 hideMobile = true; 1756 } 1757 } 1758 1759 if (!hasProperty || hideMobile) { 1760 this.kill(); 1761 gsap.set(this.el, { clearProps: 'all' }); 1762 return; 1763 } 1764 1765 this.kill(); 1766 1767 let layeredTarget = this.el, 1768 layeredStart = 1769 settings['layered_start_position'] === 'custom' 1770 ? settings['layered_custom_start_position'] 1771 : settings['layered_start_position'], 1772 layeredEnd = 1773 settings['layered_end_position'] === 'custom' 1774 ? settings['layered_custom_end_position'] 1775 : settings['layered_end_position'], 1776 layeredEndTrigger = settings['layered_end'], 1777 animationType = settings['add_layered_animate_scroll'], 1778 enabledPinElements = settings['layered_pin_element']; 1779 1780 if (settings['custom_layered_class']) 1781 layeredTarget = settings['custom_layered_class']; 1782 1783 if (enabledPinElements === 'yes') { 1784 this.pinST = ScrollTrigger.create({ 1785 trigger: layeredTarget, 1786 endTrigger: layeredEndTrigger, 1787 pin: this.el, 1788 pinSpacing: false, 1789 start: layeredStart, 1790 end: layeredEnd, 1791 markers: false, 1792 invalidateOnRefresh: true, 1793 }); 1794 } 1795 1796 function buildFilter(settings, prefix) { 1797 const defaults = { 1798 blur: 0, 1799 brightness: 100, 1800 contrast: 100, 1801 grayscale: 0, 1802 hue: 0, 1803 invert: 0, 1804 saturate: 100, 1805 sepia: 0, 1806 }; 1807 const values = Object.fromEntries( 1808 Object.keys(defaults).map(function (k) { 1809 return [k, settings[`${prefix}_${k}`]?.size ?? defaults[k]]; 1810 }) 1811 ); 1812 const isDefault = Object.keys(defaults).every(function (k) { 1813 return values[k] === defaults[k]; 1814 }); 1815 const filter = `blur(${values.blur}px) brightness(${values.brightness}%) contrast(${values.contrast}%) grayscale(${values.grayscale}%) hue-rotate(${values.hue}deg) invert(${values.invert}%) saturate(${values.saturate}%) sepia(${values.sepia}%)`; 1816 return { isDefault, filter }; 1817 } 1818 1819 const start = buildFilter(settings, 'layered_css_filter_start'); 1820 const end = buildFilter(settings, 'layered_css_filter_end'); 1821 1822 let startFilter = {}; 1823 let endFilter = {}; 1824 if (!end.isDefault) { 1825 endFilter.filter = function () { 1826 return end.filter; 1827 }; 1828 startFilter.filter = function () { 1829 return start.isDefault 1830 ? buildFilter(settings, 'layered_css_filter_start').filter 1831 : start.filter; 1832 }; 1833 } else if (!start.isDefault) { 1834 startFilter.filter = function () { 1835 return start.filter; 1836 }; 1837 } 1838 1839 const stConfig = { 1840 trigger: layeredTarget, 1841 start: layeredStart, 1842 end: layeredEnd, 1843 scrub: true, 1844 invalidateOnRefresh: true, 1845 force3D: true, 1846 }; 1847 1848 try { 1849 if (animationType === 'fade') { 1850 this.tween = gsap.fromTo( 1851 this.el, 1852 { 1853 opacity: function () { 1854 return settings['layered_fade_start_opacity']?.size ?? 0; 1855 }, 1856 ...startFilter, 1857 }, 1858 { 1859 opacity: function () { 1860 return settings['layered_fade_end_opacity']?.size ?? 1; 1861 }, 1862 ease: 'none', 1863 ...endFilter, 1864 scrollTrigger: stConfig, 1865 } 1866 ); 1867 } else if (animationType === 'move') { 1868 this.tween = gsap.fromTo( 1869 this.el, 1870 { 1871 rotationX: function () { 1872 return settings['layered_move_rotate_x']?.size ?? -45; 1873 }, 1874 rotationY: function () { 1875 return settings['layered_move_rotate_y']?.size ?? 0; 1876 }, 1877 transformPerspective: function () { 1878 return settings['layered_move_perspective'] ?? 1000; 1879 }, 1880 transformOrigin: 'center center', 1881 opacity: function () { 1882 return settings['layered_fade_start_opacity']?.size ?? 0.5; 1883 }, 1884 ...startFilter, 1885 }, 1886 { 1887 rotationX: 0, 1888 rotationY: 0, 1889 opacity: function () { 1890 return settings['layered_fade_end_opacity']?.size ?? 1; 1891 }, 1892 ...endFilter, 1893 ease: 'none', 1894 scrollTrigger: stConfig, 1895 } 1896 ); 1897 } else if (animationType === 'zoom') { 1898 this.tween = gsap.fromTo( 1899 this.el, 1900 { 1901 scale: function () { 1902 return settings['layered_zoom_start_scale']?.size ?? 1; 1903 }, 1904 opacity: function () { 1905 return settings['layered_fade_start_opacity']?.size ?? 1; 1906 }, 1907 transformOrigin: 'center center', 1908 ...startFilter, 1909 }, 1910 { 1911 scale: function () { 1912 return settings['layered_zoom_end_scale']?.size ?? 0.9; 1913 }, 1914 opacity: function () { 1915 return settings['layered_fade_end_opacity']?.size ?? 1; 1916 }, 1917 ease: 'none', 1918 ...endFilter, 1919 scrollTrigger: stConfig, 1920 } 1921 ); 1922 } 1923 } catch (e) { 1924 console.warn('tween create err', e); 1925 } 1926 1927 if (typeof elementorFrontend !== 'undefined' && elementorFrontend.elementsHandler) { 1928 requestAnimationFrame(() => { 1929 requestAnimationFrame(() => { 1930 this.el.find('.elementor-invisible').each(function () { 1931 const $widget = jQuery(this); 1932 elementorFrontend.elementsHandler.runReadyTrigger($widget[0]); 1933 }); 1934 }); 1935 }); 1936 } 1937 1938 this.el.css('transition', 'none'); 1939 this.inited = true; 1940 }, 1941 1942 reinit: function () { 1943 this.kill(); 1944 this.init(); 1945 }, 1946 }; 1947 1948 window.WGLLayeredInstances.set(itemId, instance); 1949 } 1950 1951 instance.el = self; 1952 try { 1953 instance.init(); 1954 } catch (e) { 1955 console.warn('instance.init error', e); 1956 } 1957 }); 1958 }; 1959 })(); 1960}(jQuery, window));
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.