1( function ($, elementorFrontend){ 2 3 'use strict' 4 5 var WdesPopupFrontend = { 6 7 init :function () { 8 var popupList = $ ( '.wdes-popup:not(.wdes-popup-single-preview)' ), 9 isEditor = Boolean( elementorFrontend.isEditMode() ); 10 11 if( ! isEditor ){ 12 popupList.each( function (i){ 13 let target = $( this ) , 14 settings = target.data( 'settings' ); 15 16 let instance = new WdesPopupFrontend.popupModal(target, settings); 17 instance.construct(); 18 19 } ); 20 } 21 22 }, 23 24 popupModal : function ( popup, settings){ 25 var self = this, 26 $window = $( window ), 27 id = settings ['id'], 28 popupId = settings['wdes-popup-id'], 29 isEditor = Boolean( elementorFrontend.isEditMode() ); 30 31 self.construct = function (){ 32 var isAvailable = self.availableCheck(); 33 34 if ( ! isAvailable || isEditor ) { 35 return false; 36 } 37 38 self.setLocalStorageData( popupId, 'enable' ); 39 40 self.openModal(); 41 42 }, 43 44 self.availableCheck = function () { 45 let storageData = self.getLocalStorageData() || {}; 46 47 if( ! storageData.hasOwnProperty( popupId ) ){ 48 return true; 49 } 50 51 let popupData = storageData [popupId], 52 status = 'enable', 53 showAgainDate = 'none'; 54 55 if ( 'disable' === popupData ){ 56 return false; 57 } 58 59 if( 'enable' === popupData ){ 60 return true; 61 } 62 63 if( popupData.hasOwnProperty('status') ){ 64 status = popupData['status']; 65 } 66 67 if( 'enable' === status ){ 68 return true; 69 } 70 71 if ( popupData.hasOwnProperty('show-again-date') ){ 72 showAgainDate = popupData['show-again-date']; 73 } 74 75 if( 'none' === showAgainDate && 'disable' === status ){ 76 return false; 77 } 78 79 if ( showAgainDate < Date.now() ) { 80 return true; 81 } else { 82 return false; 83 } 84 85 }, 86 87 self.getLocalStorageData = function (){ 88 try { 89 return JSON.parse( localStorage.getItem( 'wdesPopupData' ) ); 90 } catch ( e ) { 91 return false; 92 } 93 94 } 95 96 self.setLocalStorageData = function (id, status){ 97 var wdesPopupData = self.getLocalStorageData() || {}, 98 newData = {}; 99 100 newData['status'] = status; 101 102 if ( 'disable' === status ) { 103 104 var nowDate = Date.now(), 105 showAgainDelay = settings['show-again-delay'], 106 showAgainDate = 'none' !== showAgainDelay ? ( nowDate + showAgainDelay ) : 'none'; 107 108 newData['show-again-date'] = showAgainDate; 109 } 110 111 wdesPopupData[ id ] = newData; 112 113 localStorage.setItem( 'wdesPopupData', JSON.stringify( wdesPopupData ) ); 114 }, 115 116 self.openModal = function (){ 117 118 switch( settings['open-trigger'] ){ 119 case 'page-load': 120 self.pageLoad( settings['page-load-delay'] ); 121 break; 122 123 case 'user-inactive': 124 self.userInactive( settings['user-inactivity-time'] ) 125 break; 126 127 case 'scroll-trigger': 128 self.scrollPage( settings['scrolled-to'] ); 129 break; 130 131 case 'try-exit-trigger': 132 self.tryExit(); 133 break; 134 135 case 'on-date': 136 self.onDate( settings['on-date'] ); 137 break; 138 139 case 'on-time': 140 self.onTime( settings['on-time-start'], settings['on-time-end'] ); 141 break; 142 143 } 144 145 146 }, 147 148 self.pageLoad = function (delayValue){ 149 let delay = Number.isInteger(delayValue) ? delayValue : 0; 150
151 delay = delay * 1000; 152 setTimeout( function (){ 153 self.MicroModalInit(); 154 }, delay ); 155 156 }, 157 158 self.userInactive = function (delayValue){ 159 var delay = Number.isInteger(delayValue) ? delayValue : 0, 160 isInactive = true; 161 162 delay = delay * 1000; 163 164 setTimeout( function (){ 165 if ( isInactive ) { 166 self.MicroModalInit(); 167 } 168 }, delay ); 169 170 $( document ).on( 'click focus resize keyup scroll', function() { 171 isInactive = false; 172 } ); 173 174 }, 175 176 self.scrollPage = function (scrollingValue){ 177 var scrollValue = Number.isInteger(scrollingValue) ? scrollingValue : 0; 178 179 $window.on('scroll resize', function () { 180 let windowHeight = $window.height(), 181 documentHeight = $( document ).height(), 182 scrolledHeight = documentHeight - windowHeight, 183 scrolledProgress = Math.max( 0, Math.min( 1, $window.scrollTop() / scrolledHeight ) ) * 100; 184 185 if ( scrolledProgress >= scrollValue ) { 186 $window.off( 'scroll resize' ); 187 self.MicroModalInit(); 188 } 189 190 }); 191 }, 192 self.tryExit = function () { 193 var pageY = 0; 194 195 $( document ).on( 'mouseleave', 'body', function( event ) { 196 197 pageY = event.pageY - $window.scrollTop(); 198 199 if ( 0 > pageY && ! popup.hasClass( 'is-open' ) ) { 200 self.MicroModalInit(); 201 } 202 } ); 203 }, 204 self.onDate = function( date ) { 205 var nowDate = Date.now(), 206 startDate = Date.parse( date ); 207 if ( startDate < nowDate ) { 208 209 setTimeout( function() { 210 self.MicroModalInit(); 211 }, 500 ); 212 } 213 }, 214 215 self.onTime = function( startTime = '00:00', endTime = '23:59' ) { 216 var startTime = '' !== startTime ? startTime : '00:00', 217 endTime = '' !== endTime ? endTime : '23:59', 218 nowTimeStamp = Date.now(), 219 dateTimeFormat = new Intl.DateTimeFormat( 'en', { year: 'numeric', month: 'short', day: '2-digit' } ), 220 [ { value: month },,{ value: day },,{ value: year } ] = dateTimeFormat.formatToParts( nowTimeStamp ), 221 startTime = `${ month }. ${ day }, ${ year } ${ startTime }`, 222 endTime = `${ month }. ${ day }, ${ year } ${ endTime }`, 223 startTimeStamp = Date.parse( startTime ), 224 endTimeStamp = Date.parse( endTime ); 225 226 if ( ( startTimeStamp < nowTimeStamp ) && ( nowTimeStamp < endTimeStamp ) ) { 227 setTimeout( function() { 228 self.MicroModalInit(); 229 }, 500 ); 230 } 231 }, 232 self.MicroModalInit = function (){ 233 let activePopupElement = settings['wdes-popup-id']; 234 235 MicroModal.show(settings['wdes-popup-id'],{ 236 onShow: function (modle, activePopupElement){ 237 let $overlayElement = $('.wdes-popup-overlay',modle), 238 animeOverlayInstance = null, 239 animeOverlaySettings = $.extend( 240 { 241 targets: $overlayElement[0] 242 }, 243 self.animeEffects[ 'fade' ][ 'show' ] 244 ), 245 $contentElement = $('.wdes-popup-container',modle),
246 animeContentInstance = null, 247 animeContentSettings = $.extend( 248 { 249 targets: $contentElement[0] 250 }, 251 self.animeEffects [settings['animation']][ 'show' ] 252 ) 253 ; 254 255 if ( ! self.availableCheck || isEditor ) { 256 return false; 257 } 258 259 //anime Overlay 260 animeOverlayInstance = anime(animeOverlaySettings); 261 262 //anime Content 263 animeContentInstance = anime(animeContentSettings); 264 265 266 }, 267 onClose: function (modle){ 268 let $overlayElement = $('.wdes-popup-overlay',modle), 269 animeOverlayInstance = null, 270 animeOverlaySettings = $.extend( 271 { 272 targets: $overlayElement[0] 273 }, 274 self.animeEffects[ 'fade' ][ 'hide' ] 275 ), 276 $contentElement = $('.wdes-popup-container',modle), 277 animeContentInstance = null, 278 animeContentSettings = $.extend( 279 { 280 targets: $contentElement[0] 281 }, 282 self.animeEffects [settings['animation']][ 'hide' ] 283 ), 284 constantly = settings['show-once'] 285 ; 286 if ( constantly ) { 287 self.setLocalStorageData( popupId, 'disable' ); 288 } 289 //anime Overlay 290 animeOverlayInstance = anime(animeOverlaySettings); 291 292 //anime Content 293 animeContentInstance = anime(animeContentSettings); 294 295 $(modle).addClass('is-close'); 296 }, 297 disableScroll: settings['prevent-scrolling'], 298 awaitCloseAnimation: true 299 }); 300 } 301 302 self.animeEffects = { 303 'fade': { 304 'show': { 305 delay: 200, 306 opacity: { 307 value: [0, 1], 308 duration:600, 309 easing: 'easeOutQuart', 310 }, 311 }, 312 'hide': { 313 easing: 'easeOutQuart', 314 opacity: { 315 value: [1, 0], 316 duration:400, 317 easing: 'easeOutQuart', 318 }, 319 } 320 }, 321 322 'zoom-in': { 323 'show': { 324 duration:500, 325 delay: 200, 326 easing: 'easeOutQuart', 327 opacity: { 328 value: [0, 1] 329 }, 330 scale: { 331 value:[ 0.75, 1] 332 } 333 }, 334 'hide': { 335 duration:400, 336 easing: 'easeOutQuart', 337 opacity: { 338 value: [1, 0], 339 }, 340 scale: { 341 value:[ 1 , 0.75] 342 } 343 } 344 }, 345 346 'zoom-out': { 347 'show': { 348 duration:500, 349 delay: 200, 350 easing: 'easeOutQuart', 351 opacity: { 352 value: [0, 1] 353 }, 354 scale: { 355 value:[ 1.25, 1] 356 } 357 }, 358 'hide': { 359 duration:400, 360 easing: 'easeOutQuart', 361 opacity: { 362 value: [1, 0], 363 }, 364 scale: { 365 value:[ 1 , 1.25] 366 } 367 } 368 }, 369 370 'rotate': { 371 'show': { 372 duration:500, 373 delay: 200, 374 easing: 'easeOutQuart', 375 opacity: { 376 value: [0, 1] 377 }, 378 scale: { 379 value:[ 0.75, 1] 380 }, 381 rotate: { 382 value: [ -65, 0 ] 383 } 384 }, 385 'hide': { 386 duration:400, 387 easing: 'easeOutQuart', 388 opacity: { 389 value: [1, 0], 390 }, 391 scale: { 392 value:[ 1 , 0.9] 393 } 394 } 395 }, 396 397 'move-up': { 398 'show': { 399 duration:500, 400 delay: 200, 401 easing: 'easeOutQuart', 402 opacity: { 403 value: [0, 1] 404 }, 405 translateY:{ 406 value: [ 50, 1] 407 } 408 }, 409 'hide': { 410 duration:400, 411 easing: 'easeOutQuart', 412 opacity: { 413 value: [1, 0], 414 }, 415 translateY:{ 416 value: [ 1, 50] 417 } 418 } 419 }, 420 421 'flip-x': { 422 'show': { 423 duration:1000, 424 delay: 200, 425 easing: 'easeOutQuart', 426 opacity: { 427 value: [0, 1] 428 }, 429 rotateX:{ 430 value: [ 65, 0] 431 } 432 }, 433 'hide': { 434 duration:400, 435 easing: 'easeOutQuart', 436 opacity: { 437 value: [1, 0], 438 } 439 } 440 }, 441 442 'flip-y': { 443 'show': { 444 duration:1000, 445 delay: 200, 446 easing: 'easeOutQuart', 447 opacity: { 448 value: [0, 1] 449 }, 450 rotateY:{ 451 value: [ 65, 0] 452 } 453 }, 454 'hide': { 455 duration:400, 456 easing: 'easeOutQuart', 457 opacity: { 458 value: [1, 0], 459 } 460 } 461 }, 462 463 'bounce-in': { 464 'show': { 465 duration:1000, 466 opacity: { 467 value: [0, 1], 468 delay: 500, 469 easing: 'easeOutQuart', 470 }, 471 scale:{ 472 value: [ 0.2, 1], 473 delay: 800, 474 elasticity: function(el, i, l) { 475 return (400 + i * 200); 476 }, 477 } 478 }, 479 'hide': { 480 duration:400, 481 easing: 'easeOutQuart', 482 opacity: { 483 value: [1, 0], 484 }, 485 scale: { 486 value:[ 1, 0.8 ] 487 } 488 } 489 }, 490 491 'bounce-out': { 492 'show': { 493 duration:200, 494 opacity: { 495 value: [0, 1], 496 delay: 500, 497 easing: 'easeOutQuart', 498 }, 499 scale:{ 500 value: [ 1.8, 1], 501 delay: 800, 502 elasticity: function(el, i, l) { 503 return (400 + i * 200); 504 }, 505 } 506 }, 507 'hide': { 508 duration:400, 509 easing: 'easeOutQuart', 510 opacity: { 511 value: [1, 0], 512 }, 513 scale: { 514 value:[ 1, 1.5 ] 515 } 516 } 517 }, 518 519 'slider-in-up' : { 520 'show': { 521 delay: 200, 522 opacity: { 523 value: [ 0, 1 ], 524 duration: 400, 525 easing: 'easeOutQuart', 526 }, 527 translateY: { 528 value: ['100vh', 0], 529 duration: 750, 530 easing: 'easeOutQuart', 531 } 532 }, 533 'hide': { 534 duration: 400, 535 easing: 'easeInQuart', 536 opacity: { 537 value: [ 1, 0 ], 538 }, 539 translateY: { 540 value: [0,'100vh'], 541 } 542 } 543 }, 544 545 'slider-in-right': { 546 'show': { 547 delay:200, 548 opacity: { 549 value: [0, 1], 550 duration: 400, 551 easing: 'easeOutQuart', 552 }, 553 translateX:{ 554 value: [ '100vh', 0], 555 duration: 750, 556 easing: 'easeOutQuart', 557 } 558 }, 559 'hide': { 560 duration:400, 561 easing: 'easeInQuart', 562 opacity: { 563 value: [1, 0], 564 }, 565 translateX: { 566 value:[ 0, '100vh' ] 567 } 568 } 569 }, 570 571 'slider-in-down': { 572 'show': { 573 delay:200, 574 opacity: { 575 value: [0, 1], 576 duration: 400, 577 easing: 'easeOutQuart', 578 }, 579 translateY:{ 580 value: [ '-100vh', 0], 581 duration: 750, 582 easing: 'easeOutQuart', 583 } 584 }, 585 'hide': { 586 duration:400, 587 easing: 'easeInQuart', 588 opacity: { 589 value: [1, 0], 590 }, 591 translateY: { 592 value:[ 0, '-100vh' ] 593 } 594 } 595 }, 596 597 'slider-in-left': { 598 'show': { 599 delay:200, 600 opacity: { 601 value: [0, 1], 602 duration: 400, 603 easing: 'easeOutQuart', 604 }, 605 translateX:{ 606 value: [ '-100vh', 0], 607 duration: 750, 608 easing: 'easeOutQuart', 609 } 610 }, 611 'hide': { 612 duration:400, 613 easing: 'easeInQuart', 614 opacity: { 615 value: [1, 0], 616 }, 617 translateX: { 618 value:[ 0, '-100vh' ] 619 } 620 } 621 }, 622 623 } 624 625 } 626 627 } 628 629 630 $( window ).on('elementor/frontend/init', WdesPopupFrontend.init); 631 632}(jQuery, window.elementorFrontend) )
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.