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 function wglExtensionsParallax(){ 12 function WGLSectionParallax($scope) { 13 $scope.WGLSectionParallaxInit(); 14 $scope.WGLSectionParallaxColInit(); 15 $scope.WGLSectionParticlesInit(); 16 $scope.WGLSectionParticlesImageInit(); 17 $scope.WGLSectionDynamicHighlightsInit(); 18 $scope.WGLSectionHoverHighlightsInit(); 19 $scope.WGLSectionMorphInit(); 20 $scope.WGLSection3DWaveInit(); 21 $scope.WGLSectionShapeDividerInit(); 22 $scope.WGLSectionAnimateScrollInit(); 23 } 24 window.elementorFrontend.hooks.addAction('frontend/element_ready/section', WGLSectionParallax); 25 window.elementorFrontend.hooks.addAction('frontend/element_ready/container', WGLSectionParallax); 26 } 27 28 function wglExtensionsEditorStyle(){ 29 if(wgl_parallax_settings.elementorPro){ 30 return; 31 } 32 33 var globaPageSettings = true; 34 35 elementorFrontend.hooks.addFilter('editor/style/styleText', addCustomCss); 36 if(window.elementorFrontend.isEditMode()){ 37 elementorFrontend.hooks.addAction('frontend/element_ready/global', elementReady); 38 elementor.settings.page.model.on('change', changePageSettings); 39 } 40 41 function addCustomCss(css, context) { 42 if (!context) { 43 return; 44 } 45 var model = context.getEditModel(), 46 customCSS = model.get('settings').get('custom_css'); 47 var selector = '.elementor-element.elementor-element-' + model.get('id'); 48 if ('document' === model.get('elType')) { 49 selector = elementor.config.document.settings.cssWrapperSelector; 50 } 51 if (customCSS) { 52 css += customCSS.replace(/selector/g, selector); 53 } 54 return css; 55 } 56 57 function elementReady($scope){ 58 return $scope.each(function () { 59 var id = $(this).data('id'); 60 var obj = window.elementorFrontend.config.elements.data; 61 62 Object.entries(obj).forEach(entry => { 63 const [key, value] = entry; 64 65 for (var prop in value._listeners) { 66 var dataID = value._listeners[prop].listener.$el.get(0).dataset.id; 67 if(id === dataID){ 68 value.__itemID = dataID; 69 70 setTimeout(function () { 71 elementor.$previewContents.find('#elementor-style-' + value.__itemID).append(value.attributes.custom_css); 72 }, 1); 73 74 obj[key].on('change textInput input', onSettingsChange.bind(value)); 75 } 76 } 77 }); 78 79 if(globaPageSettings){ 80 var customCSS = elementor.settings.page.model.get('custom_css'); 81 if (customCSS) { 82 customCSS = customCSS.replace(/selector/g, elementor.config.settings.page.cssWrapperSelector); 83 elementor.settings.page.getControlsCSS().elements.$stylesheetElement.append(customCSS); 84 globaPageSettings = false; 85 } 86 } 87 }); 88 } 89 90 function onSettingsChange($scope){ 91 Object.entries($scope).forEach(entry => { 92 const [key, value] = entry; 93 if(key === 'changed' && value.custom_css){ 94 appendStyle($scope, value); 95 }else if(key === 'attributes' && value.custom_css){ 96 appendStyle($scope, value); 97 } 98 }); 99 } 100 101 function appendStyle($scope, value){ 102 setTimeout(function(){ 103 var styleElement = jQuery('#elementor-style-' + $scope.__itemID).text(); 104 jQuery('#elementor-style-' + $scope.__itemID).empty().append(styleElement + value.custom_css); 105 }, 1); 106 } 107 108 function changePageSettings() { 109 var customCSS = elementor.settings.page.model.get('custom_css'); 110 if (customCSS) {
111 customCSS = customCSS.replace(/selector/g, elementor.config.settings.page.cssWrapperSelector); 112 setTimeout(function(){ 113 elementor.settings.page.getControlsCSS().elements.$stylesheetElement.append(customCSS); 114 }, 1); 115 } 116 } 117 } 118 119 function wglExtensionsColumn(){ 120 if ( window.elementorFrontend.isEditMode() ) { 121 window.elementorFrontend.hooks.addAction( 'frontend/element_ready/column', 122 function( $scope ){ 123 wglStickySidebar(); 124 } 125 ); 126 } 127 } 128 129 function wglElementorExtensions (){ 130 131 jQuery.fn.is_visible = function (){ 132 var elementTop = jQuery(this).offset().top; 133 var elementBottom = elementTop + jQuery(this).outerHeight(); 134 var viewportTop = jQuery(window).scrollTop(); 135 var viewportBottom = viewportTop + jQuery(window).height(); 136 return elementBottom > viewportTop && elementTop < viewportBottom; 137 } 138 139 jQuery.fn.wglGlobalVariables = function (globalSetting){ 140 var settings = { 141 editorMode: window.elementorFrontend.isEditMode(), 142 itemId: $(this).data('id'), 143 options: false, 144 globalVars: globalSetting, 145 backEndVars: null, 146 items: [], 147 }; 148 149 return settings; 150 } 151 152 function findNodeItem(id, currentNode) { 153 let i, 154 currentChild, 155 result; 156 157 if (String(id) === String(currentNode.id)) { 158 return currentNode; 159 } else { 160 for (i = 0; i < currentNode.attributes.elements.models.length; i += 1) { 161 currentChild = currentNode.attributes.elements.models[i]; 162 result = findNodeItem(id, currentChild); 163 if (result !== false) { 164 return result; 165 } 166 } 167 return false; 168 } 169 } 170 171 jQuery.fn.settingsEffectEnabled = function (option){ 172 var settings = {}; 173 174 175 if (!option.editorMode) { 176 settings = wgl_parallax_settings[0][option.itemId]; 177 178 if ( 179 settings 180 && (!settings.hasOwnProperty(option.globalVars) 181 || !settings[option.globalVars]) 182 ) { 183 return; 184 } 185 } else { 186 187 if ( 188 !window.elementor.elements 189 && !window.elementor.elements.models 190 ) { 191 return; 192 } 193 194 window.elementor.elements.models.forEach(function (value) { 195 if(findNodeItem(option.itemId, value)){ 196 option.backEndVars = findNodeItem(option.itemId, value).attributes.settings.attributes; 197 } 198 }); 199 200 if ( 201 option.backEndVars 202 && (!option.backEndVars.hasOwnProperty(option.globalVars) 203 || !option.backEndVars[option.globalVars]) 204 ) { 205 return; 206 } 207 208 settings = option.backEndVars; 209 } 210 211 return settings; 212 } 213 214 jQuery.fn.buildFront = function (option, value) { 215 var settings = wgl_parallax_settings[0][option.itemId]; 216 settings = settings[value]; 217 return settings; 218 } 219 220 jQuery.fn.buildBackend = function (option, value) { 221 if (!window.elementor.elements.models 222 && !option.backEndVars.hasOwnProperty(value) 223 ) 224 { 225 return; 226 } 227 228 var arr = []; 229 230 option.backEndVars[value].models.forEach(function (val) { 231 arr.push(val.attributes); 232 }); 233 234 return arr; 235 } 236 } 237 238 // Add WGL Parallax Section 239 $.fn.WGLSectionParallaxInit = function (options) { 240 241 return this.each(function () { 242 243 var self = $(this), 244 wglParallax = self.wglGlobalVariables('add_background_animation'); 245 246 var init = function () { 247 setParallaxItem(); 248 }, 249 setParallaxItem = function () { 250 var settings; 251 252 wglParallax.backEndVars = self.settingsEffectEnabled(wglParallax); 253 254 if (!wglParallax.backEndVars) { 255 return; 256 } 257 258 if (!wglParallax.editorMode) { 259 settings = self.buildFront(wglParallax, 'items_parallax'); 260 } else {
261 settings = self.buildBackend(wglParallax, 'items_parallax'); 262 } 263 264 if (!settings) { 265 return; 266 } 267 268 build(settings); 269 hideMobile(); 270 271 }, 272 273 appendElement = function (settings) { 274 var node_str = ''; 275 276 if (settings.image_bg.url) { 277 node_str = '<div data-item-id="' + settings._id + '" class="extended-parallax elementor-repeater-item-' + settings._id + '">'; 278 279 if (settings.parallax_image_mask_color) { 280 node_str += '<div class="wgl_mask_image" style="-webkit-mask-image:url(' + settings.image_bg.url + ');">'; 281 } 282 283 node_str += '<img src="' + settings.image_bg.url + '" alt="' + settings.image_bg.alt + '"/>'; 284 285 if (settings.parallax_image_mask_color) { 286 node_str += '</div>'; 287 } 288 289 node_str += '</div>'; 290 } 291 292 if (!$(self).find('.elementor-repeater-item-' + settings._id).length > 0) { 293 $(self).append(node_str); 294 } 295 296 wglParallax.items.push(settings); 297 298 var item = jQuery(self).find('.extended-parallax'); 299 if (item.length !== 0) { 300 item.each(function () { 301 var $this = jQuery(this); 302 if (settings._id === $this.data('itemId')) { 303 if (settings.image_effect === 'mouse') { 304 if (!$this.closest('.elementor-section').hasClass('wgl-parallax-mouse')) { 305 $this.closest('.elementor-section').addClass('wgl-parallax-mouse'); 306 } 307 if(!$this.closest('.e-con').hasClass('wgl-parallax-mouse')){ 308 $this.closest('.e-con').addClass('wgl-parallax-mouse'); 309 } 310 311 $this.wrapInner('<div class="wgl-parallax-layer layer" data-depth="' + settings.parallax_factor + '"></div>'); 312 } else if (settings.image_effect === 'scroll') { 313 if (wglParallax.editorMode) { 314 $this.paroller({ 315 factor: settings.parallax_factor, 316 type: 'foreground', // background, foreground 317 direction: settings.parallax_dir, // vertical, horizontal 318 319 }); 320 $this.css({ 'transform': 'unset' }); 321 } else { 322 $this.paroller({ 323 factor: settings.parallax_factor, 324 type: 'foreground', // background, foreground 325 direction: settings.parallax_dir, // vertical, horizontal 326 327 }); 328 } 329 } else if (settings.image_effect === 'css_animation') { 330 let self = $(this), 331 image = self.find('img'), 332 maskImage = self.find('.wgl_mask_image'); 333 334 self.addClass('wgl_animation_item'); 335 if (self.is_visible() && image.length !== 0) { 336 if(maskImage.length !== 0) maskImage.addClass(settings.animation_name); 337 else image.addClass(settings.animation_name); 338 } 339 jQuery(window).on('resize scroll', function () { 340 if (self.is_visible() && image.length !== 0) { 341 if(maskImage.length !== 0) maskImage.addClass(settings.animation_name); 342 else image.addClass(settings.animation_name); 343 } 344 }); 345 } 346 } 347 }); 348 349 if (settings.image_effect === 'mouse') { 350 jQuery('.wgl-parallax-mouse').each(function () { 351 var scene = jQuery(this).get(0); 352 var parallaxInstance = new Parallax(scene, { hoverOnly: true, selector: '.wgl-parallax-layer', pointerEvents: true });
353 }); 354 } 355 } 356 }, 357 hideMobile = function () { 358 if (wglParallax.items) { 359 $.each(wglParallax.items, function (index, value) { 360 if (value.hide_on_mobile) { 361 if (jQuery(window).width() <= value.hide_mobile_resolution) { 362 jQuery('.extended-parallax[data-item-id="' + value._id + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 363 } else { 364 jQuery('.extended-parallax[data-item-id="' + value._id + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 365 } 366 } 367 }); 368 } 369 }, 370 build = function (settings) { 371 $.each(settings, function (index, value) { 372 appendElement(value); 373 }); 374 }; 375 376 /*Init*/ 377 init(); 378 379 jQuery(window).resize( 380 function () { 381 hideMobile(); 382 } 383 ); 384 }); 385 }; 386 387 // Add WGL Parallax Section 388 $.fn.WGLSectionParallaxColInit = function (options) { 389 390 return this.each(function () { 391 392 var self = $(this), 393 settings, 394 wglParallax = self.wglGlobalVariables('add_section_parallax'); 395 396 var init = function () { 397 setParallaxItem(); 398 }, 399 setParallaxItem = function () { 400 401 wglParallax.backEndVars = self.settingsEffectEnabled(wglParallax); 402 403 if (!wglParallax.backEndVars) { 404 return; 405 } 406 407 if (!wglParallax.editorMode) { 408 settings = wgl_parallax_settings[0][wglParallax.itemId]; 409 } else { 410 settings = buildBackendSectionParallax().backEndVars; 411 } 412 413 if (!settings) { 414 return; 415 } 416 417 build(settings); 418 419 }, 420 421 buildBackendSectionParallax = function () { 422 if (!window.elementor.elements.models) return; 423 424 return wglParallax; 425 }, 426 427 appendElement = function (settings) { 428 429 if (!settings) return; 430 431 $(self).addClass('section_parallax'); 432 $(self).attr('data-paroller-factor-lg', settings.section_parallax_factor_tablet); 433 $(self).attr('data-paroller-factor-md', settings.section_parallax_factor_tablet); 434 $(self).attr('data-paroller-factor-sm', settings.section_parallax_factor_mobile); 435 $(self).attr('data-paroller-factor-xs', settings.section_parallax_factor_mobile); 436 437 if (wglParallax.editorMode) { 438 $(self).paroller({ 439 factor: settings.section_parallax_factor, 440 type: 'foreground', // background, foreground 441 direction: settings.section_parallax_dir, // vertical, horizontal 442 }); 443 $(self).css({ 'transform': 'unset' }); 444 } else { 445 $(self).paroller({ 446 factor: settings.section_parallax_factor, 447 type: 'foreground', // background, foreground 448 direction: settings.section_parallax_dir, // vertical, horizontal 449 }); 450 } 451 452 }, 453 build = function (settings) { 454 appendElement(settings); 455 }; 456 457 /*Init*/ 458 init(); 459 460 }); 461 }; 462 463 // Add WGL Particles Animation 464 $.fn.WGLSectionParticlesInit = function (options) { 465 return this.each(function () { 466 467 var self = $(this), 468 wglParallax = self.wglGlobalVariables('add_particles_animation'); 469 470 var init = function () { 471 setParallaxItem(); 472 }, 473 setParallaxItem = function () { 474 var settings; 475 476 wglParallax.backEndVars = self.settingsEffectEnabled(wglParallax); 477 478 if (!wglParallax.backEndVars) { 479 return; 480 } 481 482 if (!wglParallax.editorMode) { 483 settings = self.buildFront(wglParallax, 'items_particles'); 484 } else {
485 settings = self.buildBackend(wglParallax, 'items_particles'); 486 } 487 488 if (!settings) { 489 return; 490 } 491 492 build(settings); 493 hideMobile(); 494 }, 495 appendElement = function (settings) { 496 var node_str = '', 497 $data_attr = '', 498 $style_attr = ''; 499 500 $data_attr += ' data-particles-colors-type="' + settings.particles_effect + '"'; 501 $data_attr += ' data-particles-number="' + settings.particles_count + '"'; 502 $data_attr += ' data-particles-size="' + settings.particles_max_size + '"'; 503 $data_attr += ' data-particles-speed="' + settings.particles_speed + '"'; 504 505 if(settings.particles_line){ 506 $data_attr += ' data-particles-line="true"'; 507 }else{ 508 $data_attr += ' data-particles-line="false"'; 509 } 510 511 if(settings.particles_hover_animation === 'none'){ 512 $data_attr += ' data-particles-hover="false"'; 513 $data_attr += ' data-particles-hover-mode="grab"'; 514 }else{ 515 $data_attr += ' data-particles-hover="true"'; 516 $data_attr += ' data-particles-hover-mode="' + settings.particles_hover_animation + '"'; 517 } 518 519 if(settings.particles_effect !== 'random_colors'){ 520 if(settings.particles_color_one){ 521 $data_attr += ' data-particles-color="' + settings.particles_color_one + '"'; 522 } 523 }else{ 524 var $color_array = ''; 525 526 if(settings.particles_color_one){ 527 $color_array += settings.particles_color_one; 528 } 529 if(settings.particles_color_second){ 530 $color_array += ',' + settings.particles_color_second; 531 } 532 if(settings.particles_color_third){ 533 $color_array += ',' + settings.particles_color_third; 534 } 535 536 $data_attr += ' data-particles-color="' + $color_array + '"'; 537 } 538 539 $data_attr += ' data-particles-type="particles"'; 540 541 var style_array = '' 542 style_array += 'width:' + settings.particles_width + '%; '; 543 style_array += 'height:' + settings.particles_height + '%;'; 544 545 $style_attr += ' style="' + style_array + '"'; 546 547 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 + '>'; 548 node_str += '</div>'; 549 550 551 if (!$(self).find('.elementor-repeater-item-' + settings._id).length > 0) { 552 $(self).append(node_str); 553 } 554 555 var itemContainer = $(self).get(0); 556 $(itemContainer).addClass("wgl-row-animation"); 557 558 wglParallax.items.push(settings); 559 560 var item = jQuery(self).find('.wgl-particles-js'); 561 if (item.length !== 0) { 562 item.each(function () { 563 if (settings._id === jQuery(this).data('itemId')) { 564 //Call Particles WGL Theme 565 if(wglParallax.editorMode){ 566 wglParticlesCustom(); 567 }else{ 568 // Dispatch a custom event 569 const event = new CustomEvent("wglParticlesAdded"); 570 document.dispatchEvent(event); 571 } 572 } 573 }); 574 } 575 }, 576 hideMobile = function () { 577 if (wglParallax.items) { 578 $.each(wglParallax.items, function (index, value) { 579 if (value.hide_particles_on_mobile) { 580 if (jQuery(window).width() <= value.hide_particles_mobile_resolution) { 581 jQuery('.wgl-particles-js[data-item-id="' + value._id + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 582 } else { 583 jQuery('.wgl-particles-js[data-item-id="' + value._id + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 584 } 585 } 586 }); 587 } 588 }, 589 build = function (settings) { 590 $.each(settings, function (index, value) { 591 appendElement(value); 592 }); 593 594 595 }; 596 597 /*Init*/ 598 init(); 599 600 jQuery(window).resize( 601 function () { 602 hideMobile(); 603 } 604 ); 605 }); 606 }; 607 608 // Add WGL Particles Image Animation 609 $.fn.WGLSectionParticlesImageInit = function (options) { 610 return this.each(function () { 611 612 var self = $(this), 613 wglParallax = self.wglGlobalVariables('add_particles_img_animation'); 614 615 var init = function () { 616 setParallaxItem(); 617 }, 618 setParallaxItem = function () { 619 var settings; 620 621 wglParallax.backEndVars = self.settingsEffectEnabled(wglParallax); 622 623 if (!wglParallax.backEndVars) { 624 return; 625 } 626 627 if (!wglParallax.editorMode) { 628 settings = self.buildFront(wglParallax, 'items_particles_img'); 629 } else {
630 settings = self.buildBackend(wglParallax, 'items_particles_img'); 631 } 632 633 if (!settings.length) { 634 return; 635 } 636 637 build(settings); 638 hideMobile(); 639 640 }, 641 642 appendElement = function (settings, uniqId) { 643 644 var node_str = '', 645 $data_attr = '', 646 $style_attr = ''; 647 648 $data_attr += ' data-particles-number="' + wglParallax.backEndVars.particles_img_count + '"'; 649 $data_attr += ' data-particles-speed="' + wglParallax.backEndVars.particles_img_speed + '"'; 650 $data_attr += ' data-particles-color="' + wglParallax.backEndVars.particles_img_color + '"'; 651 $data_attr += ' data-particles-size="' + wglParallax.backEndVars.particles_img_max_size + '"'; 652 $data_attr += ' data-particles-rotate="' + wglParallax.backEndVars.particles_img_rotate + '"'; 653 $data_attr += ' data-particles-rotate-animation="' + wglParallax.backEndVars.particles_img_rotate_speed + '"'; 654 655 if(wglParallax.backEndVars.particles_img_line){ 656 $data_attr += ' data-particles-line="true"'; 657 }else{ 658 $data_attr += ' data-particles-line="false"'; 659 } 660 661 if(wglParallax.backEndVars.particles_img_hover_animation === "none"){ 662 $data_attr += ' data-particles-hover="false"'; 663 $data_attr += ' data-particles-hover-mode="grab"'; 664 }else{ 665 $data_attr += ' data-particles-hover="true"'; 666 $data_attr += ' data-particles-hover-mode="' + wglParallax.backEndVars.particles_img_hover_animation + '"'; 667 } 668 669 $data_attr += ' data-particles-type="image"'; 670 671 var style_array = '' 672 style_array += 'width:' + wglParallax.backEndVars.particles_img_container_width + '%; '; 673 style_array += 'height:' + wglParallax.backEndVars.particles_img_container_height + '%;'; 674 675 $style_attr += ' style="' + style_array + '"'; 676 677 var $string_url = []; 678 $.each(settings, function (index, value) { 679 $string_url.push(value.particles_image.url + '?width=' + value.particles_img_width + '&height=' + value.particles_img_height); 680 }); 681 682 $data_attr += ' data-image="' + $string_url.join() + '"'; 683 684 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 + '>'; 685 node_str += '</div>'; 686 687 if (!$(self).find('.elementor-repeater-item-' + uniqId).length > 0) { 688 $(self).append(node_str); 689 } 690 691 var itemContainer = $(self).get(0); 692 $(itemContainer).addClass("wgl-row-animation"); 693 694 wglParallax.backEndVars.__itemID = uniqId; 695 696 var item = jQuery(self).find('.wgl-particles-img-js'); 697 698 if (item.length !== 0) { 699 if(wglParallax.editorMode){ 700 wglParticlesImageCustom(); 701 }else{ 702 // Dispatch a custom event 703 const event = new CustomEvent("wglParticlesAdded"); 704 document.dispatchEvent(event); 705 } 706 } 707 }, 708 hideMobile = function () { 709 if (wglParallax.backEndVars) { 710 if (wglParallax.backEndVars.hide_particles_img_on_mobile) { 711 if (jQuery(window).width() <= wglParallax.backEndVars.hide_particles_img_mobile_resolution) { 712 jQuery('.wgl-particles-img-js[data-item-id="' + wglParallax.backEndVars.__itemID + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 713 } else { 714 jQuery('.wgl-particles-img-js[data-item-id="' + wglParallax.backEndVars.__itemID + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 715 } 716 } 717 718 } 719 }, 720 build = function (settings) { 721 var uniqId = Math.random().toString(36).substr(2, 9); 722 appendElement(settings, uniqId); 723 }; 724 725 /*Init*/ 726 init(); 727 728 jQuery(window).resize( 729 function () { 730 hideMobile(); 731 } 732 ); 733 }); 734 }; 735 736 // Add WGL Dynamic Highlights Animation 737 $.fn.WGLSectionDynamicHighlightsInit = function (options) { 738 return this.each(function () { 739 740 var self = $(this), 741 wglDynamicHighlights = self.wglGlobalVariables('add_dynamic_highlights_animation'); 742 743 var initDynamicHighlights = function () { 744 setDynamicHighlightsItem(); 745 }, 746 setDynamicHighlightsItem = function () { 747 var settings; 748 749 wglDynamicHighlights.backEndVars = self.settingsEffectEnabled(wglDynamicHighlights); 750 751 if (!wglDynamicHighlights.backEndVars) { 752 return; 753 } 754 755 if (!wglDynamicHighlights.editorMode) { 756 settings = self.buildFront(wglDynamicHighlights, 'items_dynamic_highlights'); 757 } else {
758 settings = self.buildBackend(wglDynamicHighlights, 'items_dynamic_highlights'); 759 } 760 761 if (!settings) { 762 return; 763 } 764 765 build(settings); 766 hideMobile(); 767 768 }, 769 appendElement = function (settings) { 770 var node_str, 771 $data_attr = '', 772 $style_attr = ''; 773 774 if(settings.dynamic_highlights_color_first){ 775 $data_attr += ' data-dynamic-highlights-color-first="' + settings.dynamic_highlights_color_first + '"'; 776 } 777 if(settings.dynamic_highlights_color_second){ 778 $data_attr += ' data-dynamic-highlights-color-second="' + settings.dynamic_highlights_color_second + '"'; 779 } 780 781 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 + '>'; 782 node_str += '</div>'; 783 784 785 if (!$(self).find('.elementor-repeater-item-' + settings._id).length > 0) { 786 $(self).append(node_str); 787 } 788 789 var itemContainer = $(self).get(0); 790 $(itemContainer).addClass("wgl-row-animation"); 791 792 wglDynamicHighlights.items.push(settings); 793 794 var item = jQuery(self).find('.wgl-dynamic-highlights-js'); 795 if (item.length !== 0) { 796 item.each(function () { 797 if (settings._id === jQuery(this).data('itemId')) { 798 //Call Particles WGL Theme 799 if(wglDynamicHighlights.editorMode){ 800 jsDynamicHighlights(); 801 } 802 } 803 }); 804 } 805 }, 806 hideMobile = function () { 807 if (wglDynamicHighlights.items) { 808 $.each(wglDynamicHighlights.items, function (index, value) { 809 if (value.hide_dynamic_highlights_on_mobile) { 810 if (jQuery(window).width() <= value.hide_dynamic_highlights_mobile_resolution) { 811 jQuery('.wgl-dynamic-highlights-js[data-item-id="' + value._id + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 812 } else { 813 jQuery('.wgl-dynamic-highlights-js[data-item-id="' + value._id + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 814 } 815 } 816 }); 817 } 818 }, 819 build = function (settings) { 820 $.each(settings, function (index, value) { 821 appendElement(value); 822 }); 823 }, 824 jsDynamicHighlights = function (settings) { 825 var item = jQuery(self).find('.wgl-dynamic-highlights-js'); 826 if (item.length !== 0) { 827 item.each(function () { 828 var $this = jQuery(this), 829 $window = jQuery(window).height(); 830 var color1 = $this.data('dynamic-highlights-color-first'), 831 color2 = $this.data('dynamic-highlights-color-second'); 832 833 if (color1 === color2 || !color1 || !color2) { 834 return; 835 } 836 837 color1 = hexToRGB(color1); 838 color2 = hexToRGB(color2); 839 840 window.addEventListener("scroll", scrollThrottler, {passive: true}); 841 actualScrollHandler(); 842 843 var scrollTimeout; 844 function scrollThrottler() { 845 if (!scrollTimeout) { 846 scrollTimeout = setTimeout(function () { 847 scrollTimeout = null; 848 actualScrollHandler(); 849 }, 33); // 30fps 850 } 851 } 852 853 function actualScrollHandler() { 854 let getheight = $this.height(), 855 offset_top = $this.offset().top, 856 middle_of_item = offset_top - $window + (getheight / 2), 857 scrolly = window.scrollY, 858 scroll = scrolly - middle_of_item; 859 860 if (middle_of_item <= scrolly && offset_top + (getheight / 2) > scrolly) { 861 862 const [r, g, b] = [ 863 color1[0] + ((color2[0] - color1[0]) / $window) * scroll, 864 color1[1] + ((color2[1] - color1[1]) / $window) * scroll, 865 color1[2] + ((color2[2] - color1[2]) / $window) * scroll, 866 ].map(Math.round); 867 868 const [a] = [ 869 color1[3] + ((color2[3] - color1[3]) / $window) * scroll 870 ]; 871 872 $this.css("color", `rgba(${r}, ${g}, ${b}, ${a})`); 873 } 874 } 875 }); 876 } 877 }, 878 hexToRGB = function (h) { 879 if (!h) return [255,255,255,0];
880 let rgba = [255,255,255,1]; 881 882 if (h.length === 4) { 883 // 3 digits 884 rgba[0] = "0x" + h[1] + h[1]; 885 rgba[1] = "0x" + h[2] + h[2]; 886 rgba[2] = "0x" + h[3] + h[3]; 887 888 } else if (h.length === 7) { 889 // 6 digits 890 rgba[0] = "0x" + h[1] + h[2]; 891 rgba[1] = "0x" + h[3] + h[4]; 892 rgba[2] = "0x" + h[5] + h[6]; 893 894 } else if (h.length === 5) { 895 // 4 digits 896 rgba[0] = "0x" + h[1] + h[1]; 897 rgba[1] = "0x" + h[2] + h[2]; 898 rgba[2] = "0x" + h[3] + h[3]; 899 rgba[3] = "0x" + h[4] + h[4]; 900 rgba[3] = +(rgba[3] / 255).toFixed(3); 901 902 } else if (h.length === 9) { 903 // 8 digits 904 rgba[0] = "0x" + h[1] + h[2]; 905 rgba[1] = "0x" + h[3] + h[4]; 906 rgba[2] = "0x" + h[5] + h[6]; 907 rgba[3] = "0x" + h[7] + h[8]; 908 rgba[3] = +(rgba[3] / 255).toFixed(3); 909 910 } 911 rgba[0] = +rgba[0]; 912 rgba[1] = +rgba[1]; 913 rgba[2] = +rgba[2]; 914 915 return rgba; 916 }; 917 918 /*Init*/ 919 initDynamicHighlights(); 920 jsDynamicHighlights(); 921 922 jQuery(window).resize( 923 function () { 924 hideMobile(); 925 } 926 ); 927 }); 928 }; 929 930 // Add WGL Hover Highlights 931 $.fn.WGLSectionHoverHighlightsInit = function (options) { 932 return this.each(function () { 933 934 var self = $(this), 935 wglHoverHighlights = self.wglGlobalVariables('add_hover_highlights_animation'); 936 937 var initHoverHighlights = function () { 938 setHoverHighlightsItem(); 939 }, 940 setHoverHighlightsItem = function () { 941 var settings; 942 943 wglHoverHighlights.backEndVars = self.settingsEffectEnabled(wglHoverHighlights); 944 945 if (!wglHoverHighlights.backEndVars) { 946 return; 947 } 948 949 if (!wglHoverHighlights.editorMode) { 950 settings = self.buildFront(wglHoverHighlights, 'items_hover_highlights'); 951 } else { 952 settings = self.buildBackend(wglHoverHighlights, 'items_hover_highlights'); 953 } 954 955 if (!settings) { 956 return; 957 } 958 959 build(settings); 960 hideMobile(); 961 962 }, 963 appendElement = function (settings) { 964 var node_str, 965 $data_attr = '', 966 $style_attr = ''; 967 968 if(settings.hover_highlights_color_first){ 969 $data_attr += ' data-hover-highlights-color-first="' + settings.hover_highlights_color_first + '"'; 970 } 971 if(settings.hover_highlights_color_second){ 972 $data_attr += ' data-hover-highlights-color-second="' + settings.hover_highlights_color_second + '"'; 973 } 974 975 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 + '>'; 976 node_str += '</div>'; 977 978 979 if (!$(self).find('.elementor-repeater-item-' + settings._id).length > 0) { 980 $(self).append(node_str); 981 } 982 983 wglHoverHighlights.items.push(settings); 984 }, 985 hideMobile = function () { 986 if (wglHoverHighlights.items) { 987 $.each(wglHoverHighlights.items, function (index, value) { 988 if (value.hide_hover_highlights_on_mobile) { 989 if (jQuery(window).width() <= value.hide_hover_highlights_mobile_resolution) { 990 jQuery('.wgl-hover-highlights-js[data-item-id="' + value._id + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 991 } else { 992 jQuery('.wgl-hover-highlights-js[data-item-id="' + value._id + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 993 } 994 } 995 }); 996 } 997 }, 998 build = function (settings) { 999 $.each(settings, function (index, value) { 1000 appendElement(value); 1001 }); 1002 }; 1003 1004 initHoverHighlights();
1005 jQuery(window).resize( 1006 function () { 1007 hideMobile(); 1008 } 1009 ); 1010 }); 1011 }; 1012 1013 $.fn.WGLSectionMorphInit = function (options) { 1014 return this.each(function () { 1015 1016 var self = $(this), 1017 wglMorph = self.wglGlobalVariables('add_morph_animation'); 1018 1019 var initMorph = function () { 1020 setMorphItem(); 1021 }, 1022 setMorphItem = function () { 1023 var settings; 1024 1025 var checkEnabledMorph = wglMorph.backEndVars = self.settingsEffectEnabled(wglMorph); 1026 1027 if (!checkEnabledMorph) { 1028 return; 1029 } 1030 1031 if (!wglMorph.editorMode) { 1032 settings = self.buildFront(wglMorph, 'items_morph'); 1033 } else { 1034 settings = self.buildBackend(wglMorph, 'items_morph'); 1035 } 1036 1037 if (!settings) { 1038 return; 1039 } 1040 1041 build(settings); 1042 hideMobile(); 1043 1044 }, 1045 appendElement = function (settings) { 1046 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' + 1047 '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' + 1048 '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' + 1049 '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;' + 1050 1051 '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' + 1052 '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' + 1053 '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' + 1054 'C158.7,148.2,161.3,120.5,163.7,95.5z;' + 1055 1056 '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' + 1057 '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' + 1058 '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' + 1059 'c12.2,24.8,41.2,35.8,65.5,26.3C166.2,150.1,167.2,107.6,161.5,95.7z;' + 1060 1061 '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' + 1062 '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' + 1063 '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' + 1064 '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'; 1065 1066 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' + 1067 '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' + 1068 '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' + 1069 '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;' + 1070 1071 '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' + 1072 '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' + 1073 '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' + 1074 'c-13.5-5.8-13.6-12.6-22.1-14.8C98.4,9.4,86.4,16.7,78.8,23.2z;' + 1075 1076 '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' + 1077 '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' + 1078 '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' + 1079 'c-10.8-5.9-10-14.3-18.3-19.7C104.1,1.6,90.5,3,82,8.3z;' + 1080 1081 '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' + 1082 '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' + 1083 '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' + 1084 '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'; 1085 1086 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' + 1087 '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' + 1088 '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;' + 1089 1090 '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' +
1091 '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' + 1092 '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;' + 1093 1094 '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' + 1095 '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' + 1096 '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;' + 1097 1098 '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' + 1099 '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' + 1100 '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'; 1101 1102 var node_str, 1103 $morph_value = '', 1104 $morph_speed = settings.morph_animation_speed ? settings.morph_animation_speed : 10; 1105 1106 wglMorph.items.push(settings); 1107 1108 var morphStyle = settings.morph_style; 1109 switch (morphStyle) { 1110 case 'style_1': 1111 default: 1112 $morph_value = $morph_value_1; 1113 break; 1114 1115 case 'style_2': 1116 $morph_value = $morph_value_2; 1117 break; 1118 1119 case 'style_3': 1120 $morph_value = $morph_value_3; 1121 break; 1122 } 1123 1124 node_str = '<div id="extended_' + settings._id + '" data-item-id="' + settings._id + '" class="wgl-morph-js elementor-repeater-item-' + settings._id + '"' + '>'; 1125 node_str += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 180 180">'; 1126 node_str += '<path d=""><animate repeatCount="indefinite" attributeName="d" dur="' + $morph_speed + '" values="' + $morph_value + '"/></path>'; 1127 node_str += '</svg>'; 1128 node_str += '</div>'; 1129 1130 if (!$(self).find('.elementor-repeater-item-' + settings._id).length > 0) { 1131 $(self).append(node_str); 1132 } 1133 }, 1134 hideMobile = function () { 1135 if (wglMorph.items) { 1136 $.each(wglMorph.items, function (index, value) { 1137 if (value.hide_morph_on_mobile) { 1138 if (jQuery(window).width() <= value.hide_morph_mobile_resolution) { 1139 jQuery('.wgl-morph-js[data-item-id="' + value._id + '"]').css({ 'opacity': '0', 'visibility': 'hidden' }); 1140 } else { 1141 jQuery('.wgl-morph-js[data-item-id="' + value._id + '"]').css({ 'opacity': '1', 'visibility': 'visible' }); 1142 } 1143 } 1144 }); 1145 } 1146 }, 1147 build = function (settings) { 1148 $.each(settings, function (index, value) { 1149 appendElement(value); 1150 }); 1151 }; 1152 1153 /*Init*/ 1154 initMorph(); 1155 1156 jQuery(window).resize( 1157 function () { 1158 hideMobile(); 1159 } 1160 ); 1161 }); 1162 }; 1163 1164 $.fn.WGLSection3DWaveInit = function (options) { 1165 return this.each(function () { 1166 1167 var self = $(this), 1168 settings, 1169 wglWave = self.wglGlobalVariables('add_wave'), 1170 init3DWave = function () { 1171 setWaveItem(); 1172 }, 1173 1174 setWaveItem = function () { 1175 1176 wglWave.backEndVars = self.settingsEffectEnabled(wglWave); 1177 if (!wglWave.backEndVars) { 1178 return; 1179 } 1180 1181 if (!wglWave.editorMode) { 1182 settings = wgl_parallax_settings[0][wglWave.itemId]; 1183 } else {
1184 settings = buildBackendWave().backEndVars; 1185 } 1186 1187 if (!settings) return; 1188 1189 build(settings); 1190 hideWaveOnMobile(settings); 1191 }, 1192 1193 buildBackendWave = function () { 1194 if (!window.elementor.elements.models) return; 1195 1196 return wglWave; 1197 }, 1198 1199 prependElement = function (settings) { 1200 1201 if (!settings) return; 1202 1203 var node_str = '<div id="wgl-elementor-wave-' + wglWave.itemId + '" class="wgl-wave" data-item-id="' + wglWave.itemId + '"></div>'; 1204 $(self).prepend(node_str); 1205 onDocumentReady(settings); 1206 animate(); 1207 }, 1208 build = function (settings) { 1209 prependElement(settings); 1210 }, 1211 1212 idA, camera, scene, renderer, 1213 container, particle, 1214 winHalfX, winHalfY, 1215 height, width, fieldOfView, 1216 aspectRatio, nearPlane, farPlane, 1217 cameraZ, material, 1218 i = 0, 1219 count = 0, 1220 Tau = Math.PI * 2, 1221 mouseX = 0, 1222 mouseY = 0, 1223 amtX = 50, 1224 amtY = 50, 1225 sep = 100, 1226 spriteOpts = {}, 1227 particles = [], 1228 1229 onDocumentReady = function (settings) { 1230 container = document.getElementById('wgl-elementor-wave-' + wglWave.itemId); 1231 height = container.parentElement.clientHeight; 1232 winHalfY = height / 2; 1233 width = container.parentElement.clientWidth; 1234 winHalfX = width / 2; 1235 fieldOfView = 75; 1236 aspectRatio = width / height; 1237 nearPlane = 1; 1238 farPlane = 10000; 1239 cameraZ = 750; 1240 1241 rendererer(onRendererRenderered,settings); 1242 }, 1243 rendererer = function (complete,settings) { 1244 var maxX = settings.wave_dots_max_x && settings.wave_dots_max_x['size'] ? settings.wave_dots_max_x['size'] : null, 1245 maxY = settings.wave_dots_max_y && settings.wave_dots_max_y['size'] ? settings.wave_dots_max_y['size'] : null, 1246 dots_color = !!settings.wave_dots_color ? settings.wave_dots_color : '#000', 1247 bg_color = !!settings.wave_bg_color ? settings.wave_bg_color : '#000'; 1248 1249 //lights (no lights!) camera, action! 1250 camera = new THREE.PerspectiveCamera(fieldOfView, aspectRatio, nearPlane, farPlane); 1251 camera.position.z = cameraZ; 1252 camera.position.x = maxX; 1253 camera.position.y = maxY; 1254 1255 scene = new THREE.Scene(); 1256 1257 //material settings 1258 spriteOpts = { 1259 color: dots_color, 1260 program: function (ctx) { 1261 ctx.beginPath(); 1262 ctx.arc(0, 0, 0.5, 0, Tau, true); 1263 ctx.fill(); 1264 } 1265 }; 1266 1267 material = new THREE.SpriteCanvasMaterial(spriteOpts); 1268 1269 // Stop! particle time! 1270 for (var ix = 0, lx = amtX; ix < lx; ix++) { 1271 1272 for (var iy = 0, ly = amtY; iy < ly; iy++) { 1273 particle = particles[i++] = new THREE.Sprite(material); 1274 particle.position.x = ix * sep - ((amtX * sep) / 2); 1275 particle.position.z = iy * sep - ((amtY * sep) / 2); 1276 scene.add(particle); 1277 } 1278 } 1279 1280 //render the scene 1281 renderer = new THREE.CanvasRenderer(); 1282 renderer.setClearColor(bg_color, 1); 1283 1284 renderer.setPixelRatio(window.devicePixelRatio); 1285 renderer.setSize(width, height); 1286 1287 // append the rendered scene to the container 1288 container.appendChild(renderer.domElement); 1289
1290 // Scene! 1291 if (complete) { 1292 complete(settings); 1293 } 1294 }, 1295 onRendererRenderered = function (settings) { 1296 // bind events 1297 if (settings.wave_mouse_manipulation) { 1298 document.addEventListener('mousemove', onDocumentMouseMove); 1299 document.addEventListener('touchstart', onDocumentTouchStart); 1300 document.addEventListener('touchmove', onDocumentTouchMove); 1301 } 1302 window.addEventListener('resize', onWindowResize ); 1303 window.wglWaveSettings = settings; 1304 }, 1305 onDocumentMouseMove = function (e) { 1306 mouseX = e.clientX - winHalfX; 1307 mouseY = e.clientY - winHalfY; 1308 }, 1309 onDocumentTouchStart = function (e) { 1310 if (e.touches.length === 1) { 1311 e.preventDefault(); 1312 mouseX = e.touches[0].pageX - winHalfX; 1313 mouseY = e.touches[0].pageY - winHalfY; 1314 } 1315 }, 1316 onDocumentTouchMove = function (e) { 1317 if (e.touches.length === 1) { 1318 e.preventDefault(); 1319 mouseX = e.touches[0].pageX - winHalfX; 1320 mouseY = e.touches[0].pageY - winHalfY; 1321 } 1322 }, 1323 onWindowResize = function (event) { 1324 settings = event.currentTarget.wglWaveSettings; 1325 // update variables to new values 1326 container = document.getElementById('wgl-elementor-wave-' + wglWave.itemId); 1327 height = container.parentElement.clientHeight; 1328 winHalfY = height / 2; 1329 width = container.parentElement.clientWidth; 1330 winHalfX = width / 2; 1331 1332 camera.aspect = width / height; 1333 camera.updateProjectionMatrix(); 1334 renderer.setSize(width, height); 1335 hideWaveOnMobile(settings); 1336 if (wglWave.editorMode) { 1337 update(settings); 1338 } 1339 }, 1340 animate = function () { 1341 1342 idA = window.requestAnimationFrame(animate); 1343 if (wglWave.editorMode) { 1344 cancelAnimationFrame(idA); 1345 } 1346 1347 if (!(settings.wave_hide_on_mobile && jQuery(window).width() <= settings.wave_hide_mobile_resolution)) { // disable on mobile 1348 update(settings); 1349 } 1350 }, 1351 hideWaveOnMobile = function (settings) { 1352 if (settings.wave_hide_on_mobile) { 1353 if (jQuery(window).width() <= settings.wave_hide_mobile_resolution) { 1354 jQuery('.wgl-wave[data-item-id="' + wglWave.itemId + '"]').css({ 'visibility': 'hidden' }); 1355 } else { 1356 jQuery('.wgl-wave[data-item-id="' + wglWave.itemId + '"]').css({ 'visibility': 'visible' }); 1357 } 1358 } 1359 }, 1360 update = function (settings) { 1361 if (settings.wave_mouse_manipulation) { 1362 var maxX = settings.wave_dots_max_X && settings.wave_dots_max_x['size'] ? settings.wave_dots_max_x['size'] : null, 1363 miceX = !!maxX ? maxX + mouseX : mouseX, 1364 maxY = settings.wave_dots_max_y && settings.wave_dots_max_y['size'] ? settings.wave_dots_max_y['size'] : null, 1365 miceY = !!maxY ? maxY + mouseY : mouseY; 1366 1367 camera.position.x += (miceX - camera.position.x) * 0.003; 1368 camera.position.y += (miceY - camera.position.y) * 0.005; 1369 } 1370 camera.lookAt(scene.position); 1371 1372 i = 0; 1373 for (var ix = 0, lx = amtX; ix < lx; ix++) { 1374 1375 for (var iy = 0, ly = amtY; iy < ly; iy++) { 1376 particle = particles[i++]; 1377 particle.position.y = (Math.sin((ix + count) * 0.3) * 50) + (Math.sin((iy + count) * 0.5) * 50); 1378 particle.scale.x = particle.scale.y = (Math.sin((ix + count) * 0.3) + 1) * 4 + (Math.sin((iy + count) * 0.5) + 1) * 4; 1379 scene.add(particle); 1380 } 1381 } 1382 1383 renderer.render(scene, camera); 1384 count += 0.1; 1385 } 1386 1387 /*Init*/ 1388 init3DWave(); 1389 }); 1390 }; 1391 1392 // Add WGL Shape Divider 1393 $.fn.WGLSectionShapeDividerInit = function (options) { 1394 return this.each(function () { 1395 1396 var self = $(this), 1397 wglShapeDivider = { 1398 editorMode: window.elementorFrontend.isEditMode(), 1399 itemId: $(this).data('id'), 1400 options: false, 1401 globalVars: 'add_shape_divider', 1402 backEndVars: [], 1403 items: [], 1404 }; 1405 1406 var init = function () { 1407 setShapeDividerItem(); 1408 }, 1409 setShapeDividerItem = function () { 1410 var settings; 1411 1412 var checkEnabledParallax = ShapeDividerEnabled(); 1413 1414 if (!checkEnabledParallax) { 1415 return; 1416 } 1417 1418 if (!wglShapeDivider.editorMode) { 1419 settings = buildFrontShapeDivider(); 1420 } else {
1421 settings = buildBackendShapeDivider(); 1422 } 1423 1424 if (!settings) { 1425 return; 1426 } 1427 1428 build(settings); 1429 }, 1430 1431 ShapeDividerEnabled = function () { 1432 var settings = {}; 1433 1434 if (!wglShapeDivider.editorMode) { 1435 settings = wgl_parallax_settings[0][wglShapeDivider.itemId]; 1436 1437 if (!settings) { 1438 return; 1439 } 1440 1441 } else { 1442 if (!window.elementor.elements) { 1443 return; 1444 } 1445 1446 if (!window.elementor.elements.models) { 1447 return; 1448 } 1449 1450 window.elementor.elements.models.forEach(function (value) { 1451 if (wglShapeDivider.itemId == value.id) { 1452 wglShapeDivider.backEndVars[wglShapeDivider.itemId] = value.attributes.settings.attributes; 1453 settings = value.attributes.settings.attributes; 1454 } 1455 }); 1456 } 1457 1458 return settings; 1459 }, 1460 1461 buildFrontShapeDivider = function () { 1462 var settings = wgl_parallax_settings[0]; 1463 return settings; 1464 }, 1465 1466 buildBackendShapeDivider = function () { 1467 if (!window.elementor.elements.models) { 1468 return; 1469 } 1470 var arr = []; 1471 arr = wglShapeDivider.backEndVars; 1472 return arr; 1473 }, 1474 getSvgURL = function (fileName) { 1475 var svgURL = wgl_parallax_settings.svgURL + fileName + '.svg'; 1476 return svgURL; 1477 }, 1478 appendElement = function (settings) { 1479 var $item = settings[$(self).data('id')]; 1480 1481 if (!$item) { 1482 return; 1483 } 1484 1485 var node_str = '', 1486 svgURL = ''; 1487 1488 if ($item.wgl_shape_divider_top && $item.wgl_shape_divider_top !== '') { 1489 1490 svgURL = getSvgURL($item.wgl_shape_divider_top); 1491 1492 node_str = '<div class="wgl-divider wgl-elementor-shape wgl-elementor-shape-top"></div>'; 1493 $(self).prepend(node_str); 1494 1495 jQuery.get(svgURL, function (data) { 1496 $(self).find('.wgl-divider.wgl-elementor-shape-top').empty().append(data.childNodes[0]); 1497 }); 1498 } 1499 1500 if ($item.wgl_shape_divider_bottom && $item.wgl_shape_divider_bottom !== '') { 1501 1502 svgURL = getSvgURL($item.wgl_shape_divider_bottom); 1503 1504 node_str = '<div class="wgl-divider wgl-elementor-shape wgl-elementor-shape-bottom"></div>'; 1505 $(self).prepend(node_str); 1506 1507 jQuery.get(svgURL, function (data) { 1508 $(self).find('.wgl-divider.wgl-elementor-shape-bottom').empty().append(data.childNodes[0]); 1509 }); 1510 } 1511 }, 1512 build = function (settings) { 1513 appendElement(settings); 1514 }; 1515 1516 /*Init*/ 1517 init(); 1518 1519 }); 1520 }; 1521 // Add WGL Shape Divider 1522 $.fn.WGLSectionAnimateScrollInit = function (options) { 1523 return this.each(function () { 1524 1525 var self = $(this), 1526 settings, 1527 wglAnimScroll = self.wglGlobalVariables('add_extended_animate_scroll'); 1528 1529 var init = function () { 1530 setAnimScrollItem(); 1531 }, 1532 1533 setAnimScrollItem = function () { 1534 wglAnimScroll.backEndVars = self.settingsEffectEnabled(wglAnimScroll); 1535 if (!wglAnimScroll.backEndVars) { 1536 return; 1537 } 1538 1539 if (!wglAnimScroll.editorMode) { 1540 settings = wgl_parallax_settings[0][wglAnimScroll.itemId]; 1541 } else {
1542 settings = buildBackendAnimScroll().backEndVars; 1543 } 1544 1545 if (!settings) return; 1546 build(settings); 1547 }, 1548 1549 buildBackendAnimScroll = function () { 1550 if (!window.elementor.elements.models) return; 1551 1552 return wglAnimScroll; 1553 }, 1554 1555 isElementInViewport = function (el) { 1556 const rect = el.getBoundingClientRect(), 1557 viewportHeight = window.innerHeight; 1558 1559 return (viewportHeight - rect.top) / rect.height; 1560 }, 1561 1562 elementOpacity = function (el, opacity) { 1563 return Math.round( Math.min(1, Math.max( opacity, isElementInViewport(el) ) ) * 10000 ) / 10000; 1564 }, 1565 elementRotate = function (el, rotate) { 1566 return rotate - (rotate * ( Math.round( Math.min(1, Math.max( 0, isElementInViewport(el) ) ) * 10000 ) / 10000 ) ); 1567 }, 1568 1569 handleScroll = function (settings) { 1570 const animatedSection = self.get(0); 1571 1572 let opacity = settings.extended_animate_scroll_opacity['size'] ?? 1, 1573 rotate = settings.extended_animate_scroll_rotate['size'] ?? 0; 1574 1575 jQuery(animatedSection).css({ 1576 'opacity': elementOpacity(animatedSection, opacity), 1577 '--wgl-anim-scroll-rotate': elementRotate(animatedSection, rotate) + 'deg', 1578 }); 1579 }, 1580 1581 build = function (settings) { 1582 handleScroll(settings); 1583 document.addEventListener('scroll', function(){ handleScroll(settings) }, false); 1584 }; 1585 1586 init(); 1587 }); 1588 }; 1589 1590}(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.