1 2function df_is_intiger(value) { 3 var x; 4 return isNaN(value) ? !1 : (x = parseFloat(value), (0 | x) === x); 5} 6 7 8;(function($){ 9 10 const dfpopup = { 11 popupContainer: $('div.popup-container'), 12 closeSelector: $('.popup-close, .popup-close span'), 13 ovalaySelector: $('.overlay'), 14 init: function() { 15 // display the modal 16 if ( dfpopup.popupContainer.length ) { 17 if(typeof popups_with_automatic_trigger !== 'undefined'){ 18 dfpopup.automaticTriggerProcess(popups_with_automatic_trigger); 19 } 20 if(typeof popups_with_css_trigger !== 'undefined'){ 21 dfpopup.cssTriggerProcess(popups_with_css_trigger); 22 } 23 if(typeof df_popup_close_link_selector !== 'undefined'){ 24 dfpopup.closeLinkTriggerProcess(df_popup_close_link_selector); 25 } 26 if(typeof popups_with_automatic_trigger !== 'undefined' || typeof popups_with_css_trigger !== 'undefined'){ 27 28 if (typeof popups_with_css_trigger !== 'undefined'){ 29 dfpopup.urlHashTargeting( popups_with_css_trigger ); 30 } 31 if (typeof popups_with_automatic_trigger !== 'undefined'){ 32 dfpopup.urlHashTargeting( popups_with_automatic_trigger ); 33 } 34 35 } 36 37 dfpopup.closePopup(); 38 // Get the hash from the URL 39 var hash = window.location.hash; 40 41 // Check if the hash exists 42 if (hash && hash.includes('#popup_')) { 43 const popup_id = parseInt(hash.replace('#popup_',''),10); 44 if(!isNaN(popup_id)) dfpopup.displayPopup(popup_id); 45 } 46 47 } 48 49 }, 50 displayPopup: function(popup_id , hashTarget = false) { 51 if ( !df_is_intiger(popup_id) ) 52 return; 53 54 var popup_selector = '#popup_' + popup_id 55 , popup = $( popup_selector ) 56 , enableajax = false//popup.data('enableajax') 57 , divi_popup_container_selector = '#df-popup-container-' + popup_id; 58 59 if ( $( divi_popup_container_selector ).length ) { 60 dfpopup.processPopup(popup_id, hashTarget); 61 } 62 }, 63 processPopup: function(popup_id , hashTarget=false){ 64 var popup_element = '#popup_' + popup_id; 65 var popup = $('body').find( popup_element ); 66 67 var settings = JSON.parse(document.querySelector(popup_element).dataset.settings); 68 69 var cookieName = 'diviflash_' + popup_id, 70 cookieType = settings.df_popup_activity_type, 71 cookiePeriodType = settings.df_popup_activity_period_type, 72 cookiePeriodValue = settings.df_popup_activity_period_value; 73 74 let cookieDays = 0; 75 76 if(cookiePeriodType == 'day'){ 77 cookieDays = parseInt(cookiePeriodValue); 78 }else if(cookiePeriodType == 'hour'){ 79 cookieDays = parseFloat(parseInt(cookiePeriodValue)/24) 80 }else if(cookiePeriodType == 'month'){ 81 cookieDays = parseInt(cookiePeriodValue)*30; 82 } 83 if ( dfpopup.read_cookie( cookieName )) { 84 if(cookieType == 'never'){ 85 dfpopup.erase_cookie(cookieName) 86 }else{ 87 return; 88 } 89 90 } 91 92 if ( cookieType =='once_only') { 93 dfpopup.erase_cookie(cookieName) 94 } 95 96 if(settings.df_popup_prevent_scroll && !dfpopup.read_cookie( cookieName )){ 97 $('body').addClass('stop-scrolling') 98 $('html').addClass('stop-scrolling'); 99 $('body').bind('touchmove', function(e){e.preventDefault()}) 100 } 101 102 if(settings.df_popup_content_scroll){ 103 $('body').addClass('popup_scroll_added'); 104 setTimeout( function() { popupScrollByObserver() }, 1000); 105 106 } 107 108 109 if(settings.df_popup_trigger_type === 'on_load' || settings.df_popup_trigger_type === 'on_scroll' 110 || settings.df_popup_trigger_type === 'scroll_to_element' || settings.df_popup_trigger_type === 'on_inactivity' 111 || settings.df_popup_trigger_type === 'on_exit'){ 112 $(popup).addClass('active'); 113 $(popup).css( {"z-index" : 999999} ); 114 } 115 116 if(hashTarget == true){ 117 $(popup).addClass('active'); 118 $(popup).css( {"z-index" : 999999} ); 119 } 120 if(settings.df_popup_trigger_type === 'click' ){ 121 if(settings.df_popup_custom_selector !== ''){
122 $(popup).addClass('active'); 123 124 $(popup).css( {"z-index" : 999999} ); 125 } 126 127 } 128 129 setTimeout(function() { 130 $(popup).addClass(settings.df_popup_animation_type); 131 }, settings.df_popup_animation_delay); 132 133 134 if ($(popup).hasClass('open')) { 135 $( popup ).removeClass('open'); 136 $( popup ).addClass('close'); 137 } 138 else if(!$( popup ).hasClass('close')) { 139 140 setTimeout( function() { 141 $(popup).addClass('open'); 142 }, 200); 143 } 144 145 if ($(popup).hasClass('close')) { 146 147 $( popup ).addClass('open'); 148 $( popup ).removeClass('close'); 149 150 } 151 152 // close button set to inner 153 if(settings.df_popup_close_btn_move_inner_content){ 154 const close_selector = '.popup-close-button-' + popup_id; 155 const close_destination= '#popup_' + popup_id + ' .et_pb_row.custom_row'; 156 if($(close_destination).length > 0){ 157 $(close_selector).appendTo(close_destination); 158 $(close_selector).css("position", "absolute"); 159 }else{ 160 $(close_selector).prependTo('#popup_' + popup_id + ' .df_popup_inner_container .df_popup_wrapper .et_pb_section:first-child'); 161 $(close_selector).css("position", "absolute"); 162 } 163 } 164 165 $(`${popup_element}.overlay.active`).css({ 166 "animation": `${settings.df_popup_animation_duration}ms popup_load`, 167 "opacity":"1", 168 "visibility":"visible" 169 }) 170 171 }, 172 closePopup: function () { 173 dfpopup.closeSelector.on('click touchstart', function (e) { 174 var closeClick = true; 175 var popup_id = $(this).parents().children(".overlay").attr("id") 176 popup_id = popup_id.split("_") 177 if (e.target !== e.currentTarget) return; 178 dfpopup.closeActivePopup(parseInt(popup_id[1])); 179 // var $videoEl = jQuery(this).closest('.overlay').find('iframe'); 180 // $videoEl.attr('src', $videoEl.attr('src')); 181 // var $iframe = jQuery('iframe'), 182 // src = $iframe.prop('src'); 183 // $iframe.prop('src', '').prop('src', src.replace('&autoplay=1&mute=1', '')); 184 }) 185 186 dfpopup.ovalaySelector.on('click', function(e){ 187 //e.preventDefault() 188 var popup_id = $(this).attr("id") 189 popup_id = popup_id.split("_"); 190 var popup_element = '#popup_' + parseInt(popup_id[1]); 191 var popup_container_id = 'df_popup_inner_containner_'+ popup_id[1]; 192 var closestSelector = '.df_popup_wrapper .et_pb_section'; 193 var popupContainer = document.getElementById(popup_container_id); 194 let ignorSelector = ''; 195 if (popupContainer.querySelector(closestSelector)) { // use builder 196 ignorSelector = '.df_popup_wrapper .et_pb_section'; 197 } else { // Child elements with class '.df_popup_wrapper .et_pb_section' do not exist 198 ignorSelector = '.df_popup_wrapper .custom_section'; // Use WIthout Builder 199 } 200 201 if ($(e.target).closest(ignorSelector).length === 0 ) { 202 203 var settings = JSON.parse(document.querySelector(popup_element).dataset.settings); 204 205 if(settings.df_popup_close_on_overlay_click === true){ 206 dfpopup.closeActivePopup(parseInt(popup_id[1])); 207 } 208 209 } 210 211 }) 212 213 $("body").on('keydown', function(event){ 214 if(event.which == 27) { 215 var popupDiv = document.querySelector('.overlay.active'); 216 if (popupDiv) { 217 var popupId = popupDiv.id; 218 219 const popup_id = popupId.split("_") 220 dfpopup.closeActivePopup(parseInt(popup_id[1])); 221 } 222 } 223 }); 224 225 226 }, 227 228 // Function to find the YouTube iframe within the popup 229 findYouTubeIframe: function() { 230 let iframes = document.getElementsByTagName('iframe'); 231 for (let i = 0; i < iframes.length; i++) { 232 let iframe = iframes[i]; 233 if (iframe.src.includes('youtube.com/embed')) { 234 youtubeIframe = iframe; 235 break; 236 } 237 } 238 }, 239 reset: function() { 240 $('body').css('padding-bottom', 0); 241 }, 242 243 closeActivePopup: function (popup_id) { 244 // find active overlay 245 var popup = $('#popup_'+ popup_id); 246 var popup_element = '#popup_' + popup_id; 247 248 // $(popup).animate({ opacity: 0 }, 1000); 249 250 /* Youtube pause Functionality*/ 251 let iframes = document.getElementsByTagName('iframe'); 252 for (let i = 0; i < iframes.length; i++) { 253 let iframe = iframes[i]; 254 if (iframe.src.includes('youtube.com/embed')) {
255 let videoUrl = iframe.src; 256 videoUrl = videoUrl.replace('?autoplay=1', '?autoplay=0'); 257 iframe.src = videoUrl; 258 } 259 } 260 261 // media uploaded video 262 if($(popup_element).find('video').length){ 263 const media = $(popup_element).find('video').get(0) 264 media.pause(); 265 media.currentTime = 0; 266 } 267 268 var settings = JSON.parse(document.querySelector(popup_element).dataset.settings); 269 270 if(settings.df_popup_prevent_scroll){ 271 $('body').removeClass('stop-scrolling') 272 $('html').removeClass('stop-scrolling'); 273 } 274 275 if (popup.hasClass('active')) { 276 277 // Animation 278 const close_anmimation_duration = settings.df_popup_close_animation_enable ? settings.df_popup_close_animation_duration: 200; 279 setTimeout(function () { 280 $(popup).removeClass('active'); 281 $(popup).css({ "z-index": -1 }); 282 }, close_anmimation_duration); // Close animation apply 283 } 284 285 if(settings.df_popup_content_scroll){ 286 if($('body.popup_scroll_added').length > 0 ){ 287 $('body').removeClass('popup_scroll_added'); 288 } 289 290 } 291 292 293 var cookieName = 'diviflash_' + popup_id, 294 cookieType = settings.df_popup_activity_type, 295 cookiePeriodType = settings.df_popup_activity_period_type, 296 cookiePeriodValue = settings.df_popup_activity_period_value; 297 298 let cookieDays = 0; 299 300 if(cookiePeriodType == 'day'){ 301 cookieDays = parseInt(cookiePeriodValue); 302 }else if(cookiePeriodType == 'hour'){ 303 cookieDays = parseFloat(parseInt(cookiePeriodValue)/24) 304 }else if(cookiePeriodType == 'month'){ 305 cookieDays = parseInt(cookiePeriodValue)*30; 306 } 307 308 if ( cookieDays > 0 && cookieType =='per_period') { 309 dfpopup.create_cookie( cookieName, 'true', cookieDays ); 310 } 311 else if(cookieType =='once_only'){ 312 dfpopup.erase_cookie( cookieName ); 313 cookieDays = 365; 314 dfpopup.create_cookie( cookieName, 'true', cookieDays ); 315 } 316 else{ 317 dfpopup.erase_cookie( cookieName ); 318 } 319 320 if (popup.length) { 321 if (popup_id == null) { 322 var popupArr = popup.attr('id').split('_'); 323 popup_id = popupArr[popupArr.length - 1]; 324 } 325 popup.removeClass('open'); 326 popup.addClass('close'); 327 } 328 const close_anmimation_duration = settings.df_popup_close_animation_enable ? settings.df_popup_close_animation_duration: 200; 329 $(`#popup_${popup_id}.overlay.close`).css({ 330 "animation": `${close_anmimation_duration}ms popup_close`, 331 "opacity":"0", 332 "visibility":"hidden" 333 }) 334 }, 335 create_cookie: function( name,value,days ) { 336 var expires = ""; 337 338 if ( days ) { 339 340 var date = new Date(); 341 342 date.setTime(date.getTime() + ( days * 24 * 60 * 60 * 1000)); 343 344 expires = "; expires=" + date.toUTCString(); 345 } 346 347 document.cookie = name + "=" + value + expires + "; path=/"; 348 }, 349 350 read_cookie: function( name ) { 351 352 var cookieName = name + "="; 353 var cookieArray = document.cookie.split(';'); 354 355 for(var i=0;i < cookieArray.length;i++) { 356 357 var cookieItem = cookieArray[i]; 358 359 while (cookieItem.charAt(0)==' ') cookieItem = cookieItem.substring(1,cookieItem.length); 360 361 if (cookieItem.indexOf(cookieName) == 0) return cookieItem.substring(cookieName.length,cookieItem.length); 362 } 363 364 return null; 365 }, 366 367 create_cookie:function( name,value,days ) { 368 var expires = ""; 369 370 if ( days ) { 371 372 var date = new Date(); 373 374 date.setTime(date.getTime() + ( days * 24 * 60 * 60 * 1000)); 375 376 expires = "; expires=" + date.toUTCString(); 377 } 378 379 document.cookie = name + "=" + value + expires + "; path=/"; 380 }, 381 382 erase_cookie: function( name ) { 383 dfpopup.create_cookie( name, '', -1 ); 384 }, 385 getScrollTop:function() { 386 387 if ( typeof pageYOffset!= 'undefined' ) { 388 389 // most browsers except IE before #9 390 return pageYOffset; 391 } 392 else { 393 394 var B = document.body; // IE 'quirks' 395 var D = document.documentElement; // IE with doctype 396 D = ( D.clientHeight ) ? D: B; 397 398 return D.scrollTop; 399 } 400 }, 401 automaticTriggerProcess:function(popups_with_automatic_trigger){
402 403 if (typeof popups_with_automatic_trigger !== 'undefined') { 404 405 if ( $( popups_with_automatic_trigger ).length > 0 ) { 406 407 $.each( popups_with_automatic_trigger, function( popup_id, at_settings ) { 408 409 var automatic_trigger_obj = jQuery.parseJSON( at_settings ); 410 var at_type_value = automatic_trigger_obj.at_type; 411 412 413 if ( at_type_value == 'on_load' ) { 414 415 var time_delayed = automatic_trigger_obj.at_value * 1000; 416 417 if ( time_delayed == 0 ) { 418 time_delayed = 300; 419 } 420 421 setTimeout( function() { 422 423 dfpopup.displayPopup( popup_id ); 424 425 }, time_delayed); 426 } 427 428 429 if ( at_type_value == 'on_scroll' ) { 430 431 var poupupScroll = automatic_trigger_obj.at_value; 432 let refScroll= 'px'; 433 434 if ( poupupScroll.indexOf('%') || poupupScroll.indexOf('px') ) { 435 436 if ( poupupScroll.indexOf('%') > 0 ) { 437 438 poupupScroll = poupupScroll.replace(/%/g, ''); 439 refScroll = '%'; 440 } 441 442 if ( poupupScroll.indexOf('px') > 0 ) { 443 444 poupupScroll = poupupScroll.replace(/px/g, ''); 445 refScroll = 'px'; 446 } 447 }else{ 448 refScroll = 'px'; 449 } 450 451 452 poupupScroll = poupupScroll.split(':'); 453 var poupupScroll = poupupScroll[0] 454 455 456 $(window).scroll(function(e) { 457 458 var s = dfpopup.getScrollTop(), 459 d = $(document).height(), 460 c = $(window).height(), 461 wScroll; 462 463 if ( refScroll == '%' ) { 464 465 wScroll = (s / (d-c)) * 100; 466 467 } else if ( refScroll == 'px' ) { 468 469 wScroll = s; 470 471 } else { 472 473 return; 474 } 475 476 if ( poupupScroll > 0 ) { 477 478 if ( wScroll >= poupupScroll ) { 479 480 if ( !dfpopup.isActivePopup( popup_id ) && !dfpopup.isClosedPopup(popup_id) ) { 481 dfpopup.displayPopup( popup_id ); 482 } 483 } 484 485 } 486 487 }); 488 489 } 490 491 if(at_type_value == 'on_inactivity'){ 492 493 var inactivityValue = automatic_trigger_obj.at_value !== null ? parseInt(automatic_trigger_obj.at_value): 5; 494 495 if(!df_is_intiger(inactivityValue)){ 496 return; 497 } 498 const delayInMilisec = inactivityValue*1000; 499 window.onload = function(e) { 500 e.preventDefault(); 501 var time; 502 window.addEventListener('load', resetTimer, true); 503 var events = ['mousedown', 'mousemove', 'keypress', 'onkeydown', 'scroll', 'touchstart']; 504 events.forEach(function(name) { 505 document.addEventListener(name, resetTimer, true); 506 });
507 function showEvent() { 508 dfpopup.displayPopup( popup_id ); 509 } 510 511 function resetTimer() { 512 clearTimeout(time); 513 time = setTimeout(showEvent, delayInMilisec) 514 // 1000 milliseconds = 1 second 515 } 516 } 517 } 518 519 if (at_type_value == 'scroll_to_element') { 520 521 var scroll_element = automatic_trigger_obj.at_value; 522 523 if (scroll_element && $(scroll_element).length > 0) { 524 var viewport_position = automatic_trigger_obj.at_view; 525 $(window).on('scroll', function(e) { 526 e.preventDefault(); 527 528 var elementOffsetTop = $(scroll_element).offset().top, 529 elementHeigh = $(scroll_element).outerHeight(), 530 windowHeight = $(window).height(), 531 scrolledValue = $(this).scrollTop(); 532 533 if ('on_top' === viewport_position) { 534 if (scrolledValue > (elementOffsetTop + elementHeigh - windowHeight) && 535 (elementOffsetTop < scrolledValue) 536 //&& (scrolledValue+windowHeight > elementOffsetTop+elementHeigh) 537 ) { 538 if (!dfpopup.isActivePopup(popup_id) && !dfpopup.isClosedPopup(popup_id)) { 539 dfpopup.displayPopup(popup_id); 540 } 541 } 542 } else if ('on_center' === viewport_position) { 543 var terget = ((elementOffsetTop - ((windowHeight - 100) / 2)) + (elementHeigh / 2)) - 100; 544 if (scrolledValue >= terget) { 545 if (!dfpopup.isActivePopup(popup_id) && !dfpopup.isClosedPopup(popup_id)) { 546 dfpopup.displayPopup(popup_id); 547 } 548 } 549 } else { 550 var terget = (elementOffsetTop - windowHeight); 551 if (scrolledValue >= terget) { 552 if (!dfpopup.isActivePopup(popup_id) && !dfpopup.isClosedPopup(popup_id)) { 553 dfpopup.displayPopup(popup_id); 554 } 555 } 556 } 557 558 });
559 } 560 } 561 562 563 if ( at_type_value == 'on_exit' ) { 564 // document.addEventListener('visibilitychange', function () { // Will Added this feature next update 565 // if (document.hidden) { 566 // // Do something here, for example, pause a video or stop a timer 567 // console.log('User has switched to another tab.'); 568 // } else { 569 // // Do something here, for example, resume a video or restart a timer 570 // console.log('User has switched back to this tab.'); 571 // dfpopup.displayPopup( popup_id ); 572 // } 573 // }); 574 575 document.addEventListener('mouseout', e => { 576 if (!e.toElement && !e.relatedTarget) { 577 if ( !dfpopup.isActivePopup( popup_id ) && !dfpopup.isClosedPopup(popup_id) ) { 578 dfpopup.displayPopup( popup_id ); 579 } 580 } 581 }); 582 583 } 584 }); 585 } 586 } 587 }, 588 cssTriggerProcess: function(popups_with_css_trigger){ 589 if (typeof popups_with_css_trigger !== 'undefined') { 590 if ( $( popups_with_css_trigger ).length > 0 ) { 591 $.each( popups_with_css_trigger, function( popup_id, selector ) { 592 if(selector !== ''){
593 $(selector).css( 'pointer-events', 'auto' ); 594 $(selector).css( 'cursor', 'pointer' ); 595 $( selector +':not(.popup-close)' ).on('click touch tap', function (e) { 596 e.preventDefault(); 597 var cookieName = 'diviflash_' + popup_id; 598 599 dfpopup.erase_cookie( cookieName ); 600 dfpopup.displayPopup(parseInt(popup_id)); 601 }); 602 } 603 604 }); 605 } 606 } 607 }, 608 urlHashTargeting: function(popups_with_css_trigger = 'undefined' , popups_with_automatic_trigger = 'undefined'){ 609 610 if (typeof popups_with_css_trigger !== 'undefined') { 611 if ( $( popups_with_css_trigger ).length > 0 ) { 612 $.each( popups_with_css_trigger, function( popup_id, selector ) { 613 614 var popup_selector = "#popup_"+ popup_id; 615 var links = document.querySelectorAll('a[href="'+popup_selector+'"'); 616 links.forEach((link)=>{ 617 if(link){ 618 link.addEventListener('click', function(event) { 619 event.preventDefault(); 620 var cookieName = 'diviflash_' + popup_id; 621 dfpopup.erase_cookie( cookieName ); 622 dfpopup.displayPopup(parseInt(popup_id), true); 623 });
624 } 625 }); 626 627 }); 628 } 629 } 630 631 if (typeof popups_with_automatic_trigger !== 'undefined') { 632 633 if ( $( popups_with_automatic_trigger ).length > 0 ) { 634 635 $.each( popups_with_automatic_trigger, function( popup_id, at_settings ) { 636 637 var popup_selector = "#popup_"+ popup_id; 638 var links = document.querySelector('a[href='+popup_selector+''); 639 links.forEach(()=>{ 640 if(link){ 641 link.addEventListener('click', function(event) { 642 event.preventDefault(); 643 cookieName = 'diviflash_' + popup_id; 644 dfpopup.erase_cookie( cookieName ); 645 dfpopup.displayPopup(parseInt(popup_id)); 646 }); 647 } 648 }); 649 650 }); 651 } 652 } 653 654 }, 655 closeLinkTriggerProcess: function(df_popup_close_link_selector){ 656 if(typeof df_popup_close_link_selector !== 'undefined'){ 657 if ( $( df_popup_close_link_selector ).length > 0 ) { 658 659 $.each( df_popup_close_link_selector, function( popup_id, selector ) { 660 661 $( selector ).on('click touch tap', function (e) { 662 663 e.preventDefault(); 664 var cookieName = 'diviflash_' + popup_id; 665 666 dfpopup.erase_cookie( cookieName ); 667 668 669 670 var closeClick = true; 671 672 dfpopup.closeActivePopup(parseInt(popup_id), closeClick); 673 674 }); 675 }); 676 } 677 } 678 }, 679 680 preventScrollonPopup: function(){ 681 window.onscroll = function () { window.scrollTo(0, 0); }; 682 }, 683 isActivePopup: function ( popup_id ) { 684 685 if ( !popup_id ) { 686 687 var popup = $( '.overlay.open' ); 688 } 689 else { 690 691 var popup = $( '#popup_' + popup_id ); 692 } 693 694 if ( $( popup ).hasClass('open') ) { 695 696 return true; 697 } 698 699 return false; 700 }, 701 isClosedPopup : function( popup_id ) { 702 703 if ( !popup_id ) { 704 705 return null; 706 } 707 708 var popup = $( '#popup_' + popup_id ); 709 710 if ( $( popup ).hasClass('close') ) { 711 712 return true; 713 } 714 715 return false; 716 } 717 718 } 719 720 function df_remove_animation_data(element) { 721 var attr_name; 722 var data_attrs_to_remove = []; 723 var data_attrs = element.attributes; 724 for (var i = 0; i < data_attrs.length; i++) { 725 if (data_attrs[i].name.substring(0, 15) === 'data-animation-') { 726 data_attrs_to_remove.push(data_attrs[i].name); 727 } 728 } 729 data_attrs_to_remove.forEach(function(attr_name) { 730 element.removeAttribute(attr_name); 731 }); 732 } 733 function df_get_animation_classes() { 734 return ['et_animated', 'et_is_animating', 'infinite', 'et-waypoint', 'fade', 'fadeTop', 'fadeRight', 'fadeBottom', 'fadeLeft', 'slide', 'slideTop', 'slideRight', 'slideBottom', 'slideLeft', 'bounce', 'bounceTop', 'bounceRight', 'bounceBottom', 'bounceLeft', 'zoom', 'zoomTop', 'zoomRight', 'zoomBottom', 'zoomLeft', 'flip', 'flipTop', 'flipRight', 'flipBottom', 'flipLeft', 'fold', 'foldTop', 'foldRight', 'foldBottom', 'foldLeft', 'roll', 'rollTop', 'rollRight', 'rollBottom', 'rollLeft', 'transformAnim']; 735 } 736 737 function df_remove_animation(element) { 738 // Don't remove looping animations, return early. 739 if (element.classList.contains('infinite')) { 740 return; 741 } 742 743 var animation_classes = df_get_animation_classes(); // Assuming et_get_animation_classes() is defined elsewhere. 744 745 // Remove attributes which avoid horizontal scroll to appear when section is rolled 746 if (element.classList.contains('et_pb_section') && element.classList.contains('roll')) { 747 var cssContainerPrefix = et_frontend_scripts.builderCssContainerPrefix; 748 var cssLayoutPrefix = et_frontend_scripts.builderCssLayoutPrefix; 749 750 document.querySelectorAll(cssContainerPrefix + ', ' + cssLayoutPrefix).forEach(function (el) { 751 el.style.overflowX = ''; 752 }); 753 } 754 755 element.classList.remove.apply(element.classList, animation_classes); 756 757 element.style.animationDelay = ''; 758 element.style.animationDuration = ''; 759 element.style.animationTimingFunction = ''; 760 element.style.opacity = ''; 761 element.style.transform = ''; 762 element.style.left = ''; 763 764 // Prevent animation module with no explicit position property to be incorrectly positioned 765 // after the animation is complete and the animation classname is removed because the animation classname has 766 // animation-name property which gives pseudo correct z-index. This class also works as a marker to prevent animating already animated objects. 767 element.classList.add('et_had_animation'); 768 } 769 770 /** 771 * Animation Functionality of POPUP 772 * 773 * @param Element $elementOriginal 774 */
775 function df_animate_element(elementOriginal) { 776 var element = elementOriginal; 777 if (element.classList.contains('et_had_animation')) { 778 return; 779 } 780 781 var animation_style = element.getAttribute('data-animation-style'); 782 var animation_repeat = element.getAttribute('data-animation-repeat'); 783 var animation_duration = element.getAttribute('data-animation-duration'); 784 var animation_delay = element.getAttribute('data-animation-delay'); 785 var animation_intensity = element.getAttribute('data-animation-intensity'); 786 var animation_starting_opacity = element.getAttribute('data-animation-starting-opacity'); 787 var animation_speed_curve = element.getAttribute('data-animation-speed-curve'); 788 var buttonWrapper = element.closest('.et_pb_button_module_wrapper'); 789 var isEdge = document.body.classList.contains('edge'); // Check for the 'edge' class in the body's classList 790 791 if (element.classList.contains('et_pb_section') && animation_style === 'roll') { 792 document.querySelectorAll(et_frontend_scripts.builderCssContainerPrefix + ', ' + et_frontend_scripts.builderCssLayoutPrefix).forEach(function (el) { 793 el.style.overflowX = 'hidden'; 794 }); 795 } 796 797 // Remove all the animation data attributes once the variables have been set 798 df_remove_animation_data(element); 799 800 // Opacity can be 0 to 1 so the starting opacity is equal to the percentage number multiplied by 0.01 801 var starting_opacity = isNaN(parseInt(animation_starting_opacity)) ? 0 : parseInt(animation_starting_opacity) * 0.01; 802 803 // Check if the animation speed curve is one of the allowed ones and set it to the default one if it is not 804 var allowed_speed_curves = ['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out']; 805 animation_speed_curve = allowed_speed_curves.includes(animation_speed_curve) ? animation_speed_curve : 'ease-in-out'; 806 807 if (buttonWrapper) { 808 element.classList.remove('et_animated'); 809 element = buttonWrapper; 810 element.classList.add('et_animated'); 811 } 812 813 element.style.animationDuration = animation_duration; 814 element.style.animationDelay = animation_delay; 815 element.style.opacity = starting_opacity; 816 element.style.animationTimingFunction = animation_speed_curve; 817 818 if (animation_style === 'slideTop' || animation_style === 'slideBottom') { 819 element.style.left = '0px'; 820 } 821 822 var intensity_css = {}; 823 var intensity_percentage = isNaN(parseInt(animation_intensity)) ? 50 : parseInt(animation_intensity); 824 825 // All the animations that can have intensity 826 var intensity_animations = ['slide', 'zoom', 'flip', 'fold', 'roll']; 827 var original_animation = false; 828 var original_direction = false; 829 830 // Check if current animation can have intensity 831 for (var i = 0; i < intensity_animations.length; i++) { 832 var animation = intensity_animations[i]; 833 // As the animation style is a combination of type and direction check if 834 // the current animation contains any of the allowed animation types 835 if (!animation_style || !animation_style.startsWith(animation)) { 836 continue; 837 } 838 // If it does set the original animation to the base animation type 839 original_animation = animation; 840 // Get the remainder of the animation style and set it as the direction 841 original_direction = animation_style.substr(animation.length, animation_style.length); 842 // If that is not empty convert it to lower case for better readability's sake 843 if (original_direction !== '') { 844 original_direction = original_direction.toLowerCase(); 845 } 846 break; 847 } 848 849 if (original_animation !== false && original_direction !== false) { 850 intensity_css = df_process_animation_intensity(original_animation, original_direction, intensity_percentage); 851 } 852 853 if (Object.keys(intensity_css).length > 0) { // temporarily disable transform transitions to avoid double animation. 854 if (isEdge) { 855 Object.assign(intensity_css, { transition: 'transform 0s ease-in' }); 856 } 857 Object.assign(element.style, intensity_css); 858 } 859 860 element.classList.add('et_animated'); 861 element.classList.add('et_is_animating'); 862 element.classList.add(animation_style); 863 animation_repeat ? element.classList.add(animation_repeat) : false; 864 865 // Remove the animation after it completes if it is not an infinite one 866 if (!animation_repeat) { 867 var animation_duration_ms = parseInt(animation_duration); 868 var animation_delay_ms = parseInt(animation_delay); 869 870 setTimeout(function () { 871 df_remove_animation(element); 872 if (isEdge && Object.keys(intensity_css).length > 0) { 873 // re-enable transform transitions after animation is done. 874 element.style.transition = ''; 875 } 876 }, animation_duration_ms + animation_delay_ms); 877 } 878 } 879 880 /** 881 * Animation Processing of POPUP 882 * 883 * @param animation 884 * @param direction 885 * @param intensity 886 * @reutn $intensity_css inline css apply when go view point 887 */ 888 889 function df_process_animation_intensity(animation, direction, intensity) { 890 var intensity_css = {}; 891 switch (animation) { 892 case 'slide': 893 switch (direction) { 894 case 'top': 895 var percentage = intensity * -2; 896 intensity_css = { 897 transform: "translate3d(0, ".concat(percentage, "%, 0)") 898 }; 899 break; 900 case 'right': 901 var percentage = intensity * 2; 902 intensity_css = { 903 transform: "translate3d(".concat(percentage, "%, 0, 0)") 904 }; 905 break; 906 case 'bottom': 907 var percentage = intensity * 2; 908 intensity_css = { 909 transform: "translate3d(0, ".concat(percentage, "%, 0)") 910 }; 911 break; 912 case 'left': 913 var percentage = intensity * -2; 914 intensity_css = { 915 transform: "translate3d(".concat(percentage, "%, 0, 0)") 916 }; 917 break; 918 default: 919 var scale = (100 - intensity) * 0.01; 920 intensity_css = { 921 transform: "scale3d(".concat(scale, ", ").concat(scale, ", ").concat(scale, ")") 922 }; 923 break; 924 } 925 break; 926 case 'zoom': 927 var scale = (100 - intensity) * 0.01; 928 switch (direction) { 929 case 'top': 930 intensity_css = { 931 transform: "scale3d(".concat(scale, ", ").concat(scale, ", ").concat(scale, ")") 932 }; 933 break; 934 case 'right': 935 intensity_css = { 936 transform: "scale3d(".concat(scale, ", ").concat(scale, ", ").concat(scale, ")") 937 }; 938 break; 939 case 'bottom': 940 intensity_css = { 941 transform: "scale3d(".concat(scale, ", ").concat(scale, ", ").concat(scale, ")") 942 }; 943 break; 944 case 'left': 945 intensity_css = { 946 transform: "scale3d(".concat(scale, ", ").concat(scale, ", ").concat(scale, ")") 947 }; 948 break; 949 default: 950 intensity_css = { 951 transform: "scale3d(".concat(scale, ", ").concat(scale, ", ").concat(scale, ")") 952 }; 953 break; 954 } 955 break; 956 case 'flip': 957 switch (direction) { 958 case 'right':
959 var degree = Math.ceil(90 / 100 * intensity); 960 intensity_css = { 961 transform: "perspective(2000px) rotateY(".concat(degree, "deg)") 962 }; 963 break; 964 case 'left': 965 var degree = Math.ceil(90 / 100 * intensity) * -1; 966 intensity_css = { 967 transform: "perspective(2000px) rotateY(".concat(degree, "deg)") 968 }; 969 break; 970 case 'top': 971 default: 972 var degree = Math.ceil(90 / 100 * intensity); 973 intensity_css = { 974 transform: "perspective(2000px) rotateX(".concat(degree, "deg)") 975 }; 976 break; 977 case 'bottom': 978 var degree = Math.ceil(90 / 100 * intensity) * -1; 979 intensity_css = { 980 transform: "perspective(2000px) rotateX(".concat(degree, "deg)") 981 }; 982 break; 983 } 984 break; 985 case 'fold': 986 switch (direction) { 987 case 'top': 988 var degree = Math.ceil(90 / 100 * intensity) * -1; 989 intensity_css = { 990 transform: "perspective(2000px) rotateX(".concat(degree, "deg)") 991 }; 992 break; 993 case 'bottom': 994 var degree = Math.ceil(90 / 100 * intensity); 995 intensity_css = { 996 transform: "perspective(2000px) rotateX(".concat(degree, "deg)") 997 }; 998 break; 999 case 'left': 1000 var degree = Math.ceil(90 / 100 * intensity); 1001 intensity_css = { 1002 transform: "perspective(2000px) rotateY(".concat(degree, "deg)") 1003 }; 1004 break; 1005 case 'right': 1006 default: 1007 var degree = Math.ceil(90 / 100 * intensity) * -1; 1008 intensity_css = { 1009 transform: "perspective(2000px) rotateY(".concat(degree, "deg)") 1010 }; 1011 break; 1012 } 1013 break; 1014 case 'roll': 1015 switch (direction) { 1016 case 'right': 1017 case 'bottom': 1018 var degree = Math.ceil(360 / 100 * intensity) * -1; 1019 intensity_css = { 1020 transform: "rotateZ(".concat(degree, "deg)") 1021 }; 1022 break; 1023 case 'top': 1024 case 'left': 1025 var degree = Math.ceil(360 / 100 * intensity); 1026 intensity_css = { 1027 transform: "rotateZ(".concat(degree, "deg)") 1028 }; 1029 break; 1030 default: 1031 var degree = Math.ceil(360 / 100 * intensity); 1032 intensity_css = { 1033 transform: "rotateZ(".concat(degree, "deg)") 1034 }; 1035 break; 1036 } 1037 break; 1038 } 1039 return intensity_css; 1040 } 1041 /** 1042 * Scroll Event by Insertion Observer 1043 * Use Observer API 1044 * Main Function for Scroll Popup Content run only if option is enable 1045 */ 1046 function popupScrollByObserver(){ 1047 const popup_scroll_added = document.body.classList.contains('popup_scroll_added') 1048 if (popup_scroll_added) { 1049 const Observer = new IntersectionObserver( 1050 (modules, observer) => { 1051 modules.forEach((module, i) => { 1052 1053 const target = module.target; 1054 1055 1056 1057 const isEtWaypoint = target.classList.contains("et-waypoint"); 1058 1059 const isBlurb = target.classList.contains("et_pb_blurb"); 1060 const isEtAnimated = target.classList.contains("et_animated"); 1061 if (module.isIntersecting) { 1062 1063 if(isEtAnimated){ // When User give Custom Animation 1064 df_animate_element(target) 1065 } 1066 1067 // Apply the "et-animated" class to the target element 1068 if(isEtWaypoint){ 1069 target.classList.add("et-animated"); 1070 } 1071 if(isBlurb){ 1072 const etWaypointDivs = document.querySelectorAll('.popup-container .et-waypoint'); 1073 etWaypointDivs.forEach(div => { 1074 div.classList.add('et-animated'); 1075 }); 1076 } 1077 1078 if(target.classList.contains("et_pb_number_counter")){ 1079 target.classList.add("active"); 1080 var $et_pb_number_counter = $('.et_pb_number_counter'); 1081 if ($et_pb_number_counter.length) { 1082 $et_pb_number_counter.each(function() { 1083 var $this_counter = $(this); 1084 $this_counter.data('easyPieChart').update($this_counter.data('number-value')); 1085 1086 }); 1087 } 1088 1089 } 1090 1091 if(target.classList.contains("et_pb_circle_counter")){ 1092 var $et_pb_circle_counter = $('.et_pb_circle_counter'); 1093 if($et_pb_circle_counter.length){ 1094 var $this_counter = $(target).find('.et_pb_circle_counter_inner'); 1095 if ($this_counter.data('PieChartHasLoaded') || 'undefined' === typeof $this_counter.data('easyPieChart')) { 1096 return; 1097 } 1098 $this_counter.data('easyPieChart').update($this_counter.data('number-value')); 1099 $this_counter.data('PieChartHasLoaded', true); 1100 } 1101 1102 } 1103 // Stop observing the target element 1104 observer.unobserve(target); 1105 } 1106 1107 }); 1108 }, 1109 { threshold: .5 } 1110 ); 1111 1112 const et_pb_module = document.querySelectorAll(".popup_scroll_added .popup-container .et_pb_module"); 1113 et_pb_module.forEach((module) => { 1114 Observer.observe(module); 1115 }); 1116 } 1117 } 1118 window.addEventListener('DOMContentLoaded', function (){ 1119 dfpopup.init(); 1120 }) 1121 1122})(jQuery);
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.