1/** 2 * Do not touch this file! This file created by the Popup Maker plugin using PHP 3 * Last modified time: Dec 11 2024, 10:36:50 4 */ 5 6 7/** 8 * Adds needed backward compatibility for older versions of jQuery 9 */ 10( function( $ ) { 11 'use strict'; 12 if ( $.fn.on === undefined ) { 13 $.fn.on = function( types, sel, fn ) { 14 return this.delegate( sel, types, fn ); 15 }; 16 } 17 if ( $.fn.off === undefined ) { 18 $.fn.off = function( types, sel, fn ) { 19 return this.undelegate( sel, types, fn ); 20 }; 21 } 22 23 if ( $.fn.bindFirst === undefined ) { 24 $.fn.bindFirst = function( which, handler ) { 25 var $el = $( this ), 26 events, 27 registered; 28 29 $el.unbind( which, handler ); 30 $el.bind( which, handler ); 31 32 events = $._data( $el[ 0 ] ).events; 33 registered = events[ which ]; 34 registered.unshift( registered.pop() ); 35 36 events[ which ] = registered; 37 }; 38 } 39 40 if ( $.fn.outerHtml === undefined ) { 41 $.fn.outerHtml = function() { 42 var $el = $( this ).clone(), 43 $temp = $( '<div/>' ).append( $el ); 44 45 return $temp.html(); 46 }; 47 } 48 49 if ( $.fn.isInViewport === undefined ) { 50 $.fn.isInViewport = function() { 51 var elementTop = $( this ).offset().top; 52 var elementBottom = elementTop + $( this ).outerHeight(); 53 54 var viewportTop = $( window ).scrollTop(); 55 var viewportBottom = viewportTop + $( window ).height(); 56 57 return elementBottom > viewportTop && elementTop < viewportBottom; 58 }; 59 } 60 61 if ( Date.now === undefined ) { 62 Date.now = function() { 63 return new Date().getTime(); 64 }; 65 } 66} )( jQuery ); 67 68/** 69 * Defines the core $.popmake function which will load the proper methods. 70 * Version 1.4 71 */ 72var PUM; 73(function ($, document, undefined) { 74 "use strict"; 75 76 window.pum_vars = window.pum_vars || { 77 // TODO Add defaults. 78 default_theme: '0', 79 home_url: '/', 80 version: 1.7, 81 pm_dir_url: '', 82 ajaxurl: '', 83 restapi: false, 84 analytics_api: false, 85 rest_nonce: null, 86 debug_mode: false, 87 disable_tracking: true, 88 message_position: 'top', 89 core_sub_forms_enabled: true, 90 popups: {} 91 }; 92 93 window.pum_popups = window.pum_popups || {}; 94 95 // Backward compatibility fill. 96 window.pum_vars.popups = window.pum_popups; 97 98 function isInt(value) { 99 return !isNaN(value) && parseInt(Number(value)) === parseInt(value) && !isNaN(parseInt(value, 10)); 100 } 101 102 function Selector_Cache() { 103 var elementCache = {}; 104 105 var get_from_cache = function (selector, $ctxt, reset) { 106 107 if ('boolean' === typeof $ctxt) { 108 reset = $ctxt; 109 $ctxt = false; 110 } 111 var cacheKey = $ctxt ? $ctxt.selector + ' ' + selector : selector; 112 113 if (undefined === elementCache[cacheKey] || reset) { 114 elementCache[cacheKey] = $ctxt ? $ctxt.find(selector) : jQuery(selector); 115 } 116 117 return elementCache[cacheKey]; 118 }; 119 120 get_from_cache.elementCache = elementCache; 121 return get_from_cache; 122 } 123 124 function string_to_ref(object, reference) { 125 function arr_deref(o, ref, i) { 126 return !ref ? o : (o[ref.slice(0, i ? -1 : ref.length)]); 127 } 128 129 function dot_deref(o, ref) { 130 return !ref ? o : ref.split('[').reduce(arr_deref, o); 131 } 132 133 return reference.split('.').reduce(dot_deref, object); 134 } 135 136 PUM = { 137 get: new Selector_Cache(), 138 getPopup: function (el) { 139 var $this; 140 141 // Quick Shortcuts 142 if (isInt(el)) { 143 $this = PUM.get('#pum-' + el); 144 } else if (el === 'current') { 145 $this = PUM.get('.pum-overlay.pum-active:eq(0)', true); 146 } else if (el === 'open') { 147 $this = PUM.get('.pum-overlay.pum-active', true); 148 } else if (el === 'closed') { 149 $this = PUM.get('.pum-overlay:not(.pum-active)', true); 150 } else if (el instanceof jQuery) { 151 $this = el; 152 } else { 153 $this = $(el); 154 } 155 156 if ($this.hasClass('pum-overlay')) { 157 return $this; 158 } 159 160 if ($this.hasClass('popmake')) { 161 return $this.parents('.pum-overlay'); 162 } 163 164 return $this.parents('.pum-overlay').length ? $this.parents('.pum-overlay') : $(); 165 }, 166 open: function (el, callback) { 167 PUM.getPopup(el).popmake('open', callback); 168 }, 169 close: function (el, callback) { 170 PUM.getPopup(el).popmake('close', callback); 171 }, 172 preventOpen: function (el) { 173 PUM.getPopup(el).addClass('preventOpen'); 174 }, 175 getSettings: function (el) { 176 var $popup = PUM.getPopup(el); 177 178 return $popup.popmake('getSettings'); 179 }, 180 getSetting: function (el, key, _default) { 181 var settings = PUM.getSettings(el), 182 value = string_to_ref(settings, key); 183 184 return typeof value !== 'undefined' ? value : (_default !== undefined ? _default : null); 185 }, 186 checkConditions: function (el) { 187 return PUM.getPopup(el).popmake('checkConditions'); 188 }, 189 getCookie: function (cookie_name) { 190 return $.pm_cookie(cookie_name); 191 }, 192 getJSONCookie: function (cookie_name) { 193 return $.pm_cookie_json(cookie_name); 194 },
195 setCookie: function (el, settings) { 196 var $popup = PUM.getPopup(el); 197 198 $popup.popmake('setCookie', jQuery.extend({ 199 name: 'pum-' + PUM.getSetting(el, 'id'), 200 expires: '+30 days' 201 }, settings)); 202 }, 203 clearCookie: function (cookie_name, callback) { 204 $.pm_remove_cookie(cookie_name); 205 206 if (typeof callback === 'function') { 207 callback(); 208 } 209 }, 210 clearCookies: function (el, callback) { 211 var $popup = PUM.getPopup(el), 212 settings = $popup.popmake('getSettings'), 213 cookies = settings.cookies, 214 cookie = null, 215 i; 216 217 if (cookies !== undefined && cookies.length) { 218 for (i = 0; cookies.length > i; i += 1) { 219 $.pm_remove_cookie(cookies[i].settings.name); 220 } 221 } 222 223 if (typeof callback === 'function') { 224 callback(); 225 } 226 }, 227 getClickTriggerSelector: function (el, trigger_settings) { 228 var $popup = PUM.getPopup(el), 229 settings = PUM.getSettings(el), 230 trigger_selectors = [ 231 '.popmake-' + settings.id, 232 '.popmake-' + decodeURIComponent(settings.slug), 233 'a[href$="#popmake-' + settings.id + '"]' 234 ]; 235 236 if (trigger_settings.extra_selectors && trigger_settings.extra_selectors !== '') { 237 trigger_selectors.push(trigger_settings.extra_selectors); 238 } 239 240 trigger_selectors = pum.hooks.applyFilters('pum.trigger.click_open.selectors', trigger_selectors, trigger_settings, $popup); 241 242 return trigger_selectors.join(', '); 243 }, 244 disableClickTriggers: function (el, trigger_settings) { 245 if (el === undefined) { 246 // disable all triggers. Not available yet. 247 return; 248 } 249 250 if (trigger_settings !== undefined) { 251 var selector = PUM.getClickTriggerSelector(el, trigger_settings); 252 $(selector).removeClass('pum-trigger'); 253 $(document).off('click.pumTrigger click.popmakeOpen', selector) 254 } else { 255 var triggers = PUM.getSetting(el, 'triggers', []); 256 if (triggers.length) { 257 for (var i = 0; triggers.length > i; i++) { 258 // If this isn't an explicitly allowed click trigger type skip it. 259 if (pum.hooks.applyFilters('pum.disableClickTriggers.clickTriggerTypes', ['click_open']).indexOf(triggers[i].type) === -1) { 260 continue; 261 } 262 263 var selector = PUM.getClickTriggerSelector(el, triggers[i].settings); 264 $(selector).removeClass('pum-trigger'); 265 $(document).off('click.pumTrigger click.popmakeOpen', selector) 266 } 267 } 268 } 269 }, 270 actions: { 271 stopIframeVideosPlaying: function() { 272 var $popup = PUM.getPopup( this ), 273 $container = $popup.popmake( 'getContainer' ); 274 275 if ( ! $popup.hasClass( 'pum-has-videos' ) ) { 276 // TODO: Move this to its own event binding to keep this method clean and simple. 277 $container 278 .find( 'iframe' ) 279 .filter( '[src*="youtube"],[src*="vimeo"]' ) 280 .each( function() { 281 var $iframe = $( this ), 282 src = $iframe.attr( 'src' ), 283 // Remove autoplay so video doesn't start playing again. 284 new_src = src.replace( 'autoplay=1', '1=1' ); 285 286 if ( new_src !== src ) { 287 src = new_src; 288 } 289 290 $iframe.prop( 'src', src ); 291 } ); 292 293 // TODO: Move this to its own event binding to keep this method clean and simple. 294 $container.find( 'video' ).each( function() { 295 this.pause(); 296 } ); 297 } 298 }, 299 } 300 }; 301 302 $.fn.popmake = function (method) { 303 // Method calling logic 304 if ($.fn.popmake.methods[method]) { 305 $(document).trigger('pumMethodCall', arguments); 306 return $.fn.popmake.methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 307 } 308 if (typeof method === 'object' || !method) { 309 return $.fn.popmake.methods.init.apply(this, arguments); 310 } 311 if (window.console) { 312 console.warn('Method ' + method + ' does not exist on $.fn.popmake'); 313 } 314 }; 315 316 // Defines the core $.popmake methods. 317 $.fn.popmake.methods = { 318 init: function () { 319 return this.each(function () { 320 var $popup = PUM.getPopup(this), 321 settings = $popup.popmake('getSettings'); 322 323 if (settings.theme_id <= 0) { 324 settings.theme_id = pum_vars.default_theme; 325 } 326 327 // TODO Move this to be a single global $(window) function that looks at any open popup. 328 if (settings.disable_reposition === undefined || !sett
328ings.disable_reposition) { 329 $(window).on('resize', function () { 330 if ($popup.hasClass('pum-active') || $popup.find('.popmake.active').length) { 331 $.fn.popmake.utilities.throttle(setTimeout(function () { 332 $popup.popmake('reposition'); 333 }, 25), 500, false); 334 } 335 }); 336 } 337 338 // Added popmake settings to the container for temporary backward compatibility with extensions. 339 // TODO Once extensions updated remove this. 340 $popup.find('.pum-container').data('popmake', settings); 341 342 $popup 343 .data('popmake', settings) 344 .trigger('pumInit'); 345 346 // If our opening sound setting is not set to None... 347 if ( settings.open_sound && 'none' !== settings.open_sound ) { 348 // ... then set up our audio. Once loaded, add to popup data. 349 var audio = 'custom' !== settings.open_sound ? new Audio( pum_vars.pm_dir_url + 'assets/sounds/' + settings.open_sound ) : new Audio( settings.custom_sound ); 350 audio.addEventListener('canplaythrough', function() { 351 $popup.data('popAudio', audio); 352 }); 353 audio.addEventListener('error', function() { 354 console.warn( 'Error occurred when trying to load Popup opening sound.' ); 355 }); 356 357 // In case our audio loaded faster than us attaching the event listener. 358 audio.load(); 359 } 360 361 return this; 362 }); 363 }, 364 getOverlay: function () { 365 return PUM.getPopup(this); 366 }, 367 getContainer: function () { 368 return PUM.getPopup(this).find('.pum-container'); 369 }, 370 getTitle: function () { 371 return PUM.getPopup(this).find('.pum-title') || null; 372 }, 373 getContent: function () { 374 return PUM.getPopup(this).find('.pum-content') || null; 375 }, 376 getClose: function () { 377 return PUM.getPopup(this).find('.pum-content + .pum-close') || null; 378 }, 379 getSettings: function () { 380 var $popup = PUM.getPopup(this); 381 return $.extend(true, {}, $.fn.popmake.defaults, $popup.data('popmake') || {}, typeof pum_popups === 'object' && typeof pum_popups[$popup.attr('id')] !== 'undefined' ? pum_popups[$popup.attr('id')] : {}); 382 }, 383 state: function (test) { 384 var $popup = PUM.getPopup(this); 385 386 if (undefined !== test) { 387 switch (test) { 388 case 'isOpen': 389 return $popup.hasClass('pum-open') || $popup.popmake('getContainer').hasClass('active'); 390 case 'isClosed': 391 return !$popup.hasClass('pum-open') && !$popup.popmake('getContainer').hasClass('active'); 392 } 393 } 394 }, 395 open: function (callback) { 396 var $popup = PUM.getPopup(this), 397 $container = $popup.popmake('getContainer'), 398 $close = $popup.popmake('getClose'), 399 settings = $popup.popmake('getSettings'), 400 $html = $('html'); 401 402 $popup.trigger('pumBeforeOpen'); 403 404 /** 405 * Allow for preventing popups from opening. 406 */ 407 if ($popup.hasClass('preventOpen') || $container.hasClass('preventOpen')) { 408 console.log('prevented'); 409 $popup 410 .removeClass('preventOpen') 411 .removeClass('pum-active') 412 .trigger('pumOpenPrevented'); 413 414 return this; 415 } 416 417 /** 418 * If popup isn't stackable close all others. 419 */ 420 if (!settings.stackable) { 421 $popup.popmake('close_all'); 422 } 423 424 $popup.addClass('pum-active'); 425 426 /** 427 * Hide the close button if delay is active. 428 */ 429 if (settings.close_button_delay > 0) { 430 $close.fadeOut(0); 431 } 432 433 $html.addClass('pum-open'); 434 435 /** 436 * Check for and disable the overlay. 437 */ 438 if (settings.overlay_disabled) { 439 $html.addClass('pum-open-overlay-disabled'); 440 } else { 441 $html.addClass('pum-open-overlay'); 442 } 443 444 /** 445 * Set position fixed when active. 446 */ 447 if (settings.position_fixed) {
448 $html.addClass('pum-open-fixed'); 449 } else { 450 $html.addClass('pum-open-scrollable'); 451 } 452 453 $popup 454 .popmake('setup_close') 455 .popmake('reposition') 456 .popmake('animate', settings.animation_type, function () { 457 458 /** 459 * Fade the close button in after specified delay. 460 */ 461 if (settings.close_button_delay > 0) { 462 setTimeout(function () { 463 $close.fadeIn(); 464 }, settings.close_button_delay); 465 } 466 467 $popup.trigger('pumAfterOpen'); 468 469 $(window).trigger('resize'); 470 471 $.fn.popmake.last_open_popup = $popup; 472 473 // Fire user passed callback. 474 if (callback !== undefined) { 475 callback(); 476 // TODO Test this new method. Then remove the above. 477 //callback.apply(this); 478 } 479 }); 480 481 // If the audio hasn't loaded yet, it wouldn't have been added to the popup. 482 if ( 'undefined' !== typeof $popup.data('popAudio') ) { 483 $popup.data('popAudio').play() 484 .catch(function(reason) { 485 console.warn('Sound was not able to play when popup opened. Reason: ' + reason); 486 }); 487 } 488 489 return this; 490 }, 491 setup_close: function () { 492 var $popup = PUM.getPopup(this), 493 $close = $popup.popmake('getClose'), 494 settings = $popup.popmake('getSettings'); 495 496 // Add For non built in close buttons and backward compatibility. 497 $close = $close.add($('.popmake-close, .pum-close', $popup).not($close)); 498 499 // TODO: Move to a global $(document).on type bind. Possibly look for an inactive class to fail on. 500 $close 501 .off('click.pum') 502 .on("click.pum", function (event) { 503 var $this = $(this), 504 do_default = $this.hasClass('pum-do-default') || ($this.data('do-default') !== undefined && $this.data('do-default')); 505 506 if (!do_default) { 507 event.preventDefault(); 508 } 509 510 $.fn.popmake.last_close_trigger = 'Close Button'; 511 $popup.popmake('close'); 512 }); 513 514 if (settings.close_on_esc_press || settings.close_on_f4_press) { 515 // TODO: Move to a global $(document).on type bind. Possibly look for a class to succeed on. 516 $(window) 517 .off('keyup.popmake') 518 .on('keyup.popmake', function (e) { 519 if (e.keyCode === 27 && settings.close_on_esc_press) { 520 $.fn.popmake.last_close_trigger = 'ESC Key'; 521 $popup.popmake('close'); 522 } 523 if (e.keyCode === 115 && settings.close_on_f4_press) { 524 $.fn.popmake.last_close_trigger = 'F4 Key'; 525 $popup.popmake('close'); 526 } 527 }); 528 } 529 530 if (settings.close_on_overlay_click) { 531 $popup.on('pumAfterOpen', function () { 532 $(document).on('click.pumCloseOverlay', function (e) { 533 var $target = $(e.target), 534 $container = $target.closest('.pum-container'); 535 536 if (!$container.length) { 537 $.fn.popmake.last_close_trigger = 'Overlay Click'; 538 $popup.popmake('close'); 539 } 540 }); 541 }); 542 543 $popup.on('pumAfterClose', function () { 544 $(document).off('click.pumCloseOverlay'); 545 }); 546 } 547 548 if (settings.close_on_form_submission) { 549 PUM.hooks.addAction('pum.integration.form.success', function (form, args
549) { 550 // If this is the same popup the form was submitted in. 551 // Alternatively we can compare their IDs 552 if (args.popup && args.popup[0] === $popup[0]) { 553 setTimeout(function () { 554 $.fn.popmake.last_close_trigger = 'Form Submission'; 555 $popup.popmake('close'); 556 }, settings.close_on_form_submission_delay || 0); 557 } 558 }); 559 } 560 561 $popup.trigger('pumSetupClose'); 562 563 return this; 564 }, 565 close: function (callback) { 566 return this.each(function () { 567 var $popup = PUM.getPopup(this), 568 $container = $popup.popmake('getContainer'), 569 $close = $popup.popmake('getClose'); 570 571 $close = $close.add($('.popmake-close, .pum-close', $popup).not($close)); 572 573 $popup.trigger('pumBeforeClose'); 574 575 if ($popup.hasClass('preventClose') || $container.hasClass('preventClose')) { 576 $popup 577 .removeClass('preventClose') 578 .trigger('pumClosePrevented'); 579 580 return this; 581 } 582 583 $container 584 .fadeOut('fast', function () { 585 586 if ($popup.is(":visible")) { 587 $popup.fadeOut('fast'); 588 } 589 590 /** 591 * Clear global event spaces. 592 */ 593 $(window).off('keyup.popmake'); 594 $popup.off('click.popmake'); 595 $close.off('click.popmake'); 596 597 // Only re-enable scrolling for the document when the last popup has closed. 598 if ($('.pum-active').length === 1) { 599 $('html') 600 .removeClass('pum-open') 601 .removeClass('pum-open-scrollable') 602 .removeClass('pum-open-overlay') 603 .removeClass('pum-open-overlay-disabled') 604 .removeClass('pum-open-fixed'); 605 } 606 607 $popup 608 .removeClass('pum-active') 609 .trigger('pumAfterClose'); 610 611 612 // Fire user passed callback. 613 if (callback !== undefined) { 614 callback(); 615 // TODO Test this new method. Then remove the above. 616 //callback.apply(this); 617 } 618 }); 619 return this; 620 }); 621 }, 622 close_all: function () { 623 $('.pum-active').popmake('close'); 624 return this; 625 }, 626 reposition: function (callback) { 627 var $popup = PUM.getPopup(this).trigger('pumBeforeReposition'), 628 $container = $popup.popmake('getContainer'), 629 settings = $popup.popmake('getSettings'), 630 location = settings.location, 631 reposition = { 632 my: "", 633 at: "", 634 of: window, 635 collision: 'none', 636 using: typeof callback === "function" ? callback : $.fn.popmake.callbacks.reposition_using 637 }, 638 opacity = {overlay: null, container: null}, 639 $last_trigger = null; 640 641 try { 642 $last_trigger = $($.fn.popmake.last_open_trigger); 643 } catch (error) { 644 $last_trigger = $(); 645 } 646 647 if (settings.position_from_trigger && $last_trigger.length) { 648 649 reposition.of = $last_trigger; 650 651 if (location.indexOf('left') >= 0) { 652 reposition.my += " right"; 653 reposition.at += " left" + (settings.position_left !== 0 ? "-" + settings.position_left : ""); 654 } 655 if (location.indexOf('right') >= 0) { 656 reposition.my += " left"; 657 reposition.at += " right" + (settings.position_right !== 0 ? "+" + settings.position_right : ""); 658 } 659 if (location.indexOf('center') >= 0) { 660 reposition.my = location === 'center' ? "center" : reposition.my + " center"; 661 reposition.at = location === 'center' ? "center" : reposition.at + " center"; 662 } 663 if (location.indexOf('top') >= 0) { 664 reposition.my += " bottom"; 665 reposition.at += " top" + (settings.position_top !== 0 ? "-" + settings.position_top : ""); 666 } 667 if (location.indexOf('bottom') >= 0) { 668 reposition.my += " top"; 669 reposition.at += " bottom" + (settings.position_bottom !== 0 ? "+" + settings.position_bottom : ""); 670 } 671 } else { 672 if (location.indexOf('left') >= 0) { 673 reposition.my += " left" + (settings.position_left !== 0 ? "+" + settings.position_left : ""); 674 reposition.at += " left"; 675 } 676 if (location.indexOf('right') >= 0) { 677 reposition.my += " right" + (settings.position_right !== 0 ? "-" + settings.position_right : ""); 678 reposition.at += " right"; 679 } 680 if (location.indexOf('center') >= 0) { 681 reposition.my = location === 'center' ? "center" : reposition.my + " center"; 682 reposition.at = location === 'center' ? "center" : reposition.at + " center"; 683 } 684 if (location.indexOf('top') >= 0) { 685 reposition.my += " top" + (settings.position_top !== 0 ? "+" + ($('body').hasClass('admin-bar') ? parseInt(settings.position_top, 10) + 32 : settings.position_top) : ""); 686 reposition.at += " top"; 687 } 688 if (location.indexOf('bottom') >= 0) { 689 reposition.my += " bottom" + (settings.position_bottom !== 0 ? "-" + settings.position_bottom : ""); 690 reposition.at += " bottom"; 691 } 692 } 693 694 reposition.my = $.trim(reposition.my); 695 reposition.at = $.trim(reposition.at); 696 697 if ($popup.is(':hidden')) {
698 opacity.overlay = $popup.css("opacity"); 699 $popup.css({opacity: 0}).show(0); 700 } 701 702 if ($container.is(':hidden')) { 703 opacity.container = $container.css("opacity"); 704 $container.css({opacity: 0}).show(0); 705 } 706 707 if (settings.position_fixed) { 708 $container.addClass('fixed'); 709 } 710 711 if (settings.size === 'custom') { 712 $container.css({ 713 width: settings.custom_width, 714 height: settings.custom_height_auto ? 'auto' : settings.custom_height 715 }); 716 } else { 717 if (settings.size !== 'auto') { 718 $container 719 .addClass('responsive') 720 .css({ 721 minWidth: settings.responsive_min_width !== '' ? settings.responsive_min_width : 'auto', 722 maxWidth: settings.responsive_max_width !== '' ? settings.responsive_max_width : 'auto' 723 }); 724 } 725 } 726 727 $popup.trigger('pumAfterReposition'); 728 729 // TODO: Remove the add class and migrate the trigger to the $popup with pum prefix. 730 $container 731 .addClass('custom-position') 732 .position(reposition) 733 .trigger('popmakeAfterReposition'); 734 735 if (location === 'center' && $container[0].offsetTop < 0) { 736 // Admin bar is 32px high, with a 10px margin that is 42 737 $container.css({top: $('body').hasClass('admin-bar') ? 42 : 10}); 738 } 739 740 if (opacity.overlay) { 741 $popup.css({opacity: opacity.overlay}).hide(0); 742 } 743 if (opacity.container) { 744 $container.css({opacity: opacity.container}).hide(0); 745 } 746 return this; 747 }, 748 animation_origin: function (origin) { 749 var $popup = PUM.getPopup(this), 750 $container = $popup.popmake('getContainer'), 751 start = { 752 my: "", 753 at: "" 754 }; 755 756 switch (origin) { 757 case 'top': 758 start = { 759 my: "left+" + $container.offset().left + " bottom-100", 760 at: "left top" 761 }; 762 break; 763 case 'bottom': 764 start = { 765 my: "left+" + $container.offset().left + " top+100", 766 at: "left bottom" 767 }; 768 break; 769 case 'left': 770 start = { 771 my: "right top+" + $container.offset().top, 772 at: "left top" 773 }; 774 break; 775 case 'right': 776 start = { 777 my: "left top+" + $container.offset().top, 778 at: "right top" 779 }; 780 break; 781 default: 782 if (origin.indexOf('left') >= 0) { 783 start = { 784 my: start.my + " right", 785 at: start.at + " left" 786 }; 787 } 788 if (origin.indexOf('right') >= 0) { 789 start = { 790 my: start.my + " left", 791 at: start.at + " right" 792 }; 793 } 794 if (origin.indexOf('center') >= 0) { 795 start = { 796 my: start.my + " center", 797 at: start.at + " center" 798 }; 799 } 800 if (origin.indexOf('top') >= 0) { 801 start = { 802 my: start.my + " bottom-100", 803 at: start.at + " top" 804 }; 805 } 806 if (origin.indexOf('bottom') >= 0) { 807 start = { 808 my: start.my + " top+100", 809 at: start.at + " bottom" 810 }; 811 } 812 start.my = $.trim(start.my); 813 start.at = $.trim(start.at); 814 break; 815 } 816 start.of = window; 817 start.collision = 'none'; 818 return start; 819 } 820 }; 821 822}(jQuery, document)); 823 824/** 825 * Initialize Popup Maker. 826 * Version 1.8 827 */ 828(function ($, document, undefined) { 829 "use strict"; 830 // Defines the current version. 831 $.fn.popmake.version = 1.8; 832 833 // Stores the last open popup. 834 $.fn.popmake.last_open_popup = null; 835 836 // Here for backward compatibility. 837 window.ajaxurl = window.pum_vars.ajaxurl; 838 839 window.PUM.init = function () { 840 console.log('init popups ✔'); 841 $(document).trigger('pumBeforeInit'); 842 $('.pum').popmake(); 843 $(document).trigger('pumInitialized'); 844 845 /** 846 * Process php based form submissions when the form_success args are passed. 847 */ 848 if (typeof pum_vars.form_success === 'object') { 849 pum_vars.form_success = $.extend({ 850 popup_id: null, 851 settings: {} 852 }); 853 854 PUM.forms.success(pum_vars.form_success.popup_id, pum_vars.form_success.settings); 855 } 856 857 // Initiate integrations. 858 PUM.integrations.init(); 859 }; 860 861 // Initiate when ready. 862 $(function () { 863 // TODO can this be moved outside doc.ready since we are awaiting our own promises first? 864 var initHandler = PUM.hooks.applyFilters('pum.initHandler', PUM.init); 865 var initPromises = PUM.hooks.applyFilters('pum.initPromises', []); 866 867 Promise.all(initPromises).then(initHandler); 868 }); 869 870 /** 871 * Add hidden field to all popup forms. 872 */ 873 $('.pum').on('pumInit', function () { 874 var $popup = PUM.getPopup(this), 875 popupID = PUM.getSetting($popup, 'id'), 876 $forms = $popup.find('form'); 877 878 /** 879 * If there are forms in the popup add a hidden field for use in retriggering the popup on reload. 880 */ 881 if ($forms.length) { 882 $forms.append('<input type="hidden" name="pum_form_popup_id" value="' + popupID + '" />'); 883 } 884 }) 885 .on( 'pumAfterClose', window.PUM.actions.stopIframeVideosPlaying ); 886 887 888}(jQuery)); 889 890/** 891 * Defines the core $.popmake binds. 892 * Version 1.4 893 */ 894var PUM_Accessibility; 895( function( $, document, undefined ) { 896 'use strict'; 897 var $top_level_elements, 898 focusableElementsString =
899 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]', 900 previouslyFocused, 901 currentModal, 902 selector = '.pum:not(.pum-accessibility-disabled)'; 903 904 PUM_Accessibility = { 905 // Accessibility: Checks focus events to ensure they stay inside the modal. 906 forceFocus: function( e ) { 907 if ( 908 currentModal && 909 currentModal.length && 910 ! currentModal[ 0 ].contains( e.target ) 911 ) { 912 e.stopPropagation(); 913 PUM_Accessibility.setFocusToFirstItem(); 914 } 915 }, 916 trapTabKey: function( e ) { 917 // if tab or shift-tab pressed 918 if ( e.keyCode === 9 ) { 919 // get list of focusable items 920 var focusableItems = currentModal 921 .find( '.pum-container *' ) 922 .filter( focusableElementsString ) 923 .filter( ':visible' ), 924 // get currently focused item 925 focusedItem = $( ':focus' ), 926 // get the number of focusable items 927 numberOfFocusableItems = focusableItems.length, 928 // get the index of the currently focused item 929 focusedItemIndex = focusableItems.index( focusedItem ); 930 931 if ( e.shiftKey ) { 932 //back tab 933 // if focused on first item and user preses back-tab, go to the last focusable item 934 if ( focusedItemIndex === 0 ) { 935 focusableItems 936 .get( numberOfFocusableItems - 1 ) 937 .focus(); 938 e.preventDefault(); 939 } 940 } else { 941 //forward tab 942 // if focused on the last item and user preses tab, go to the first focusable item 943 if ( focusedItemIndex === numberOfFocusableItems - 1 ) { 944 focusableItems.get( 0 ).focus(); 945 e.preventDefault(); 946 } 947 } 948 } 949 }, 950 setFocusToFirstItem: function() { 951 var $firstEl = currentModal 952 .find( '.pum-container *' ) 953 .filter( focusableElementsString ) 954 .filter( ':visible' ) 955 //.filter( ':not(.pum-close)' ) 956 .first(); 957 958 // set focus to first focusable item 959 $firstEl.focus(); 960 }, 961 initiateFocusLock: function() { 962 var $popup = PUM.getPopup( this ), 963 $focused = $( ':focus' ); 964 965 // Accessibility: Sets the previous focus element. 966 if ( ! $popup.has( $focused ).length ) { 967 previouslyFocused = $focused; 968 } 969 970 // Accessibility: Sets the current modal for focus checks. 971 currentModal = $popup 972 // Accessibility: Trap tab key. 973 .on( 'keydown.pum_accessibility', PUM_Accessibility.trapTabKey ); 974 975 // Accessibility: Add focus check first time focus changes after popup opens that prevents tabbing outside of modal. 976 $( document ).one( 977 'focusin.pum_accessibility', 978 PUM_Accessibility.forceFocus 979 ); 980 981 // Accessibility: Focus on the modal. 982 PUM_Accessibility.setFocusToFirstItem(); 983 }, 984 }; 985 986 $( document ) 987 .on( 'pumInit', selector, function() { 988 PUM.getPopup( this ) 989 .find( '[tabindex]' ) 990 .each( function() { 991 var $this = $( this ); 992 $this 993 .data( 'tabindex', $this.attr( 'tabindex' ) ) 994 .prop( 'tabindex', '0' ); 995 } ); 996 } ) 997 .on( 'pumBeforeOpen', selector, function() {} ) 998 .on( 'pumAfterOpen', selector, PUM_Accessibility.initiateFocusLock ) 999 .on( 'pumAfterOpen', selector, function() { 1000 var $popup = PUM.getPopup( this ); 1001 1002 // Accessibility: Sets the current modal as open. 1003 currentModal = $popup.attr( 'aria-modal', 'true' ); 1004 }) 1005 .on( 'pumBeforeClose', selector, function() {} ) 1006 .on( 'pumAfterClose', selector, function() { 1007 var $popup = PUM.getPopup( this ); 1008 1009 $popup 1010 .off( 'keydown.pum_accessibility' ) 1011 .attr( 'aria-modal', 'false' ); 1012 1013 // Accessibility: Focus back on the previously focused element. 1014 if ( previouslyFocused !== undefined && previouslyFocused.length ) { 1015 previouslyFocused.focus(); 1016 } 1017 1018 // Accessibility: Clears the currentModal var. 1019 currentModal = null; 1020 1021 // Accessibility: Removes the force focus check. 1022 $( document ).off( 'focusin.pum_accessibility' ); 1023 } ) 1024 .on( 'pumSetupClose', selector, function() {} ) 1025 .on( 'pumOpenPrevented', selector, function() {} ) 1026 .on( 'pumClosePrevented', selector, function() {} ) 1027 .on( 'pumBeforeReposition', selector, function() {} ); 1028} )( jQuery, document ); 1029 1030/** 1031 * Defines the core pum analytics methods. 1032 * Version 1.4 1033 */ 1034 1035var PUM_Analytics; 1036( function ( $ ) { 1037 'use strict'; 1038 1039 $.fn.popmake.last_open_trigger = null; 1040 $.fn.popmake.last_close_trigger = null; 1041 $.fn.popmake.conversion_trigger = null; 1042 1043 var rest_enabled = !! ( 1044 typeof pum_vars.analytics_api !== 'undefined' && pum_vars.analytics_api 1045 ); 1046 1047 PUM_Analytics = { 1048 beacon: function ( data, callback ) { 1049 var beacon = new Image(), 1050 url = rest_enabled ? pum_vars.analytics_api : pum_vars.ajaxurl, 1051 opts = { 1052 route: pum.hooks.applyFilters( 1053 'pum.analyticsBeaconRoute', 1054 '/' + pum_vars.analytics_route + '/' 1055 ), 1056 data: pum.hooks.applyFilters( 1057 'pum.AnalyticsBeaconData', 1058 $.extend( 1059 true, 1060 { 1061 event: 'open', 1062 pid: null, 1063 _cache: +new Date(), 1064 }, 1065 data 1066 ) 1067 ), 1068 callback: 1069 typeof callback === 'function' 1070 ? callback 1071 : function () {}, 1072 }; 1073 1074 if ( ! rest_enabled ) { 1075 opts.data.action = 'pum_analytics'; 1076 } else { 1077 url += opts.route; 1078 } 1079 1080 // Create a beacon if a url is provided 1081 if ( url ) { 1082 // Attach the event handlers to the image object 1083 $( beacon ).on( 'error success load done', opts.callback ); 1084 1085 // Attach the src for the script call 1086 beacon.src = url + '?' + $.param( opts.data ); 1087 } 1088 }, 1089 }; 1090 1091 if ( 1092 ( typeof pum_vars.disable_tracking === 'undefined' || 1093 ! pum_vars.disable_tracking ) && 1094 // Check for extensions disabling core tracking events. 1095 ( typeof pum_vars.disable_core_tracking === 'undefined' || 1096 ! pum_vars.disable_core_tracking ) 1097 ) { 1098 // Only popups from the editor should fire analytics events. 1099 $( document ) 1100 /** 1101 * Track opens for popups. 1102 */ 1103 .on( 'pumAfterOpen.core_analytics', '.pum', function () { 1104 var $popup = PUM.getPopup( this ), 1105 data = { 1106 pid: 1107 parseInt( 1108 $popup.popmake( 'getSettings' ).id, 1109 10 1110 ) || null, 1111 }; 1112 1113 // Shortcode popups use negative numbers, and single-popup (preview mode) shouldn't be tracked. 1114 if ( 1115 data.pid > 0 && 1116 ! $( 'body' ).hasClass( 'single-popup' ) 1117 ) { 1118 PUM_Analytics.beacon( data ); 1119 } 1120 } ); 1121 /** 1122 * Track form submission conversions 1123 */ 1124 $( function () { 1125 PUM.hooks.addAction( 1126 'pum.integration.form.success', 1127 function ( form, args ) { 1128 // If the submission has already been counted in the backend, we can bail early. 1129 if ( args.ajax === false ) { 1130 return; 1131 } 1132 1133 // If no popup is included in the args, we can bail early since we only record conversions within popups. 1134 if ( args.popup.length === 0 ) { 1135 return; 1136 } 1137 var data = { 1138 pid: 1139 parseInt( 1140 args.popup.popmake( 'getSettings' ).id, 1141 10 1142 ) || null, 1143 event: 'conversion', 1144 }; 1145 1146 // Shortcode popups use negative numbers, and single-popup (preview mode) shouldn't be tracked. 1147 if ( 1148 data.pid > 0 && 1149 ! $( 'body' ).hasClass( 'single-popup' ) 1150 ) { 1151 PUM_Analytics.beacon( data ); 1152 } 1153 } 1154 ); 1155 } ); 1156 } 1157} )( jQuery ); 1158 1159/** 1160 * Defines the core $.popmake animations. 1161 * Version 1.4 1162 */ 1163( function( $, document, undefined ) { 1164 'use strict'; 1165
1166 $.fn.popmake.methods.animate_overlay = function( 1167 style, 1168 duration, 1169 callback 1170 ) { 1171 // Method calling logic 1172 var settings = PUM.getPopup( this ).popmake( 'getSettings' ); 1173 1174 if ( settings.overlay_disabled ) { 1175 return $.fn.popmake.overlay_animations.none.apply( this, [ 1176 duration, 1177 callback, 1178 ] ); 1179 } 1180 1181 if ( $.fn.popmake.overlay_animations[ style ] ) { 1182 return $.fn.popmake.overlay_animations[ style ].apply( this, [ 1183 duration, 1184 callback, 1185 ] ); 1186 } 1187 1188 if ( window.console ) { 1189 console.warn( 'Animation style ' + style + ' does not exist.' ); 1190 } 1191 return this; 1192 }; 1193 1194 $.fn.popmake.methods.animate = function( style ) { 1195 // Method calling logic 1196 if ( $.fn.popmake.animations[ style ] ) { 1197 return $.fn.popmake.animations[ style ].apply( 1198 this, 1199 Array.prototype.slice.call( arguments, 1 ) 1200 ); 1201 } 1202 if ( window.console ) { 1203 console.warn( 'Animation style ' + style + ' does not exist.' ); 1204 } 1205 return this; 1206 }; 1207 1208 /** 1209 * Resets animation & position properties prior to opening/reopening the popup. 1210 * 1211 * @param $popup 1212 */ 1213 function popupCssReset( $popup ) { 1214 var $container = $popup.popmake( 'getContainer' ), 1215 cssResets = { display: '', opacity: '' }; 1216 1217 $popup.css( cssResets ); 1218 $container.css( cssResets ); 1219 } 1220 1221 function overlayAnimationSpeed( settings ) { 1222 if ( settings.overlay_disabled ) { 1223 return 0; 1224 } 1225 1226 return settings.animation_speed / 2; 1227 } 1228 1229 function containerAnimationSpeed( settings ) { 1230 if ( settings.overlay_disabled ) { 1231 return parseInt( settings.animation_speed ); 1232 } 1233 1234 return settings.animation_speed / 2; 1235 } 1236 1237 /** 1238 * All animations should. 1239 * 1240 * 1. Reset Popup CSS styles. Defaults are as follows: 1241 * - opacity: 1 1242 * - display: "none" 1243 * - left, top, right, bottom: set to final position (where animation ends). 1244 * 1245 * 2. Prepare the popup for animation. Examples include: 1246 * - a. Static positioned animations like fade might set display: "block" & opacity: 0. 1247 * - b. Moving animations such as slide might set display: "block" & opacity: 0 so that 1248 * positioning can be accurately calculated, then set opacity: 1 before the animation begins. 1249 * 1250 * 3. Animate the overlay using `$popup.popmake( 'animate_overlay', type, speed, callback);` 1251 * 1252 * 4. Animate the container. 1253 * - a. Moving animations can use $container.popmake( 'reposition', callback ); The callback 1254 * accepts a position argument for where you should animate to. 1255 * - b. This usually takes place inside the callback for the overlay callback or after it. 1256 */ 1257 $.fn.popmake.animations = { 1258 none: function( callback ) { 1259 var $popup = PUM.getPopup( this ); 1260 1261 // Ensure the container is visible immediately. 1262 $popup 1263 .popmake( 'getContainer' ) 1264 .css( { opacity: 1, display: 'block' } ); 1265 1266 $popup.popmake( 'animate_overlay', 'none', 0, function() { 1267 // Fire user passed callback. 1268 if ( callback !== undefined ) { 1269 callback(); 1270 // TODO Test this new method. Then remove the above. 1271 //callback.apply(this); 1272 } 1273 } ); 1274 return this; 1275 }, 1276 slide: function( callback ) { 1277 var $popup = PUM.getPopup( this ), 1278 $container = $popup.popmake( 'getContainer' ), 1279 settings = $popup.popmake( 'getSettings' ), 1280 start = $popup.popmake( 1281 'animation_origin', 1282 settings.animation_origin 1283 ); 1284 1285 // Step 1. Reset popup styles. 1286 popupCssReset( $popup ); 1287 1288 // Step 2. Position the container offscreen. 1289 $container.position( start ); 1290 1291 // Step 3. Animate the popup. 1292 $popup.popmake( 1293 'animate_overlay', 1294 'fade', 1295 overlayAnimationSpeed( settings ), 1296 function() { 1297 $container.popmake( 'reposition', function( position ) { 1298 $container.animate( 1299 position, 1300 containerAnimationSpeed( settings ), 1301 'swing', 1302 function() { 1303 // Fire user passed callback. 1304 if ( callback !== undefined ) { 1305 callback(); 1306 // TODO Test this new method. Then remove the above. 1307 //allback.apply(this); 1308 } 1309 } 1310 ); 1311 } ); 1312 } 1313 ); 1314 return this; 1315 }, 1316 fade: function( callback ) { 1317 var $popup = PUM.getPopup( this ), 1318 $container = $popup.popmake( 'getContainer' ), 1319 settings = $popup.popmake( 'getSettings' ); 1320 1321 // Step 1. Reset popup styles. 1322 popupCssReset( $popup ); 1323 1324 // Step 2. Hide each element to be faded in. 1325 $popup.css( { opacity: 0, display: 'block' } ); 1326 $container.css( { opacity: 0, display: 'block' } ); 1327 1328 // Step 3. Animate the popup. 1329 $popup.popmake( 1330 'animate_overlay', 1331 'fade', 1332 overlayAnimationSpeed( settings ), 1333 function() { 1334 $container.animate( 1335 { opacity: 1 }, 1336 containerAnimationSpeed( settings ), 1337 'swing', 1338 function() { 1339 // Fire user passed callback. 1340 if ( callback !== undefined ) { 1341 callback(); 1342 // TODO Test this new method. Then remove the above. 1343 //callback.apply(this); 1344 } 1345 } 1346 ); 1347 } 1348 ); 1349 return this; 1350 }, 1351 fadeAndSlide: function( callback ) { 1352 var $popup = PUM.getPopup( this ), 1353 $container = $popup.popmake( 'getContainer' ), 1354 settings = $popup.popmake( 'getSettings' ), 1355 start = $popup.popmake( 1356 'animation_origin', 1357 settings.animation_origin 1358 ); 1359 1360 // Step 1. Reset popup styles. 1361 popupCssReset( $popup ); 1362 1363 // Step 2. Hide each element to be faded in. display: "block" is neccessary for accurate positioning based on popup size. 1364 $popup.css( { display: 'block', opacity: 0 } ); 1365 $container.css( { display: 'block', opacity: 0 } ); 1366 1367 // Step 3. Position the container offscreen. 1368 $container.position( start ); 1369 1370 // Step 4. Animate the popup. 1371 $popup.popmake( 1372 'animate_overlay', 1373 'fade', 1374 overlayAnimationSpeed( settings ), 1375 function() { 1376 $container.popmake( 'reposition', function( position ) { 1377 // Add opacity to the animation properties. 1378 position.opacity = 1; 1379 // Animate the fade & slide. 1380 $container.animate( 1381 position, 1382 containerAnimationSpeed( settings ), 1383 'swing', 1384 function() { 1385 // Fire user passed callback. 1386 if ( callback !== undefined ) { 1387 callback(); 1388 // TODO Test this new method. Then remove the above. 1389 //callback.apply(this); 1390 } 1391 } 1392 ); 1393 } ); 1394 } 1395 ); 1396 return this; 1397 }, 1398 /** 1399 * TODO: Remove these and let import script replace them. 1400 * @deprecated 1401 * @returns {$.fn.popmake.animations} 1402 */ 1403 grow: function( callback ) { 1404 return $.fn.popmake.animations.fade.apply( this, arguments ); 1405 }, 1406 /** 1407 * @deprecated 1408 * @returns {$.fn.popmake.animations} 1409 */ 1410 growAndSlide: function( callback ) { 1411 return $.fn.popmake.animations.fadeAndSlide.apply( 1412 this, 1413 arguments 1414 ); 1415 }, 1416 }; 1417 1418 $.fn.popmake.overlay_animations = { 1419 none: function( duration, callback ) { 1420 PUM.getPopup( this ).css( { opacity: 1, display: 'block' } ); 1421 1422 if ( typeof callback === 'function' ) { 1423 callback(); 1424 } 1425 }, 1426 fade: function( duration, callback ) { 1427 PUM.getPopup( this ) 1428 .css( { opacity: 0, display: 'block' } ) 1429 .animate( { opacity: 1 }, duration, 'swing', callback ); 1430 }, 1431 slide: function( duration, callback ) { 1432 PUM.getPopup( this ).slideDown( duration, callback ); 1433 }, 1434 }; 1435} )( jQuery, document ); 1436 1437/** 1438 * Defines the core $.popmake binds. 1439 * Version 1.4 1440 */ 1441( function( $, document, undefined ) { 1442 'use strict'; 1443 1444 $( document ) 1445 // Backward Compatibility
1446 // TODO: Add check for compatibility mode once available. 1447 .on( 'pumInit', '.pum', function() { 1448 $( this ) 1449 .popmake( 'getContainer' ) 1450 .trigger( 'popmakeInit' ); 1451 } ) 1452 1453 /** 1454 * Fires the deprecated popmakeBeforeOpen event 1455 */ 1456 .on( 'pumBeforeOpen', '.pum', function() { 1457 $( this ) 1458 .popmake( 'getContainer' ) 1459 .addClass( 'active' ) 1460 .trigger( 'popmakeBeforeOpen' ); 1461 } ) 1462 /** 1463 * Fires the deprecated popmakeAfterOpen event 1464 */ 1465 .on( 'pumAfterOpen', '.pum', function() { 1466 $( this ) 1467 .popmake( 'getContainer' ) 1468 .trigger( 'popmakeAfterOpen' ); 1469 } ) 1470 1471 /** 1472 * Fires the deprecated popmakeBeforeClose event 1473 */ 1474 .on( 'pumBeforeClose', '.pum', function() { 1475 $( this ) 1476 .popmake( 'getContainer' ) 1477 .trigger( 'popmakeBeforeClose' ); 1478 } ) 1479 /** 1480 * Fires the deprecated popmakeAfterClose event 1481 */ 1482 .on( 'pumAfterClose', '.pum', function() { 1483 $( this ) 1484 .popmake( 'getContainer' ) 1485 .removeClass( 'active' ) 1486 .trigger( 'popmakeAfterClose' ); 1487 } ) 1488 1489 /** 1490 * Fires the deprecated popmakeSetupClose event 1491 */ 1492 .on( 'pumSetupClose', '.pum', function() { 1493 $( this ) 1494 .popmake( 'getContainer' ) 1495 .trigger( 'popmakeSetupClose' ); 1496 } ) 1497 1498 /** 1499 * Removes the prevent open classes if they exist. 1500 */ 1501 .on( 'pumOpenPrevented', '.pum', function() { 1502 $( this ) 1503 .popmake( 'getContainer' ) 1504 .removeClass( 'preventOpen' ) 1505 .removeClass( 'active' ); 1506 } ) 1507 /** 1508 * Removes the prevent close classes if they exist. 1509 */ 1510 .on( 'pumClosePrevented', '.pum', function() { 1511 $( this ) 1512 .popmake( 'getContainer' ) 1513 .removeClass( 'preventClose' ); 1514 } ) 1515 1516 /** 1517 * Fires the deprecated popmakeBeforeReposition event 1518 */ 1519 .on( 'pumBeforeReposition', '.pum', function() { 1520 $( this ) 1521 .popmake( 'getContainer' ) 1522 .trigger( 'popmakeBeforeReposition' ); 1523 } ); 1524} )( jQuery, document ); 1525 1526/** 1527 * Defines the core $.popmake callbacks. 1528 * Version 1.4 1529 */ 1530( function( $, document, undefined ) { 1531 'use strict'; 1532 1533 $.fn.popmake.callbacks = { 1534 reposition_using: function( position ) { 1535 $( this ).css( position ); 1536 }, 1537 }; 1538} )( jQuery, document ); 1539 1540( function( $, document, undefined ) { 1541 'use strict'; 1542 1543 // Used for Mobile Detect when needed. 1544 var _md, 1545 md = function() { 1546 if ( _md === undefined ) { 1547 _md = 1548 typeof MobileDetect !== 'undefined' 1549 ? new MobileDetect( window.navigator.userAgent ) 1550 : { 1551 phone: function() { 1552 return false; 1553 }, 1554 tablet: function() { 1555 return false; 1556 }, 1557 }; 1558 } 1559 1560 return _md; 1561 }; 1562 1563 $.extend( $.fn.popmake.methods, { 1564 checkConditions: function() { 1565 var $popup = PUM.getPopup( this ), 1566 settings = $popup.popmake( 'getSettings' ), 1567 // Loadable defaults to true if no conditions. Making the popup available everywhere. 1568 loadable = true, 1569 group_check, 1570 g, 1571 c, 1572 group, 1573 condition; 1574 1575 if ( settings.disable_on_mobile ) { 1576 if ( md().phone() ) { 1577 return false; 1578 } 1579 } 1580 1581 if ( settings.disable_on_tablet ) { 1582 if ( md().tablet() ) { 1583 return false; 1584 } 1585 } 1586 1587 if ( settings.conditions.length ) { 1588 // All Groups Must Return True. Break if any is false and set loadable to false. 1589 for ( g = 0; settings.conditions.length > g; g++ ) { 1590 group = settings.conditions[ g ]; 1591 1592 // Groups are false until a condition proves true. 1593 group_check = false; 1594 1595 // At least one group condition must be true. Break this loop if any condition is true. 1596 for ( c = 0; group.length > c; c++ ) { 1597 // Handle preprocessed PHP conditions. 1598 if ( typeof group[ c ] === 'boolean' ) { 1599 if ( !! group[ c ] ) { 1600 1601 group_check = true; 1602 break; 1603 } else { 1604 continue; 1605 } 1606 } 1607 1608 condition = $.extend( 1609 {}, 1610 { 1611 not_operand: false, 1612 }, 1613 group[ c ] 1614 ); 1615 1616 // If any condition passes, set group_check true and break. 1617 if ( 1618 ! condition.not_operand && 1619 $popup.popmake( 'checkCondition', condition ) 1620 ) { 1621 group_check = true; 1622 } else if ( 1623 condition.not_operand && 1624 ! $popup.popmake( 'checkCondition', condition ) 1625 ) { 1626 group_check = true; 1627 } 1628 1629 $( this ).trigger( 'pumCheckingCondition', [ 1630 group_check, 1631 condition, 1632 ] ); 1633 1634 if ( group_check ) { 1635 break; 1636 } 1637 } 1638 1639 // If any group of conditions doesn't pass, popup is not loadable. 1640 if ( ! group_check ) { 1641 loadable = false;
1642 } 1643 } 1644 } 1645 1646 return loadable; 1647 }, 1648 checkCondition: function( condition ) { 1649 var target = condition.target || null, 1650 settings = condition.settings || condition, 1651 check; 1652 1653 if ( ! target ) { 1654 console.warn( 'Condition type not set.' ); 1655 return false; 1656 } 1657 1658 // TODO once all extensions updated and in circulation for v1.7, change the below to pass settings, not condition. 1659 1660 // Method calling logic 1661 if ( $.fn.popmake.conditions[ target ] ) { 1662 return $.fn.popmake.conditions[ target ].apply( this, [ 1663 condition, 1664 ] ); 1665 } 1666 if ( window.console ) { 1667 console.warn( 'Condition ' + target + ' does not exist.' ); 1668 return true; 1669 } 1670 }, 1671 } ); 1672 1673 $.fn.popmake.conditions = $.fn.popmake.conditions || {}; 1674} )( jQuery, document ); 1675 1676/** 1677 * Defines the core $.popmake.cookie functions. 1678 * Version 1.4 1679 * 1680 * Defines the pm_cookie & pm_remove_cookie global functions. 1681 */ 1682var pm_cookie, pm_cookie_json, pm_remove_cookie; 1683( function( $ ) { 1684 'use strict'; 1685 1686 function cookie( converter ) { 1687 if ( converter === undefined ) { 1688 converter = function() {}; 1689 } 1690 1691 function api( key, value, attributes ) { 1692 var result, 1693 expires = new Date(); 1694 if ( typeof document === 'undefined' ) { 1695 return; 1696 } 1697 1698 // Write 1699 if ( arguments.length > 1 ) { 1700 attributes = $.extend( 1701 { 1702 path: pum_vars.home_url, 1703 }, 1704 api.defaults, 1705 attributes 1706 ); 1707 1708 switch ( typeof attributes.expires ) { 1709 case 'number': 1710 expires.setMilliseconds( 1711 expires.getMilliseconds() + 1712 attributes.expires * 864e5 1713 ); 1714 attributes.expires = expires; 1715 break; 1716 case 'string': 1717 expires.setTime( 1718 $.fn.popmake.utilities.strtotime( 1719 '+' + attributes.expires 1720 ) * 1000 1721 ); 1722 attributes.expires = expires; 1723 break; 1724 } 1725 1726 try { 1727 result = JSON.stringify( value ); 1728 if ( /^[\{\[]/.test( result ) ) { 1729 value = result; 1730 } 1731 } catch ( e ) {} 1732 1733 if ( ! converter.write ) { 1734 value = encodeURIComponent( String( value ) ).replace( 1735 /%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, 1736 decodeURIComponent 1737 ); 1738 } else { 1739 value = converter.write( value, key ); 1740 } 1741 1742 key = encodeURIComponent( String( key ) ); 1743 key = key.replace( 1744 /%(23|24|26|2B|5E|60|7C)/g, 1745 decodeURIComponent 1746 ); 1747 key = key.replace( /[\(\)]/g, escape ); 1748 1749 return ( document.cookie = [ 1750 key, 1751 '=', 1752 value, 1753 attributes.expires 1754 ? '; expires=' + attributes.expires.toUTCString() 1755 : '', // use expires attribute, max-age is not supported by IE 1756 attributes.path ? '; path=' + attributes.path : '', 1757 attributes.domain ? '; domain=' + attributes.domain : '', 1758 attributes.secure ? '; secure' : '', 1759 ].join( '' ) ); 1760 } 1761 1762 // Read 1763 1764 if ( ! key ) { 1765 result = {}; 1766 } 1767 1768 // To prevent the for loop in the first place assign an empty array 1769 // in case there are no cookies at all. Also prevents odd result when 1770 // calling "get()" 1771 var cookies = document.cookie ? document.cookie.split( '; ' ) : []; 1772 var rdecode = /(%[0-9A-Z]{2})+/g; 1773 var i = 0; 1774 1775 for ( ; i < cookies.length; i++ ) { 1776 var parts = cookies[ i ].split( '=' ); 1777 var cookie = parts.slice( 1 ).join( '=' ); 1778 1779 if ( cookie.charAt( 0 ) === '"' ) { 1780 cookie = cookie.slice( 1, -1 ); 1781 } 1782 1783 try { 1784 var name = parts[ 0 ].replace( 1785 rdecode, 1786 decodeURIComponent 1787 ); 1788 cookie = converter.read 1789 ? converter.read( cookie, name ) 1790 : converter( cookie, name ) || 1791 cookie.replace( rdecode, decodeURIComponent ); 1792 1793 if ( this.json ) { 1794 try { 1795 cookie = JSON.parse( cookie ); 1796 } catch ( e ) {} 1797 } 1798 1799 if ( key === name ) { 1800 result = cookie; 1801 break; 1802 } 1803 1804 if ( ! key ) { 1805 result[ name ] = cookie; 1806 } 1807 } catch ( e ) {} 1808 } 1809 1810 return result; 1811 } 1812 1813 api.set = api; 1814 api.get = function( key ) { 1815 return api.call( api, key ); 1816 }; 1817 api.getJSON = function() { 1818 return api.apply( 1819 { 1820 json: true, 1821 }, 1822 [].slice.call( arguments ) 1823 ); 1824 }; 1825 api.defaults = { 1826 domain: pum_vars.cookie_domain ? pum_vars.cookie_domain : '', 1827 }; 1828 1829 api.remove = function( key, attributes ) { 1830 // Clears keys with current path. 1831 api( 1832 key, 1833 '', 1834 $.extend( {}, attributes, { 1835 expires: -1, 1836 path: '', 1837 } ) 1838 ); 1839 // Clears sitewide keys. 1840 api( 1841 key, 1842 '', 1843 $.extend( {}, attributes, { 1844 expires: -1, 1845 } ) 1846 ); 1847 }; 1848 1849 /** 1850 * Polyfill for jQuery Cookie argument arrangement. 1851 * 1852 * @param key 1853 * @param value 1854 * @param attributes || expires (deprecated) 1855 * @param path (deprecated) 1856 * @return {*} 1857 */ 1858 api.process = function( key, value, attributes, path ) { 1859 if ( 1860 arguments.length > 3 && 1861 typeof arguments[ 2 ] !== 'object' && 1862 value !== undefined 1863 ) { 1864 return api.apply( api, [ 1865 key, 1866 value, 1867 { 1868 expires: attributes, 1869 path: path, 1870 }, 1871 ] ); 1872 } 1873 return api.apply( api, [].slice.call( arguments, [ 0, 2 ] ) ); 1874 }; 1875 1876 api.withConverter = $.fn.popmake.cookie; 1877 1878 return api; 1879 } 1880 1881 $.extend( $.fn.popmake, {
1882 cookie: cookie(), 1883 } ); 1884 1885 pm_cookie = $.pm_cookie = $.fn.popmake.cookie.process; 1886 pm_cookie_json = $.pm_cookie_json = $.fn.popmake.cookie.getJSON; 1887 pm_remove_cookie = $.pm_remove_cookie = $.fn.popmake.cookie.remove; 1888} )( jQuery ); 1889 1890( function( $, document, undefined ) { 1891 'use strict'; 1892 1893 var setCookie = function( settings ) { 1894 $.pm_cookie( 1895 settings.name, 1896 true, 1897 settings.session ? null : settings.time, 1898 settings.path ? pum_vars.home_url || '/' : null 1899 ); 1900 pum.hooks.doAction( 'popmake.setCookie', settings ); 1901 }; 1902 1903 $.extend( $.fn.popmake.methods, { 1904 addCookie: function( type ) { 1905 // Method calling logic 1906 1907 pum.hooks.doAction( 'popmake.addCookie', arguments ); 1908 1909 if ( $.fn.popmake.cookies[ type ] ) { 1910 return $.fn.popmake.cookies[ type ].apply( 1911 this, 1912 Array.prototype.slice.call( arguments, 1 ) 1913 ); 1914 } 1915 if ( window.console ) { 1916 console.warn( 'Cookie type ' + type + ' does not exist.' ); 1917 } 1918 return this; 1919 }, 1920 setCookie: setCookie, 1921 checkCookies: function( settings ) { 1922 var i, 1923 ret = false;
1924 1925 if ( 1926 settings.cookie_name === undefined || 1927 settings.cookie_name === null || 1928 settings.cookie_name === '' 1929 ) { 1930 return false; 1931 } 1932 1933 switch ( typeof settings.cookie_name ) { 1934 case 'object': 1935 case 'array': 1936 for ( i = 0; settings.cookie_name.length > i; i += 1 ) { 1937 if ( 1938 $.pm_cookie( settings.cookie_name[ i ] ) !== 1939 undefined 1940 ) { 1941 ret = true; 1942 } 1943 } 1944 break; 1945 case 'string': 1946 if ( $.pm_cookie( settings.cookie_name ) !== undefined ) { 1947 ret = true; 1948 } 1949 break; 1950 } 1951 1952 pum.hooks.doAction( 'popmake.checkCookies', settings, ret ); 1953 1954 return ret; 1955 }, 1956 } ); 1957 1958 $.fn.popmake.cookies = $.fn.popmake.cookies || {}; 1959 1960 $.extend( $.fn.popmake.cookies, { 1961 on_popup_open: function( settings ) { 1962 var $popup = PUM.getPopup( this ); 1963 $popup.on( 'pumAfterOpen', function() { 1964 $popup.popmake( 'setCookie', settings ); 1965 } ); 1966 }, 1967 on_popup_close: function( settings ) { 1968 var $popup = PUM.getPopup( this ); 1969 $popup.on( 'pumBeforeClose', function() { 1970 $popup.popmake( 'setCookie', settings ); 1971 } ); 1972 }, 1973 form_submission: function( settings ) { 1974 var $popup = PUM.getPopup( this ); 1975 1976 settings = $.extend( 1977 { 1978 form: '', 1979 formInstanceId: '', 1980 only_in_popup: false, 1981 }, 1982 settings 1983 ); 1984 1985 PUM.hooks.addAction( 'pum.integration.form.success', function( 1986 form, 1987 args 1988 ) { 1989 if ( ! settings.form.length ) { 1990 return; 1991 } 1992 1993 if ( 1994 PUM.integrations.checkFormKeyMatches( 1995 settings.form, 1996 settings.formInstanceId, 1997 args 1998 ) 1999 ) { 2000 if ( 2001 ( settings.only_in_popup && 2002 args.popup.length && 2003 args.popup.is( $popup ) ) || 2004 ! settings.only_in_popup 2005 ) { 2006 $popup.popmake( 'setCookie', settings ); 2007 } 2008 } 2009 } ); 2010 }, 2011 manual: function( settings ) { 2012 var $popup = PUM.getPopup( this ); 2013 $popup.on( 'pumSetCookie', function() { 2014 $popup.popmake( 'setCookie', settings ); 2015 } ); 2016 }, 2017 form_success: function( settings ) { 2018 var $popup = PUM.getPopup( this ); 2019 $popup.on( 'pumFormSuccess', function() { 2020 $popup.popmake( 'setCookie', settings ); 2021 } ); 2022 }, 2023 pum_sub_form_success: function( settings ) { 2024 var $popup = PUM.getPopup( this ); 2025 $popup.find( 'form.pum-sub-form' ).on( 'success', function() { 2026 $popup.popmake( 'setCookie', settings ); 2027 } ); 2028 }, 2029 /** 2030 * @deprecated 1.7.0 2031 * 2032 * @param settings 2033 */ 2034 pum_sub_form_already_subscribed: function( settings ) { 2035 var $popup = PUM.getPopup( this ); 2036 $popup.find( 'form.pum-sub-form' ).on( 'success', function() { 2037 $popup.popmake( 'setCookie', settings ); 2038 } ); 2039 }, 2040 ninja_form_success: function( settings ) { 2041 return $.fn.popmake.cookies.form_success.apply( this, arguments ); 2042 }, 2043 cf7_form_success: function( settings ) { 2044 return $.fn.popmake.cookies.form_success.apply( this, arguments ); 2045 }, 2046 gforms_form_success: function( settings ) { 2047 return $.fn.popmake.cookies.form_success.apply( this, arguments ); 2048 }, 2049 } ); 2050 2051 // Register All Cookies for a Popup 2052 $( document ) 2053 .on( 'pumInit', '.pum', function() { 2054 var $popup = PUM.getPopup( this ), 2055 settings = $popup.popmake( 'getSettings' ), 2056 cookies = settings.cookies || [], 2057 cookie = null, 2058 i; 2059 2060 if ( cookies.length ) { 2061 for ( i = 0; cookies.length > i; i += 1 ) { 2062 cookie = cookies[ i ]; 2063 $popup.popmake( 2064 'addCookie', 2065 cookie.event, 2066 cookie.settings 2067 ); 2068 } 2069 } 2070 } ); 2071 2072 // Initiate when ready. 2073 $( function() { 2074 var $cookies = $( '.pum-cookie' ); 2075 2076 $cookies.each( function() { 2077 var $cookie = $( this ), 2078 index = $cookies.index( $cookie ), 2079 args = $cookie.data( 'cookie-args' ); 2080 2081 // If only-onscreen not set or false, set the cookie immediately. 2082 if ( ! $cookie.data( 'only-onscreen' ) ) { 2083 setCookie( args ); 2084 } else { 2085 // If the element is visible on page load, set the cookie. 2086 if ( $cookie.isInViewport() && $cookie.is( ':visible' ) ) { 2087 setCookie( args ); 2088 } else { 2089 // Add a throttled scroll listener, when its in view, set the cookie. 2090 $( window ).on( 2091 'scroll.pum-cookie-' + index, 2092 $.fn.popmake.utilities.throttle( function( event ) { 2093 if ( 2094 $cookie.isInViewport() && 2095 $cookie.is( ':visible' ) 2096 ) {
2097 setCookie( args ); 2098 2099 $( window ).off( 2100 'scroll.pum-cookie-' + index 2101 ); 2102 } 2103 }, 100 ) 2104 ); 2105 } 2106 } 2107 } ); 2108 } ) 2109} )( jQuery, document ); 2110 2111var pum_debug_mode = false, 2112 pum_debug; 2113(function($, pum_vars) { 2114 pum_vars = window.pum_vars || { 2115 debug_mode: false 2116 }; 2117 2118 pum_debug_mode = pum_vars.debug_mode !== undefined && pum_vars.debug_mode; 2119 2120 // Force Debug Mode when the ?pum_debug query arg is present. 2121 if (!pum_debug_mode && window.location.href.indexOf("pum_debug") !== -1) { 2122 pum_debug_mode = true; 2123 } 2124 2125 if (pum_debug_mode) { 2126 var inited = false, 2127 current_popup_event = false, 2128 vars = window.pum_debug_vars || { 2129 debug_mode_enabled: "Popup Maker: Debug Mode Enabled", 2130 debug_started_at: "Debug started at:", 2131 debug_more_info: 2132 "For more information on how to use this information visit https://docs.wppopupmaker.com/?utm_medium=js-debug-info&utm_campaign=contextual-help&utm_source=browser-console&utm_content=more-info", 2133 global_info: "Global Information", 2134 localized_vars: "Localized variables", 2135 popups_initializing: "Popups Initializing", 2136 popups_initialized: "Popups Initialized", 2137 single_popup_label: "Popup: #", 2138 theme_id: "Theme ID: ", 2139 label_method_call: "Method Call:", 2140 label_method_args: "Method Arguments:", 2141 label_popup_settings: "Settings", 2142 label_triggers: "Triggers", 2143 label_cookies: "Cookies", 2144 label_delay: "Delay:", 2145 label_conditions: "Conditions", 2146 label_cookie: "Cookie:", 2147 label_settings: "Settings:", 2148 label_selector: "Selector:", 2149 label_mobile_disabled: "Mobile Disabled:", 2150 label_tablet_disabled: "Tablet Disabled:", 2151 label_event: "Event: %s", 2152 triggers: [], 2153 cookies: [] 2154 }; 2155 2156 pum_debug = { 2157 odump: function(o) { 2158 return $.extend({}, o); 2159 }, 2160 logo: function() { 2161 console.log( 2162 "" + 2163 " -------------------------------------------------------------" + 2164 "\n" + 2165 "| ____ __ __ _ |" + 2166 "\n" + 2167 "| | _ \\ ___ _ __ _ _ _ __ | \\/ | __ _| | _____ _ __ |" + 2168 "\n" + 2169 "| | |_) / _ \\| '_ \\| | | | '_ \\ | |\\/| |/ _` | |/ / _ \\ '__| |" + 2170 "\n" + 2171 "| | __/ (_) | |_) | |_| | |_) | | | | | (_| | < __/ | |" + 2172 "\n" + 2173 "| |_| \\___/| .__/ \\__,_| .__/ |_| |_|\\__,_|_|\\_\\___|_| |" + 2174 "\n" + 2175 "| |_| |_| |" + 2176 "\n" + 2177 " -------------------------------------------------------------" 2178 ); 2179 }, 2180 initialize: function() { 2181 inited = true; 2182 2183 // Clear Console 2184 //console.clear(); 2185 2186 // Render Logo 2187 pum_debug.logo(); 2188 2189 console.debug(vars.debug_mode_enabled); 2190 console.log(vars.debug_started_at, new Date()); 2191 console.info(vars.debug_more_info); 2192 2193 // Global Info Divider 2194 pum_debug.divider(vars.global_info); 2195 2196 // Localized Variables 2197 console.groupCollapsed(vars.localized_vars); 2198 console.log("pum_vars:", pum_debug.odump(pum_vars)); 2199 $(document).trigger("pum_debug_initialize_localized_vars"); 2200 console.groupEnd(); 2201 2202 // Trigger to add more debug info from extensions. 2203 $(document).trigger("pum_debug_initialize"); 2204 }, 2205 popup_event_header: function($popup) { 2206 var settings = $popup.popmake("getSettings"); 2207 2208 if (current_popup_event === settings.id) { 2209 return; 2210 } 2211 2212 current_popup_event = settings.id; 2213 pum_debug.divider( 2214 vars.single_popup_label + 2215 settings.id + 2216 " - " + 2217 settings.slug 2218 ); 2219 }, 2220 divider: function(heading) { 2221 try { 2222 var totalWidth = 62, 2223 extraSpace = 62, 2224 padding = 0, 2225 line = " " + new Array(totalWidth + 1).join("-") + " ", 2226 fitHeading = heading; 2227 2228 if (typeof heading === "string") { 2229 // Check the heading length to avoid negative padding numbers. 2230 if (heading.length > totalWidth) { 2231 // Truncate the heading if it's longer than the max width. 2232 fitHeading = fitHeading.substring(0, totalWidth); 2233 } 2234 extraSpace = totalWidth - fitHeading.length; 2235 padding = { 2236 left: Math.floor(extraSpace / 2), 2237 right: Math.floor(extraSpace / 2) 2238 }; 2239 2240 if (padding.left + padding.right === extraSpace - 1) { 2241 padding.right++; 2242 } 2243 2244 padding.left = new Array(padding.left + 1).join(" "); 2245 padding.right = new Array(padding.right + 1).join(" "); 2246 2247 console.log( 2248 "" + 2249 line + 2250 "\n" + 2251 "|" + 2252 padding.left + 2253 fitHeading + 2254 padding.right + 2255 "|" + 2256 "\n" + 2257 line 2258 ); 2259 } else { 2260 console.log(line); 2261 } 2262 } catch (err) { 2263 console.error("Got a '" + err + "' when printing out the heading divider to the console."); 2264 } 2265 }, 2266 click_trigger: function($popup, trigger_settings) { 2267 var settings = $popup.popmake("getSettings"), 2268 trigger_selectors = [ 2269 ".popmake-" + settings.id, 2270 ".popmake-" + decodeURIComponent(settings.slug), 2271 'a[href$="#popmake-' + settings.id + '"]' 2272 ], 2273 trigger_selector; 2274 2275 if ( 2276 trigger_settings.extra_selectors && 2277 trigger_settings.extra_selectors !== "" 2278 ) { 2279 trigger_selectors.push(trigger_settings.extra_selectors); 2280 } 2281 2282 trigger_selectors = pum.hooks.applyFilters( 2283 "pum.trigger.click_open.selectors", 2284 trigger_selectors, 2285 trigger_settings, 2286 $popup 2287 ); 2288 2289 trigger_selector = trigger_selectors.join(", "); 2290 2291 console.log(vars.label_selector, trigger_selector); 2292 }, 2293 trigger: function($popup, trigger) { 2294 if (typeof vars.triggers[trigger.type] === "string") { 2295 console.groupCollapsed(vars.triggers[trigger.type]); 2296 2297 switch (trigger.type) { 2298 case "auto_open": 2299 console.log( 2300 vars.label_delay, 2301 trigger.settings.delay 2302 ); 2303 console.log( 2304 vars.label_cookie, 2305 trigger.settings.cookie_name 2306 ); 2307 break; 2308 case "click_open": 2309 pum_debug.click_trigger($popup, trigger.settings); 2310 console.log( 2311 vars.label_cookie, 2312 trigger.settings.cookie_name 2313 ); 2314 break; 2315 } 2316 2317 $(document).trigger( 2318 "pum_debug_render_trigger", 2319 $popup, 2320 trigger 2321 ); 2322 2323 console.groupEnd(); 2324 } 2325 },
2326 cookie: function($popup, cookie) { 2327 if (typeof vars.cookies[cookie.event] === "string") { 2328 console.groupCollapsed(vars.cookies[cookie.event]); 2329 2330 switch (cookie.event) { 2331 case "on_popup_open": 2332 case "on_popup_close": 2333 case "manual": 2334 case "ninja_form_success": 2335 console.log( 2336 vars.label_cookie, 2337 pum_debug.odump(cookie.settings) 2338 ); 2339 break; 2340 } 2341 2342 $(document).trigger( 2343 "pum_debug_render_trigger", 2344 $popup, 2345 cookie 2346 ); 2347 2348 console.groupEnd(); 2349 } 2350 } 2351 }; 2352 2353 $(document) 2354 .on("pumInit", ".pum", function() { 2355 var $popup = PUM.getPopup($(this)), 2356 settings = $popup.popmake("getSettings"), 2357 triggers = settings.triggers || [], 2358 cookies = settings.cookies || [], 2359 conditions = settings.conditions || [], 2360 i = 0; 2361 2362 if (!inited) { 2363 pum_debug.initialize(); 2364 pum_debug.divider(vars.popups_initializing); 2365 } 2366 2367 console.groupCollapsed( 2368 vars.single_popup_label + 2369 settings.id + 2370 " - " + 2371 settings.slug 2372 ); 2373 2374 // Popup Theme ID 2375 console.log(vars.theme_id, settings.theme_id); 2376 2377 // Triggers 2378 if (triggers.length) { 2379 console.groupCollapsed(vars.label_triggers); 2380 for (i = 0; triggers.length > i; i++) { 2381 pum_debug.trigger($popup, triggers[i]); 2382 } 2383 console.groupEnd(); 2384 } 2385 2386 // Cookies 2387 if (cookies.length) { 2388 console.groupCollapsed(vars.label_cookies); 2389 for (i = 0; cookies.length > i; i += 1) { 2390 pum_debug.cookie($popup, cookies[i]); 2391 } 2392 console.groupEnd(); 2393 } 2394 2395 // Conditions 2396 if (conditions.length) { 2397 console.groupCollapsed(vars.label_conditions); 2398 console.log(conditions); 2399 console.groupEnd(); 2400 } 2401 2402 console.groupCollapsed(vars.label_popup_settings); 2403 2404 // Mobile Disabled. 2405 console.log( 2406 vars.label_mobile_disabled, 2407 settings.disable_on_mobile !== false 2408 ); 2409 2410 // Tablet Disabled. 2411 console.log( 2412 vars.label_tablet_disabled, 2413 settings.disable_on_tablet !== false 2414 ); 2415 2416 // Settings. 2417 console.log( 2418 vars.label_display_settings, 2419 pum_debug.odump(settings) 2420 ); 2421 2422 // Trigger to add more debug info from extensions. 2423 $popup.trigger("pum_debug_popup_settings"); 2424 2425 console.groupEnd(); 2426 2427 console.groupEnd(); 2428 }) 2429 .on("pumBeforeOpen", ".pum", function() { 2430 var $popup = PUM.getPopup($(this)), 2431 $last_trigger = $.fn.popmake.last_open_trigger; 2432 2433 pum_debug.popup_event_header($popup); 2434 2435 console.groupCollapsed( 2436 vars.label_event.replace("%s", "pumBeforeOpen") 2437 ); 2438 2439 try { 2440 $last_trigger = $($.fn.popmake.last_open_trigger); 2441 $last_trigger = $last_trigger.length 2442 ? $last_trigger 2443 : $.fn.popmake.last_open_trigger.toString(); 2444 } catch (error) { 2445 $last_trigger = ""; 2446 } finally { 2447 console.log(vars.label_triggers, [$last_trigger]); 2448 } 2449 2450 console.groupEnd(); 2451 }) 2452 .on("pumOpenPrevented", ".pum", function() { 2453 var $popup = PUM.getPopup($(this)); 2454 2455 pum_debug.popup_event_header($popup); 2456 2457 console.groupCollapsed( 2458 vars.label_event.replace("%s", "pumOpenPrevented") 2459 ); 2460 2461 console.groupEnd(); 2462 }) 2463 .on("pumAfterOpen", ".pum", function() { 2464 var $popup = PUM.getPopup($(this)); 2465 2466 pum_debug.popup_event_header($popup); 2467 2468 console.groupCollapsed( 2469 vars.label_event.replace("%s", "pumAfterOpen") 2470 ); 2471 2472 console.groupEnd(); 2473 }) 2474 .on("pumSetupClose", ".pum", function() { 2475 var $popup = PUM.getPopup($(this)); 2476 2477 pum_debug.popup_event_header($popup); 2478 2479 console.groupCollapsed( 2480 vars.label_event.replace("%s", "pumSetupClose") 2481 ); 2482 2483 console.groupEnd(); 2484 }) 2485 .on("pumClosePrevented", ".pum", function() { 2486 var $popup = PUM.getPopup($(this)); 2487 2488 pum_debug.popup_event_header($popup); 2489 2490 console.groupCollapsed( 2491 vars.label_event.replace("%s", "pumClosePrevented") 2492 ); 2493 2494 console.groupEnd(); 2495 }) 2496 .on("pumBeforeClose", ".pum", function() { 2497 var $popup = PUM.getPopup($(this)); 2498 2499 pum_debug.popup_event_header($popup); 2500 2501 console.groupCollapsed( 2502 vars.label_event.replace("%s", "pumBeforeClose") 2503 ); 2504 2505 console.groupEnd(); 2506 }) 2507 .on("pumAfterClose", ".pum", function() { 2508 var $popup = PUM.getPopup($(this)); 2509 2510 pum_debug.popup_event_header($popup); 2511 2512 console.groupCollapsed( 2513 vars.label_event.replace("%s", "pumAfterClose") 2514 ); 2515 2516 console.groupEnd(); 2517 }) 2518 .on("pumBeforeReposition", ".pum", function() { 2519 var $popup = PUM.getPopup($(this)); 2520 2521 pum_debug.popup_event_header($popup); 2522 2523 console.groupCollapsed( 2524 vars.label_event.replace("%s", "pumBeforeReposition") 2525 ); 2526 2527 console.groupEnd(); 2528 }) 2529 .on("pumAfterReposition", ".pum", function() { 2530 var $popup = PUM.getPopup($(this)); 2531 2532 pum_debug.popup_event_header($popup); 2533 2534 console.groupCollapsed( 2535 vars.label_event.replace("%s", "pumAfterReposition") 2536 ); 2537 2538 console.groupEnd(); 2539 }) 2540 .on("pumCheckingCondition", ".pum", function( 2541 event, 2542 result, 2543 condition 2544 ) { 2545 var $popup = PUM.getPopup($(this)); 2546 2547 pum_debug.popup_event_header($popup); 2548 2549 console.groupCollapsed( 2550 vars.label_event.replace("%s", "pumCheckingCondition") 2551 ); 2552 2553 console.log( 2554 (condition.not_operand ? "(!) " : "") + 2555 condition.target + 2556 ": " + 2557 result, 2558 condition 2559 ); 2560 2561 console.groupEnd(); 2562 }); 2563 } 2564})(jQuery); 2565 2566/** 2567 * Defines the core $.popmake defaults. 2568 * Version 1.4 2569 */ 2570(function ($, document, undefined) { 2571 "use strict"; 2572 2573 $.fn.popmake.defaults = { 2574 id: null, 2575 slug: "", 2576 theme_id: null, 2577 cookies: [], 2578 triggers: [], 2579 conditions: [], 2580 mobile_disabled: null, 2581 tablet_disabled: null,
2582 custom_height_auto: false, 2583 scrollable_content: false, 2584 position_from_trigger: false, 2585 position_fixed: false, 2586 overlay_disabled: false, 2587 stackable: false, 2588 disable_reposition: false, 2589 close_on_overlay_click: false, 2590 close_on_form_submission: false, 2591 close_on_form_submission_delay: 0, 2592 close_on_esc_press: false, 2593 close_on_f4_press: false, 2594 disable_on_mobile: false, 2595 disable_on_tablet: false, 2596 size: "medium", 2597 responsive_min_width: "0%", 2598 responsive_max_width: "100%", 2599 custom_width: "640px", 2600 custom_height: "380px", 2601 animation_type: "fade", 2602 animation_speed: "350", 2603 animation_origin: "center top", 2604 location: "center top", 2605 position_top: "100", 2606 position_bottom: "0", 2607 position_left: "0", 2608 position_right: "0", 2609 zindex: "1999999999", 2610 close_button_delay: "0", 2611 // TODO Remove these once extensions have all been updated. 2612 meta: { 2613 display: { 2614 stackable: false, 2615 overlay_disabled: false, 2616 size: "medium", 2617 responsive_max_width: "100", 2618 responsive_max_width_unit: '%', 2619 responsive_min_width: "0", 2620 responsive_min_width_unit: '%', 2621 custom_width: "640", 2622 custom_width_unit: 'px', 2623 custom_height: "380", 2624 custom_height_unit: 'px', 2625 custom_height_auto: false, 2626 location: "center top", 2627 position_top: 100, 2628 position_left: 0, 2629 position_bottom: 0, 2630 position_right: 0, 2631 position_fixed: false, 2632 animation_type: 'fade', 2633 animation_speed: 350, 2634 animation_origin: 'center top', 2635 scrollable_content: false, 2636 disable_reposition: false, 2637 position_from_trigger: false, 2638 overlay_zindex: false, 2639 zindex: "1999999999" 2640 }, 2641 close: { 2642 overlay_click: false, 2643 esc_press: false, 2644 f4_press: false, 2645 text: "", 2646 button_delay: 0 2647 }, 2648 click_open: [] 2649 }, 2650 container: { 2651 active_class: 'active', 2652 attr: { 2653 class: "popmake" 2654 } 2655 }, 2656 title: { 2657 attr: { 2658 class: "popmake-title" 2659 } 2660 }, 2661 content: { 2662 attr: { 2663 class: "popmake-content" 2664 } 2665 }, 2666 close: { 2667 close_speed: 0, 2668 attr: { 2669 class: "popmake-close" 2670 } 2671 }, 2672 overlay: { 2673 attr: { 2674 id: "popmake-overlay", 2675 class: "popmake-overlay" 2676 } 2677 } 2678 }; 2679 2680}(jQuery, document)); 2681 2682/******************************************************************************* 2683 * Copyright (c) 2019, Code Atlantic LLC 2684 ******************************************************************************/ 2685(function ($) { 2686 "use strict"; 2687 2688 var defaults = { 2689 openpopup: false, 2690 openpopup_id: 0, 2691 closepopup: false, 2692 closedelay: 0, 2693 redirect_enabled: false, 2694 redirect: '', 2695 cookie: false 2696 }; 2697 2698 window.PUM = window.PUM || {}; 2699 window.PUM.forms = window.PUM.forms || {}; 2700 2701 $.extend(window.PUM.forms, { 2702 form: { 2703 validation: { 2704 errors: [] 2705 }, 2706 responseHandler: function ($form, response) { 2707 var data = response.data; 2708 2709 if (response.success) { 2710 /** 2711 * If there are no errors process the successful submission. 2712 */ 2713 window.PUM.forms.form.success($form, data); 2714 } else { 2715 /** 2716 * Process any errors 2717 */ 2718 window.PUM.forms.form.errors($form, data); 2719 } 2720 }, 2721 display_errors: function ($form, errors) { 2722 window.PUM.forms.messages.add($form, errors || this.validation.errors, 'error'); 2723 }, 2724 beforeAjax: function ($form) { 2725 var $btn = $form.find('[type="submit"]'), 2726 $loading = $btn.find('.pum-form__loader'); 2727 2728 window.PUM.forms.messages.clear_all($form); 2729 2730 if (!$loading.length) { 2731 $loading = $('<span class="pum-form__loader"></span>'); 2732 if ($btn.attr('value') !== '') { 2733 $loading.insertAfter($btn); 2734 } else { 2735 $btn.append($loading); 2736 } 2737 } 2738 2739 $btn.prop('disabled', true); 2740 $loading.show(); 2741 2742 $form 2743 .addClass('pum-form--loading') 2744 .removeClass('pum-form--errors'); 2745 }, 2746 afterAjax: function ($form) { 2747 var $btn = $form.find('[type="submit"]'), 2748 $loading = $btn.find('.pum-form__loader'); 2749 2750 $btn.prop('disabled', false); 2751 $loading.hide(); 2752 2753 $form.removeClass('pum-form--loading'); 2754 }, 2755 success: function ($form, data) { 2756 if (data.message !== undefined && data.message !== '') { 2757 window.PUM.forms.messages.add($form, [{message: data.message}]); 2758 } 2759 2760 $form.trigger('success', [data]); 2761 2762 if (!$form.data('noredirect') && $form.data('redirect_enabled') !== undefined && data.redirect) { 2763 if (data.redirect !== '') { 2764 window.location = data.redirect; 2765 } else { 2766 window.location.reload(true); 2767 } 2768 } 2769 }, 2770 errors: function ($form, data) { 2771 if (data.errors !== undefined && data.errors.length) { 2772 console.log(data.errors); 2773 2774 window.PUM.forms.form.display_errors($form, data.errors); 2775 2776 window.PUM.forms.messages.scroll_to_first($form); 2777 2778 $form 2779 .addClass('pum-form--errors') 2780 .trigger('errors', [data]); 2781 } 2782 }, 2783 submit: function (event) { 2784 var $form = $(this), 2785 values = $form.pumSerializeObject(); 2786 2787 event.preventDefault(); 2788 event.stopPropagation(); 2789 2790 window.PUM.forms.form.beforeAjax($form); 2791 2792 $.ajax({ 2793 type: 'POST', 2794 dataType: 'json', 2795 url: pum_vars.ajaxurl, 2796 data: { 2797 action: 'pum_form', 2798 values: values 2799 } 2800 }) 2801 .always(function () { 2802 window.PUM.forms.form.afterAjax($form); 2803 }) 2804 .done(function (response) { 2805 window.PUM.forms.form.responseHandler($form, response); 2806 }) 2807 .error(function (jqXHR, textStatus, errorThrown) { 2808 console.log('Error: type of ' + textStatus + ' with message of ' + errorThrown); 2809 }); 2810 } 2811 }, 2812 /** 2813 * Functions to manage form messages. 2814 */ 2815 messages: { 2816 /** 2817 * Process & add messages to a form. 2818 * 2819 * @param $form 2820 * @param messages 2821 * @param type 2822 */ 2823 add: function ($form, messages, type) { 2824 var $messages = $form.find('.pum-form__messages'), 2825 i = 0; 2826 2827 type = type || 'success'; 2828 messages = messages || []; 2829 2830 if (!$messages.length) { 2831 $messages = $('<div class="pum-form__messages">').hide(); 2832 switch (pum_vars.message_position) { 2833 case 'bottom': 2834 $form.append($messages.addClass('pum-form__messages--bottom')); 2835 break; 2836 case 'top': 2837 $form.prepend($messages.addClass('pum-form__messages--top')); 2838 break; 2839 } 2840 } 2841 2842 if (['bottom', 'top'].indexOf(pum_vars.message_position) >= 0) { 2843 for (; messages.length > i; i++) { 2844 this.add_message($messages, messages[i].message, type); 2845 } 2846 } else { 2847 /** 2848 * Per Field Messaging 2849 */ 2850 for (; messages.length > i; i++) { 2851 2852 if (messages[i].field !== undefined) { 2853 this.add_field_error($form, messages[i]); 2854 } else { 2855 this.add_message($messages, messages[i].message, type); 2856 } 2857 } 2858 } 2859 2860 if ($messages.is(':hidden') && $('.pum-form__message', $messages).length) { 2861 $messages.slideDown(); 2862 } 2863 }, 2864 add_message: function ($container, message, type) { 2865 var $message = $('<p class="pum-form__message">').html(message); 2866 2867 type = type || 'success'; 2868 2869 $message.addClass('pum-form__message--' + type); 2870 2871 $container.append($message); 2872 2873 if ($container.is(':visible')) { 2874 $message.hide().slideDown(); 2875 } 2876 }, 2877 add_field_error: function ($form, error) { 2878 var $field = $('[name="' + error.field + '"]', $form), 2879 $wrapper = $field.parents('.pum-form__field').addClass('pum-form__field--error'); 2880 2881 this.add_message($wrapper, error.message, 'error'); 2882 }, 2883 clear_all: function ($form, hide) { 2884 var $messages = $form.find('.pum-form__messages'), 2885 messages = $messages.find('.pum-form__message'), 2886 $errors = $form.find('.pum-form__field.pum-form__field--error'); 2887 2888 hide = hide || false; 2889 2890 // Remove forms main messages container. 2891 if ($messages.length) { 2892 messages.slideUp('fast', function () { 2893 $(this).remove(); 2894 2895 if (hide) { 2896 $messages.hide(); 2897 } 2898 }); 2899 2900 } 2901 2902 // Remove per field messages. 2903 if ($errors.length) { 2904 $errors.removeClass('pum-form__field--error').find('p.pum-form__message').remove(); 2905 } 2906 }, 2907 scroll_to_first: function ($form) { 2908 window.PUM.utilities.scrollTo($('.pum-form__field.pum-form__field--error', $form).eq(0)); 2909 } 2910 }, 2911 /** 2912 * Used to process success actions for forms inside popups. 2913 * 2914 * @param $form 2915 * @param settings 2916 */ 2917 success: function ($form, settings) { 2918 settings = $.extend({}, defaults, settings); 2919 2920 if (!settings) { 2921 return; 2922 } 2923 2924 var $parentPopup = PUM.getPopup($form), 2925 cookie = {}, 2926 redirect = function () { 2927 if (settings.redirect_enabled) { 2928 if (settings.redirect !== '') { 2929 // Redirect to the destination url. 2930 window.location = settings.redirect; 2931 } else { 2932 // Refresh with force true. 2933 window.location.reload(true); 2934 } 2935 } 2936 }, 2937 callback = function () { 2938 if (settings.openpopup && PUM.getPopup(settings.openpopup_id).length) { 2939 PUM.open(settings.openpopup_id); 2940 } else { 2941 redirect(); 2942 } 2943 }; 2944 2945 if ($parentPopup.length) { 2946 $parentPopup.trigger('pumFormSuccess'); 2947 2948 if (settings.cookie) { 2949 cookie = $.extend({ 2950 name: 'pum-' + PUM.getSetting($parentPopup, 'id'), 2951 expires: '+1 year' 2952 }, typeof settings.cookie === 'object' ? settings.cookie : {}); 2953 2954 // Set a cookie
2955 PUM.setCookie($parentPopup, cookie); 2956 } 2957 2958 } 2959 2960 if ($parentPopup.length && settings.closepopup) { 2961 setTimeout(function () { 2962 $parentPopup.popmake('close', callback); 2963 }, parseInt(settings.closedelay) * 1000); 2964 } else { 2965 callback(); 2966 } 2967 } 2968 }); 2969 2970 2971}(jQuery)); 2972(function (window, undefined) { 2973 'use strict'; 2974 2975 /** 2976 * Handles managing all events for whatever you plug it into. Priorities for hooks are based on lowest to highest in 2977 * that, lowest priority hooks are fired first. 2978 */ 2979 var EventManager = function () { 2980 var slice = Array.prototype.slice; 2981 2982 /** 2983 * Maintain a reference to the object scope so our public methods never get confusing. 2984 */ 2985 var MethodsAvailable = { 2986 removeFilter: removeFilter, 2987 applyFilters: applyFilters, 2988 addFilter: addFilter, 2989 removeAction: removeAction, 2990 doAction: doAction, 2991 addAction: addAction 2992 }; 2993 2994 /** 2995 * Contains the hooks that get registered with this EventManager. The array for storage utilizes a "flat" 2996 * object literal such that looking up the hook utilizes the native object literal hash. 2997 */ 2998 var STORAGE = { 2999 actions: {}, 3000 filters: {} 3001 }; 3002 3003 /** 3004 * Adds an action to the event manager. 3005 * 3006 * @param action Must contain namespace.identifier 3007 * @param callback Must be a valid callback function before this action is added 3008 * @param [priority=10] Used to control when the function is executed in relation to other callbacks bound to the same hook 3009 * @param [context] Supply a value to be used for this 3010 */ 3011 function addAction(action, callback, priority, context) { 3012 if (typeof action === 'string' && typeof callback === 'function') { 3013 priority = parseInt((priority || 10), 10); 3014 _addHook('actions', action, callback, priority, context); 3015 } 3016 3017 return MethodsAvailable; 3018 } 3019 3020 /** 3021 * Performs an action if it exists. You can pass as many arguments as you want to this function; the only rule is 3022 * that the first argument must always be the action. 3023 */ 3024 function doAction(/* action, arg1, arg2, ... */) { 3025 var args = slice.call(arguments); 3026 var action = args.shift(); 3027 3028 if (typeof action === 'string') { 3029 _runHook('actions', action, args); 3030 } 3031 3032 return MethodsAvailable; 3033 } 3034 3035 /** 3036 * Removes the specified action if it contains a namespace.identifier & exists. 3037 * 3038 * @param action The action to remove 3039 * @param [callback] Callback function to remove 3040 */ 3041 function removeAction(action, callback) { 3042 if (typeof action === 'string') { 3043 _removeHook('actions', action, callback); 3044 } 3045 3046 return MethodsAvailable; 3047 } 3048 3049 /** 3050 * Adds a filter to the event manager. 3051 * 3052 * @param filter Must contain namespace.identifier 3053 * @param callback Must be a valid callback function before this action is added 3054 * @param [priority=10] Used to control when the function is executed in relation to other callbacks bound to the same hook 3055 * @param [context] Supply a value to be used for this 3056 */ 3057 function addFilter(filter, callback, priority, context) { 3058 if (typeof filter === 'string' && typeof callback === 'function') { 3059 priority = parseInt((priority || 10), 10); 3060 _addHook('filters', filter, callback, priority, context); 3061 } 3062 3063 return MethodsAvailable; 3064 } 3065 3066 /** 3067 * Performs a filter if it exists. You should only ever pass 1 argument to be filtered. The only rule is that 3068 * the first argument must always be the filter. 3069 */ 3070 function applyFilters(/* filter, filtered arg, arg2, ... */) { 3071 var args = slice.call(arguments); 3072 var filter = args.shift(); 3073 3074 if (typeof filter === 'string') { 3075 return _runHook('filters', filter, args); 3076 } 3077 3078 return MethodsAvailable; 3079 } 3080 3081 /** 3082 * Removes the specified filter if it contains a namespace.identifier & exists. 3083 * 3084 * @param filter The action to remove 3085 * @param [callback] Callback function to remove 3086 */ 3087 function removeFilter(filter, callback) { 3088 if (typeof filter === 'string') { 3089 _removeHook('filters', filter, callback); 3090 } 3091 3092 return MethodsAvailable; 3093 } 3094 3095 /** 3096 * Removes the specified hook by resetting the value of it. 3097 * 3098 * @param type Type of hook, either 'actions' or 'filters' 3099 * @param hook The hook (namespace.identifier) to remove 3100 * @private 3101 */ 3102 function _removeHook(type, hook, callback, context) { 3103 var handlers, handler, i; 3104 3105 if (!STORAGE[type][hook]) { 3106 return; 3107 } 3108 if (!callback) { 3109 STORAGE[type][hook] = []; 3110 } else { 3111 handlers = STORAGE[type][hook]; 3112 if (!context) { 3113 for (i = handlers.length; i--;) { 3114 if (handlers[i].callback === callback) { 3115 handlers.splice(i, 1); 3116 } 3117 } 3118 } 3119 else { 3120 for (i = handlers.length; i--;) { 3121 handler = handlers[i]; 3122 if (handler.callback === callback && handler.context === context) { 3123 handlers.splice(i, 1); 3124 } 3125 } 3126 } 3127 } 3128 } 3129 3130 /** 3131 * Adds the hook to the appropriate storage container 3132 * 3133 * @param type 'actions' or 'filters' 3134 * @param hook The hook (namespace.identifier) to add to our event manager 3135 * @param callback The function that will be called when the hook is executed. 3136 * @param priority The priority of this hook. Must be an integer. 3137 * @param [context] A value to be used for this 3138 * @private 3139 */ 3140 function _addHook(type, hook, callback, priority, context) { 3141 var hookObject = { 3142 callback: callback, 3143 priority: priority, 3144 context: context 3145 }; 3146 3147 // Utilize 'prop itself' : http://jsperf.com/hasownproperty-vs-in-vs-undefined/19 3148 var hooks = STORAGE[type][hook]; 3149 if (hooks) { 3150 hooks.push(hookObject); 3151 hooks = _hookInsertSort(hooks); 3152 } 3153 else { 3154 hooks = [hookObject]; 3155 } 3156 3157 STORAGE[type][hook] = hooks; 3158 } 3159 3160 /** 3161 * Use an insert sort for keeping our hooks organized based on priority. This function is ridiculously faster 3162 * than bubble sort, etc: http://jsperf.com/javascript-sort 3163 * 3164 * @param hooks The custom array containing all of the appropriate hooks to perform an insert sort on. 3165 * @private 3166 */ 3167 function _hookInsertSort(hooks) { 3168 var tmpHook, j, prevHook; 3169 for (var i = 1, len = hooks.length; i < len; i++) { 3170 tmpHook = hooks[i]; 3171 j = i; 3172 while ((prevHook = hooks[j - 1]) && prevHook.priority > tmpHook.priority) { 3173 hooks[j] = hooks[j - 1]; 3174 --j; 3175 } 3176 hooks[j] = tmpHook; 3177 } 3178 3179 return hooks; 3180 } 3181 3182 /** 3183 * Runs the specified hook. If it is an action, the value is not modified but if it is a filter, it is. 3184 * 3185 * @param type 'actions' or 'filters' 3186 * @param hook The hook ( namespace.identifier ) to be ran. 3187 * @param args Arguments to pass to the action/filter. If it's a filter, args is actually a single parameter. 3188 * @private 3189 */ 3190 function _runHook(type, hook, args) { 3191 var handlers = STORAGE[type][hook], i, len; 3192 3193 if (!handlers) { 3194 return (type === 'filters') ? args[0] : false;
3195 } 3196 3197 len = handlers.length; 3198 if (type === 'filters') { 3199 for (i = 0; i < len; i++) { 3200 args[0] = handlers[i].callback.apply(handlers[i].context, args); 3201 } 3202 } else { 3203 for (i = 0; i < len; i++) { 3204 handlers[i].callback.apply(handlers[i].context, args); 3205 } 3206 } 3207 3208 return (type === 'filters') ? args[0] : true; 3209 } 3210 3211 // return all of the publicly available methods 3212 return MethodsAvailable; 3213 3214 }; 3215 3216 window.pum = window.pum || {}; 3217 window.pum.hooks = window.pum.hooks || new EventManager(); 3218 window.PUM = window.PUM || {}; 3219 window.PUM.hooks = window.pum.hooks; 3220 3221})(window); 3222 3223/******************************************************************************* 3224 * Copyright (c) 2019, Code Atlantic LLC 3225 ******************************************************************************/ 3226(function ($) { 3227 "use strict"; 3228 3229 window.PUM = window.PUM || {}; 3230 window.PUM.integrations = window.PUM.integrations || {}; 3231 3232 function filterNull(x) { 3233 return x; 3234 } 3235 3236 $.extend(window.PUM.integrations, { 3237 init: function () { 3238 if ("undefined" !== typeof pum_vars.form_submission) { 3239 var submission = pum_vars.form_submission; 3240 3241 // Declare these are not AJAX submissions. 3242 submission.ajax = false; 3243 3244 // Initialize the popup var based on passed popup ID. 3245 submission.popup = submission.popupId > 0 ? PUM.getPopup(submission.popupId) : null; 3246 3247 PUM.integrations.formSubmission(null, submission); 3248 } 3249 }, 3250 /** 3251 * This hook fires after any integrated form is submitted successfully. 3252 * 3253 * It does not matter if the form is in a popup or not. 3254 * 3255 * @since 1.9.0 3256 * 3257 * @param {Object} form JavaScript DOM node or jQuery object for the form submitted 3258 * @param {Object} args { 3259 * @type {string} formProvider Such as gravityforms or ninjaforms 3260 * @type {string|int} formId Usually an integer ID number such as 1 3261 * @type {int} formInstanceId Not all form plugins support this. 3262 * } 3263 */ 3264 formSubmission: function (form, args) { 3265 args = $.extend({ 3266 popup: PUM.getPopup(form), 3267 formProvider: null, 3268 formId: null, 3269 formInstanceId: null, 3270 formKey: null, 3271 ajax: true, // Allows detecting submissions that may have already been counted. 3272 tracked: false 3273 }, args); 3274 3275 // Generate unique formKey identifier. 3276 args.formKey = args.formKey || [args.formProvider, args.formId, args.formInstanceId].filter(filterNull).join('_'); 3277 3278 if (args.popup && args.popup.length) { 3279 args.popupId = PUM.getSetting(args.popup, 'id'); 3280 // Should this be here. It is the only thing not replicated by a new form trigger & cookie. 3281 // $popup.trigger('pumFormSuccess'); 3282 } 3283 3284 /** 3285 * This hook fires after any integrated form is submitted successfully. 3286 * 3287 * It does not matter if the form is in a popup or not. 3288 * 3289 * @since 1.9.0 3290 * 3291 * @param {Object} form JavaScript DOM node or jQuery object for the form submitted 3292 * @param {Object} args { 3293 * @type {string} formProvider Such as gravityforms or ninjaforms 3294 * @type {string|int} formId Usually an integer ID number such as 1 3295 * @type {int} formInstanceId Not all form plugins support this. 3296 * @type {string} formKey Concatenation of provider, ID & Instance ID. 3297 * @type {int} popupId The ID of the popup the form was in. 3298 * @type {Object} popup Usable jQuery object for the popup. 3299 * } 3300 */ 3301 window.PUM.hooks.doAction('pum.integration.form.success', form, args); 3302 }, 3303 checkFormKeyMatches: function (formIdentifier, formInstanceId, submittedFormArgs) { 3304 formInstanceId = '' === formInstanceId ? formInstanceId : false; 3305 // Check if the submitted form matches trigger requirements. 3306 var checks = [ 3307 // Any supported form. 3308 formIdentifier === 'any', 3309 3310 // Checks for PM core sub form submissions. 3311 'pumsubform' === formIdentifier && 'pumsubform' === submittedFormArgs.formProvider, 3312 3313 // Any provider form. ex. `ninjaforms_any` 3314 formIdentifier === submittedFormArgs.formProvider + '_any', 3315 3316 // Specific provider form with or without instance ID. ex. `ninjaforms_1` or `ninjaforms_1_*` 3317 // Only run this test if not checking for a specific instanceId. 3318 !formInstanceId && new RegExp('^' + formIdentifier + '(_[\d]*)?').test(submittedFormArgs.formKey), 3319 3320 // Specific provider form with specific instance ID. ex `ninjaforms_1_1` or `calderaforms_jbakrhwkhg_1` 3321 // Only run this test if we are checking for specific instanceId. 3322 !!formInstanceId && formIdentifier + '_' + formInstanceId === submittedFormArgs.formKey 3323 ], 3324 // If any check is true, set the cookie. 3325 matchFound = -1 !== checks.indexOf(true); 3326 3327 /** 3328 * This filter is applied when checking if a form match was found. 3329 *
3330 * It is used for comparing user selected form identifiers with submitted forms. 3331 * 3332 * @since 1.9.0 3333 * 3334 * @param {boolean} matchFound A boolean determining whether a match was found. 3335 * @param {Object} args { 3336 * @type {string} formIdentifier gravityforms_any or ninjaforms_1 3337 * @type {int} formInstanceId Not all form plugins support this. 3338 * @type {Object} submittedFormArgs{ 3339 * @type {string} formProvider Such as gravityforms or ninjaforms 3340 * @type {string|int} formId Usually an integer ID number such as 1 3341 * @type {int} formInstanceId Not all form plugins support this. 3342 * @type {string} formKey Concatenation of provider, ID & Instance ID. 3343 * @type {int} popupId The ID of the popup the form was in. 3344 * @type {Object} popup Usable jQuery object for the popup. 3345 * } 3346 * } 3347 * 3348 * @returns {boolean} 3349 */ 3350 return window.PUM.hooks.applyFilters('pum.integration.checkFormKeyMatches', matchFound, { 3351 formIdentifier: formIdentifier, 3352 formInstanceId: formInstanceId, 3353 submittedFormArgs: submittedFormArgs 3354 } ); 3355 } 3356 }); 3357 3358 3359}(window.jQuery)); 3360 3361/******************************************************************************* 3362 * Copyright (c) 2019, Code Atlantic LLC 3363 ******************************************************************************/ 3364(function ($) { 3365 'use strict'; 3366 3367 if (pum_vars && pum_vars.core_sub_forms_enabled !== undefined && !pum_vars.core_sub_forms_enabled) { 3368 return; 3369 } 3370 3371 window.PUM = window.PUM || {}; 3372 window.PUM.newsletter = window.PUM.newsletter || {}; 3373 3374 $.extend(window.PUM.newsletter, { 3375 form: $.extend({}, window.PUM.forms.form, { 3376 submit: function (event) { 3377 var $form = $(this), 3378 values = $form.pumSerializeObject(); 3379 3380 event.preventDefault(); 3381 event.stopPropagation(); 3382 3383 window.PUM.newsletter.form.beforeAjax($form); 3384 3385 $.ajax({ 3386 type: 'POST', 3387 dataType: 'json', 3388 url: pum_vars.ajaxurl, 3389 data: { 3390 action: 'pum_sub_form', 3391 values: values 3392 } 3393 }) 3394 .always(function () { 3395 window.PUM.newsletter.form.afterAjax($form); 3396 }) 3397 .done(function (response) { 3398 window.PUM.newsletter.form.responseHandler($form, response); 3399 }) 3400 .error(function (jqXHR, textStatus, errorThrown) { 3401 console.log('Error: type of ' + textStatus + ' with message of ' + errorThrown); 3402 }); 3403 } 3404 3405 }) 3406 }); 3407 3408 $(document) 3409 .on('submit', 'form.pum-sub-form', window.PUM.newsletter.form.submit) 3410 .on('success', 'form.pum-sub-form', function (event, data) { 3411 var $form = $( event.target ), 3412 settings = $form.data( 'settings' ) || {}, 3413 values = $form.pumSerializeObject(), 3414 popup = PUM.getPopup($form), 3415 formId = PUM.getSetting(popup, 'id'), 3416 formInstanceId = $( 'form.pum-sub-form', popup).index( $form ) + 1; 3417 3418 // All the magic happens here. 3419 window.PUM.integrations.formSubmission( $form, { 3420 formProvider: 'pumsubform', 3421 formId: formId, 3422 formInstanceId: formInstanceId, 3423 extras: { 3424 data: data, 3425 values: values, 3426 settings: settings 3427 } 3428 } ); 3429 3430 $form 3431 .trigger('pumNewsletterSuccess', [data]) 3432 .addClass('pum-newsletter-success'); 3433 3434 $form[0].reset(); 3435 3436 window.pum.hooks.doAction('pum-sub-form.success', data, $form); 3437 3438 if (typeof settings.redirect === 'string') { 3439 if (settings.redirect !== '') { 3440 settings.redirect = atob(settings.redirect); 3441 } 3442 } 3443 3444 window.PUM.forms.success($form, settings); 3445 }) 3446 .on('error', 'form.pum-sub-form', function (event, data) { 3447 var $form = $(event.target); 3448 3449 $form.trigger('pumNewsletterError', [data]); 3450 3451 window.pum.hooks.doAction('pum-sub-form.errors', data, $form); 3452 }); 3453 3454}(jQuery)); 3455 3456(function ($, document, undefined) { 3457 "use strict"; 3458 3459 $.extend($.fn.popmake.methods, { 3460 addTrigger: function (type) { 3461 // Method calling logic 3462 if ($.fn.popmake.triggers[type]) { 3463 return $.fn.popmake.triggers[type].apply(this, Array.prototype.slice.call(arguments, 1)); 3464 } 3465 if (window.console) { 3466 console.warn('Trigger type ' + type + ' does not exist.'); 3467 } 3468 return this; 3469 } 3470 }); 3471 3472 $.fn.popmake.triggers = { 3473 auto_open: function (settings) { 3474 var $popup = PUM.getPopup(this); 3475 3476 // Set a delayed open. 3477 setTimeout(function () { 3478 3479 // If the popup is already open return. 3480 if ($popup.popmake('state', 'isOpen')) { 3481 return; 3482 } 3483 3484 // If cookie exists or conditions fail return. 3485 if ($popup.popmake('checkCookies', settings) || !$popup.popmake('checkConditions')) { 3486 return; 3487 } 3488 3489 // Set the global last open trigger to the a text description of the trigger. 3490 $.fn.popmake.last_open_trigger = 'Auto Open - Delay: ' + settings.delay; 3491 3492 // Open the popup. 3493 $popup.popmake('open'); 3494 3495 }, settings.delay); 3496 }, 3497 click_open: function (settings) { 3498 var $popup = PUM.getPopup(this), 3499 popup_settings = $popup.popmake('getSettings'), 3500 trigger_selectors = [ 3501 '.popmake-' + popup_settings.id, 3502 '.popmake-' + decodeURIComponent(popup_settings.slug), 3503 'a[href$="#popmake-' + popup_settings.id + '"]' 3504 ], 3505 trigger_selector; 3506 3507 3508 if (settings.extra_selectors && settings.extra_selectors !== '') { 3509 trigger_selectors.push(settings.extra_selectors); 3510 } 3511 3512 trigger_selectors = pum.hooks.applyFilters('pum.trigger.click_open.selectors', trigger_selectors, settings, $popup); 3513 3514 trigger_selector = trigger_selectors.join(', '); 3515 3516 $(trigger_selector) 3517 .addClass('pum-trigger') 3518 .css({cursor: "pointer"}); 3519 3520 $(document).on('click.pumTrigger', trigger_selector, function (event) { 3521 var $trigger = $(this), 3522 do_default = settings.do_default || false; 3523 3524 // If trigger is inside of the popup that it opens, do nothing. 3525 if ($popup.has($trigger).length > 0) { 3526 return; 3527 } 3528 3529 // If the popup is already open return. 3530 if ($popup.popmake('state', 'isOpen')) { 3531 return; 3532 } 3533 3534 // If cookie exists or conditions fail return. 3535 if ($popup.popmake('checkCookies', settings) || !$popup.popmake('checkConditions')) { 3536 return; 3537 } 3538 3539 if ($trigger.data('do-default')) { 3540 do_default = $trigger.data('do-default'); 3541 } else if ($trigger.hasClass('do-default') || $trigger.hasClass('popmake-do-default') || $trigger.hasClass('pum-do-default')) { 3542 do_default = true; 3543 } 3544 3545 // If trigger has the class do-default we don't prevent default actions. 3546 if (!event.ctrlKey && !pum.hooks.applyFilters('pum.trigger.click_open.do_default', do_default, $popup, $trigger)) { 3547 event.preventDefault(); 3548 event.stopPropagation(); 3549 } 3550 3551 // Set the global last open trigger to the clicked element. 3552 $.fn.popmake.last_open_trigger = $trigger; 3553 3554 // Open the popup. 3555 $popup.popmake('open'); 3556 }); 3557 }, 3558 form_submission: function (settings) { 3559 var $popup = PUM.getPopup(this); 3560 3561 settings = $.extend({ 3562 form: '', 3563 formInstanceId: '', 3564 delay: 0 3565 }, settings); 3566 3567 var onSuccess = function () { 3568 setTimeout(function () { 3569 // If the popup is already open return. 3570 if ($popup.popmake('state', 'isOpen')) { 3571 return; 3572 } 3573 3574 // If cookie exists or conditions fail return. 3575 if ($popup.popmake('checkCookies', settings) || !$popup.popmake('checkConditions')) { 3576 return; 3577 } 3578 3579 // Set the global last open trigger to the a text description of the trigger. 3580 $.fn.popmake.last_open_trigger = 'Form Submission'; 3581 3582 // Open the popup. 3583 $popup.popmake('open'); 3584 }, settings.delay); 3585 }; 3586 3587 // Listen for integrated form submissions. 3588 PUM.hooks.addAction('pum.integration.form.success', function (form, args
3588) { 3589 if (!settings.form.length) { 3590 return; 3591 } 3592 3593 if (PUM.integrations.checkFormKeyMatches(settings.form, settings.formInstanceId, args)) { 3594 onSuccess(); 3595 } 3596 }); 3597 }, 3598 admin_debug: function () { 3599 PUM.getPopup(this).popmake('open'); 3600 } 3601 }; 3602 3603 // Register All Triggers for a Popup 3604 $(document) 3605 .on('pumInit', '.pum', function () { 3606 var $popup = PUM.getPopup(this), 3607 settings = $popup.popmake('getSettings'), 3608 triggers = settings.triggers || [], 3609 trigger = null, 3610 i; 3611 3612 if (triggers.length) { 3613 for (i = 0; triggers.length > i; i += 1) { 3614 trigger = triggers[i]; 3615 $popup.popmake('addTrigger', trigger.type, trigger.settings); 3616 } 3617 } 3618 }); 3619 3620}(jQuery, document)); 3621 3622/** 3623 * Defines the core $.popmake.utilites methods. 3624 * Version 1.4 3625 */ 3626(function ($, document, undefined) { 3627 "use strict"; 3628 3629 var inputTypes = 'color,date,datetime,datetime-local,email,hidden,month,number,password,range,search,tel,text,time,url,week'.split(','), 3630 inputNodes = 'select,textarea'.split(','), 3631 rName = /\[([^\]]*)\]/g; 3632 3633 /** 3634 * Polyfill for IE < 9 3635 */ 3636 if (!Array.prototype.indexOf) { 3637 Array.prototype.indexOf = function (searchElement /*, fromIndex */) { 3638 "use strict"; 3639 3640 if (this === void 0 || this === null) 3641 throw new TypeError(); 3642 3643 var t = Object(this); 3644 var len = t.length >>> 0; 3645 if (len === 0) 3646 return -1; 3647 3648 var n = 0; 3649 if (arguments.length > 0) { 3650 n = Number(arguments[1]); 3651 if (n !== n) // shortcut for verifying if it's NaN 3652 n = 0; 3653 else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) 3654 n = (n > 0 || -1) * Math.floor(Math.abs(n)); 3655 } 3656 3657 if (n >= len) 3658 return -1; 3659 3660 var k = n >= 0 3661 ? n 3662 : Math.max(len - Math.abs(n), 0); 3663 3664 for (; k < len; k++) { 3665 if (k in t && t[k] === searchElement) 3666 return k; 3667 } 3668 return -1; 3669 }; 3670 } 3671 3672 function storeValue(container, parsedName, value) { 3673 3674 var part = parsedName[0]; 3675 3676 if (parsedName.length > 1) { 3677 if (!container[part]) { 3678 // If the next part is eq to '' it means we are processing complex name (i.e. `some[]`) 3679 // for this case we need to use Array instead of an Object for the index increment purpose 3680 container[part] = parsedName[1] ? {} : []; 3681 } 3682 storeValue(container[part], parsedName.slice(1), value); 3683 } else { 3684 3685 // Increment Array index for `some[]` case 3686 if (!part) { 3687 part = container.length; 3688 } 3689 3690 container[part] = value; 3691 } 3692 } 3693 3694 $.fn.popmake.utilities = { 3695 scrollTo: function (target, callback) { 3696 var $target = $(target) || $(); 3697 3698 if (!$target.length) { 3699 return; 3700 } 3701 3702 $('html, body').animate({ 3703 scrollTop: $target.offset().top - 100 3704 }, 1000, 'swing', function () { 3705 // Find the first :input that isn't a button or hidden type. 3706 var $input = $target.find(':input:not([type="button"]):not([type="hidden"]):not(button)').eq(0); 3707 3708 if ($input.hasClass('wp-editor-area')) { 3709 tinyMCE.execCommand('mceFocus', false, $input.attr('id')); 3710 } else { 3711 $input.focus(); 3712 } 3713 3714 if (typeof callback === 'function') { 3715 callback(); 3716 } 3717 }); 3718 }, 3719 /** 3720 * In Array tester function. Similar to PHP's in_array() 3721 3722 * @param needle 3723 * @param array 3724 * @returns {boolean} 3725 */ 3726 inArray: function (needle, array) { 3727 return !!~array.indexOf(needle); 3728 }, 3729 convert_hex: function (hex, opacity) { 3730 hex = hex.replace('#', ''); 3731 var r = parseInt(hex.substring(0, 2), 16), 3732 g = parseInt(hex.substring(2, 4), 16), 3733 b = parseInt(hex.substring(4, 6), 16); 3734 return 'rgba(' + r + ',' + g + ',' + b + ',' + opacity / 100 + ')'; 3735 }, 3736 debounce: function (callback, threshold) { 3737 var timeout; 3738 return function () { 3739 var context = this, params = arguments; 3740 window.clearTimeout(timeout); 3741 timeout = window.setTimeout(function () { 3742 callback.apply(context, params); 3743 }, threshold); 3744 }; 3745 }, 3746 throttle: function (callback, threshold) { 3747 var suppress = false, 3748 clear = function () { 3749 suppress = false;
3750 }; 3751 return function () { 3752 if (!suppress) { 3753 callback.apply(this, arguments); 3754 window.setTimeout(clear, threshold); 3755 suppress = true; 3756 } 3757 }; 3758 }, 3759 getXPath: function (element) { 3760 var path = [], 3761 current, 3762 id, 3763 classes, 3764 tag, 3765 eq; 3766 3767 $.each($(element).parents(), function (index, value) { 3768 current = $(value); 3769 id = current.attr("id") || ''; 3770 classes = current.attr("class") || ''; 3771 tag = current.get(0).tagName.toLowerCase(); 3772 eq = current.parent().children(tag).index(current); 3773 if (tag === 'body') { 3774 return false; 3775 } 3776 if (classes.length > 0) { 3777 classes = classes.split(' '); 3778 classes = classes[0]; 3779 } 3780 path.push(tag + (id.length > 0 ? "#" + id : (classes.length > 0 ? "." + classes.split(' ').join('.') : ':eq(' + eq + ')'))); 3781 }); 3782 return path.reverse().join(' > '); 3783 }, 3784 strtotime: function (text, now) { 3785 // discuss at: http://phpjs.org/functions/strtotime/ 3786 // version: 1109.2016 3787 // original by: Caio Ariede (http://caioariede.com) 3788 // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 3789 // improved by: Caio Ariede (http://caioariede.com) 3790 // improved by: A. Matas Quezada (http://amatiasq.com) 3791 // improved by: preuter 3792 // improved by: Brett Zamir (http://brett-zamir.me) 3793 // improved by: Mirko Faber 3794 // input by: David 3795 // bugfixed by: Wagner B. Soares 3796 // bugfixed by: Artur Tchernychev 3797 // note: Examples all have a fixed timestamp to prevent tests to fail because of variable time(zones) 3798 // example 1: strtotime('+1 day', 1129633200); 3799 // returns 1: 1129719600 3800 // example 2: strtotime('+1 week 2 days 4 hours 2 seconds', 1129633200); 3801 // returns 2: 1130425202 3802 // example 3: strtotime('last month', 1129633200); 3803 // returns 3: 1127041200 3804 // example 4: strtotime('2009-05-04 08:30:00 GMT'); 3805 // returns 4: 1241425800 3806 var parsed, match, today, year, date, days, ranges, len, times, regex, i, fail = false; 3807 if (!text) { 3808 return fail; 3809 } 3810 // Unecessary spaces 3811 text = text.replace(/^\s+|\s+$/g, '') 3812 .replace(/\s{2,}/g, ' ') 3813 .replace(/[\t\r\n]/g, '') 3814 .toLowerCase(); 3815 // in contrast to php, js Date.parse function interprets: 3816 // dates given as yyyy-mm-dd as in timezone: UTC, 3817 // dates with "." or "-" as MDY instead of DMY 3818 // dates with two-digit years differently 3819 // etc...etc... 3820 // ...therefore we manually parse lots of common date formats 3821 match = text.match(/^(\d{1,4})([\-\.\/\:])(\d{1,2})([\-\.\/\:])(\d{1,4})(?:\s(\d{1,2}):(\d{2})?:?(\d{2})?)?(?:\s([A-Z]+)?)?$/); 3822 if (match && match[2] === match[4]) { 3823 if (match[1] > 1901) { 3824 switch (match[2]) { 3825 case '-': 3826 // YYYY-M-D 3827 if (match[3] > 12 || match[5] > 31) { 3828 return fail; 3829 } 3830 return new Date(match[1], parseInt(match[3], 10) - 1, match[5], 3831 match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000; 3832 case '.': 3833 // YYYY.M.D is not parsed by strtotime() 3834 return fail; 3835 case '/': 3836 // YYYY/M/D 3837 if (match[3] > 12 || match[5] > 31) { 3838 return fail; 3839 } 3840 return new Date(match[1], parseInt(match[3], 10) - 1, match[5], 3841 match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000; 3842 } 3843 } else if (match[5] > 1901) { 3844 switch (match[2]) { 3845 case '-': 3846 // D-M-YYYY 3847 if (match[3] > 12 || match[1] > 31) { 3848 return fail; 3849 } 3850 return new Date(match[5], parseInt(match[3], 10) - 1, match[1], 3851 match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000; 3852 case '.': 3853 // D.M.YYYY 3854 if (match[3] > 12 || match[1] > 31) { 3855 return fail; 3856 } 3857 return new Date(match[5], parseInt(match[3], 10) - 1, match[1], 3858 match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000; 3859 case '/': 3860 // M/D/YYYY 3861 if (match[1] > 12 || match[3] > 31) { 3862 return fail; 3863 } 3864 return new Date(match[5], parseInt(match[1], 10) - 1, match[3], 3865 match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000; 3866 } 3867 } else { 3868 switch (match[2]) { 3869 case '-': 3870 // YY-M-D 3871 if (match[3] > 12 || match[5] > 31 || (match[1] < 70 && match[1] > 38)) { 3872 return fail; 3873 } 3874 year = match[1] >= 0 && match[1] <= 38 ? +match[1] + 2000 : match[1]; 3875 return new Date(year, parseInt(match[3], 10) - 1, match[5], 3876 match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000; 3877 case '.': 3878 // D.M.YY or H.MM.SS 3879 if (match[5] >= 70) { // D.M.YY 3880 if (match[3] > 12 || match[1] > 31) { 3881 return fail; 3882 } 3883 return new Date(match[5], parseInt(match[3], 10) - 1, match[1], 3884 match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000; 3885 } 3886 if (match[5] < 60 && !match[6]) { // H.MM.SS 3887 if (match[1] > 23 || match[3] > 59) { 3888 return fail; 3889 } 3890 today = new Date(); 3891 return new Date(today.getFullYear(), today.getMonth(), today.getDate(), 3892 match[1] || 0, match[3] || 0, match[5] || 0, match[9] || 0) / 1000; 3893 } 3894 return fail; // invalid format, cannot be parsed 3895 case '/': 3896 // M/D/YY 3897 if (match[1] > 12 || match[3] > 31 || (match[5] < 70 && match[5] > 38)) { 3898 return fail; 3899 } 3900 year = match[5] >= 0 && match[5] <= 38 ? +match[5] + 2000 : match[5]; 3901 return new Date(year, parseInt(match[1], 10) - 1, match[3], 3902 match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000; 3903 case ':': 3904 // HH:MM:SS 3905 if (match[1] > 23 || match[3] > 59 || match[5] > 59) { 3906 return fail; 3907 } 3908 today = new Date(); 3909 return new Date(today.getFullYear(), today.getMonth(), today.getDate(), 3910 match[1] || 0, match[3] || 0, match[5] || 0) / 1000; 3911 } 3912 } 3913 } 3914 // other formats and "now" should be parsed by Date.parse() 3915 if (text === 'now') { 3916 return now === null || isNaN(now) ? new Date() 3917 .getTime() / 1000 || 0 : now || 0; 3918 } 3919 parsed = Date.parse(text); 3920 if (!isNaN(parsed)) { 3921 return parsed / 1000 || 0; 3922 } 3923 date = now ? new Date(now * 1000) : new Date(); 3924 days = { 3925 'sun': 0, 3926 'mon': 1, 3927 'tue': 2, 3928 'wed': 3, 3929 'thu': 4, 3930 'fri': 5,
3931 'sat': 6 3932 }; 3933 ranges = { 3934 'yea': 'FullYear', 3935 'mon': 'Month', 3936 'day': 'Date', 3937 'hou': 'Hours', 3938 'min': 'Minutes', 3939 'sec': 'Seconds' 3940 }; 3941 3942 function lastNext(type, range, modifier) { 3943 var diff, day = days[range]; 3944 if (day !== undefined) { 3945 diff = day - date.getDay(); 3946 if (diff === 0) { 3947 diff = 7 * modifier; 3948 } else if (diff > 0 && type === 'last') { 3949 diff -= 7; 3950 } else if (diff < 0 && type === 'next') { 3951 diff += 7; 3952 } 3953 date.setDate(date.getDate() + diff); 3954 } 3955 } 3956 3957 function process(val) { 3958 var splt = val.split(' '), 3959 type = splt[0], 3960 range = splt[1].substring(0, 3), 3961 typeIsNumber = /\d+/.test(type), 3962 ago = splt[2] === 'ago', 3963 num = (type === 'last' ? -1 : 1) * (ago ? -1 : 1); 3964 if (typeIsNumber) { 3965 num *= parseInt(type, 10); 3966 } 3967 if (ranges.hasOwnProperty(range) && !splt[1].match(/^mon(day|\.)?$/i)) { 3968 return date['set' + ranges[range]](date['get' + ranges[range]]() + num); 3969 } 3970 if (range === 'wee') { 3971 return date.setDate(date.getDate() + (num * 7)); 3972 } 3973 if (type === 'next' || type === 'last') { 3974 lastNext(type, range, num); 3975 } else if (!typeIsNumber) { 3976 return false; 3977 } 3978 return true; 3979 } 3980 3981 times = '(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec' + 3982 '|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?' + 3983 '|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)'; 3984 regex = '([+-]?\\d+\\s' + times + '|' + '(last|next)\\s' + times + ')(\\sago)?'; 3985 match = text.match(new RegExp(regex, 'gi')); 3986 if (!match) { 3987 return fail; 3988 } 3989 for (i = 0, len = match.length; i < len; i += 1) { 3990 if (!process(match[i])) { 3991 return fail; 3992 } 3993 } 3994 // ECMAScript 5 only 3995 // if (!match.every(process)) 3996 // return false; 3997 return (date.getTime() / 1000); 3998 }, 3999 serializeObject: function (options) { 4000 $.extend({}, options); 4001 4002 var values = {}, 4003 settings = $.extend(true, { 4004 include: [], 4005 exclude: [], 4006 includeByClass: '' 4007 }, options); 4008 4009 this.find(':input').each(function () { 4010 4011 var parsedName; 4012 4013 // Apply simple checks and filters 4014 if (!this.name || this.disabled || 4015 window.PUM.utilities.inArray(this.name, settings.exclude) || 4016 (settings.include.length && !window.PUM.utilities.inArray(this.name, settings.include)) || 4017 this.className.indexOf(settings.includeByClass) === -1) { 4018 return; 4019 } 4020 4021 // Parse complex names 4022 // JS RegExp doesn't support "positive look behind" :( that's why so weird parsing is used 4023 parsedName = this.name.replace(rName, '[$1').split('['); 4024 if (!parsedName[0]) { 4025 return; 4026 } 4027 4028 if (this.checked || 4029 window.PUM.utilities.inArray(this.type, inputTypes) || 4030 window.PUM.utilities.inArray(this.nodeName.toLowerCase(), inputNodes)) { 4031 4032 // Simulate control with a complex name (i.e. `some[]`) 4033 // as it handled in the same way as Checkboxes should
4034 if (this.type === 'checkbox') { 4035 parsedName.push(''); 4036 } 4037 4038 // jQuery.val() is used to simplify of getting values 4039 // from the custom controls (which follow jQuery .val() API) and Multiple Select 4040 storeValue(values, parsedName, $(this).val()); 4041 } 4042 }); 4043 4044 return values; 4045 } 4046 }; 4047 4048 //$.fn.pumSerializeObject = $.fn.popmake.utilities.serializeObject; 4049 4050 // Deprecated fix. utilies was renamed because of typo. 4051 $.fn.popmake.utilies = $.fn.popmake.utilities; 4052 4053 window.PUM = window.PUM || {}; 4054 window.PUM.utilities = window.PUM.utilities || {}; 4055 window.PUM.utilities = $.extend(window.PUM.utilities, $.fn.popmake.utilities); 4056 4057}(jQuery, document)); 4058/******************************************************************************* 4059 * Copyright (c) 2019, Code Atlantic LLC 4060 ******************************************************************************/ 4061(function (root, factory) { 4062 4063 // Browser 4064 factory(root, (root.jQuery || root.Zepto || root.ender || root.$)); 4065 4066}(this, function (exports, $) { 4067 4068 var patterns = { 4069 validate: /^[a-z_][a-z0-9_]*(?:\[(?:\d*|[a-z0-9_]+)\])*$/i, 4070 key: /[a-z0-9_]+|(?=\[\])/gi, 4071 push: /^$/, 4072 fixed: /^\d+$/, 4073 named: /^[a-z0-9_]+$/i 4074 }; 4075 4076 function FormSerializer(helper, $form) { 4077 4078 // private variables 4079 var data = {}, 4080 pushes = {}; 4081 4082 // private API 4083 function build(base, key, value) { 4084 base[key] = value; 4085 return base; 4086 } 4087 4088 function makeObject(root, value) { 4089 4090 var keys = root.match(patterns.key), k; 4091 4092 try { 4093 value = JSON.parse(value); 4094 } catch (Error) { 4095 } 4096 4097 // nest, nest, ..., nest 4098 while ((k = keys.pop()) !== undefined) { 4099 // foo[] 4100 if (patterns.push.test(k)) { 4101 var idx = incrementPush(root.replace(/\[\]$/, '')); 4102 value = build([], idx, value); 4103 } 4104 4105 // foo[n] 4106 else if (patterns.fixed.test(k)) { 4107 value = build([], k, value); 4108 } 4109 4110 // foo; foo[bar] 4111 else if (patterns.named.test(k)) { 4112 value = build({}, k, value); 4113 } 4114 } 4115 4116 return value; 4117 } 4118 4119 function incrementPush(key) { 4120 if (pushes[key] === undefined) { 4121 pushes[key] = 0; 4122 } 4123 return pushes[key]++; 4124 } 4125 4126 function encode(pair) { 4127 switch ($('[name="' + pair.name + '"]', $form).attr("type")) { 4128 case "checkbox": 4129 return pair.value === "1" ? true : pair.value; 4130 default: 4131 return pair.value; 4132 } 4133 } 4134 4135 function addPair(pair) { 4136 if (!patterns.validate.test(pair.name)) return this; 4137 var obj = makeObject(pair.name, encode(pair)); 4138 4139 data = helper.extend(true, data, obj); 4140 return this; 4141 } 4142 4143 function addPairs(pairs) { 4144 if (!helper.isArray(pairs)) { 4145 throw new Error("formSerializer.addPairs expects an Array"); 4146 } 4147 for (var i = 0, len = pairs.length; i < len; i++) { 4148 this.addPair(pairs[i]); 4149 } 4150 return this; 4151 } 4152 4153 function serialize() { 4154 return data; 4155 } 4156 4157 function serializeJSON() { 4158 return JSON.stringify(serialize()); 4159 } 4160 4161 // public API 4162 this.addPair = addPair; 4163 this.addPairs = addPairs; 4164 this.serialize = serialize; 4165 this.serializeJSON = serializeJSON; 4166 } 4167 4168 FormSerializer.patterns = patterns; 4169 4170 FormSerializer.serializeObject = function serializeObject() { 4171 var serialized; 4172 4173 if (this.is('form')) { 4174 serialized = this.serializeArray(); 4175 } else { 4176 serialized = this.find(':input').serializeArray(); 4177 } 4178 4179 return new FormSerializer($, this) 4180 .addPairs(serialized) 4181 .serialize(); 4182 }; 4183 4184 FormSerializer.serializeJSON = function serializeJSON() { 4185 var serialized; 4186 4187 if (this.is('form')) { 4188 serialized = this.serializeArray(); 4189 } else { 4190 serialized = this.find(':input').serializeArray(); 4191 } 4192 4193 return new FormSerializer($, this) 4194 .addPairs(serialized) 4195 .serializeJSON(); 4196 }; 4197 4198 if (typeof $.fn !== "undefined") { 4199 $.fn.pumSerializeObject = FormSerializer.serializeObject; 4200 $.fn.pumSerializeJSON = FormSerializer.serializeJSON; 4201 } 4202 4203 exports.FormSerializer = FormSerializer; 4204 4205 return FormSerializer; 4206})); 4207/******/ (function(modules) { // webpackBootstrap 4208/******/ // The module cache 4209/******/ var installedModules = {}; 4210/******/ 4211/******/ // The require function 4212/******/ function __webpack_require__(moduleId) { 4213/******/ 4214/******/ // Check if module is in cache 4215/******/ if(installedModules[moduleId]) { 4216/******/ return installedModules[moduleId].exports; 4217/******/ } 4218/******/ // Create a new module (and put it into the cache) 4219/******/ var module = installedModules[moduleId] = { 4220/******/ i: moduleId, 4221/******/ l: false, 4222/******/ exports: {} 4223/******/ }; 4224/******/ 4225/******/ // Execute the module function 4226/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 4227/******/ 4228/******/ // Flag the module as loaded
vendor: 2,866 bytes, lines 4229-4294
4229/******/ module.l = true; 4230/******/ 4231/******/ // Return the exports of the module 4232/******/ return module.exports; 4233/******/ } 4234/******/ 4235/******/ 4236/******/ // expose the modules object (__webpack_modules__) 4237/******/ __webpack_require__.m = modules; 4238/******/ 4239/******/ // expose the module cache 4240/******/ __webpack_require__.c = installedModules; 4241/******/ 4242/******/ // define getter function for harmony exports 4243/******/ __webpack_require__.d = function(exports, name, getter) { 4244/******/ if(!__webpack_require__.o(exports, name)) { 4245/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 4246/******/ } 4247/******/ }; 4248/******/ 4249/******/ // define __esModule on exports 4250/******/ __webpack_require__.r = function(exports) { 4251/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 4252/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 4253/******/ } 4254/******/ Object.defineProperty(exports, '__esModule', { value: true }); 4255/******/ }; 4256/******/ 4257/******/ // create a fake namespace object 4258/******/ // mode & 1: value is a module id, require it 4259/******/ // mode & 2: merge all properties of value into the ns 4260/******/ // mode & 4: return value when already ns object 4261/******/ // mode & 8|1: behave like require 4262/******/ __webpack_require__.t = function(value, mode) { 4263/******/ if(mode & 1) value = __webpack_require__(value); 4264/******/ if(mode & 8) return value; 4265/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 4266/******/ var ns = Object.create(null); 4267/******/ __webpack_require__.r(ns); 4268/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 4269/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 4270/******/ return ns; 4271/******/ }; 4272/******/ 4273/******/ // getDefaultExport function for compatibility with non-harmony modules 4274/******/ __webpack_require__.n = function(module) { 4275/******/ var getter = module && module.__esModule ? 4276/******/ function getDefault() { return module['default']; } : 4277/******/ function getModuleExports() { return module; }; 4278/******/ __webpack_require__.d(getter, 'a', getter); 4279/******/ return getter; 4280/******/ }; 4281/******/ 4282/******/ // Object.prototype.hasOwnProperty.call 4283/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 4284/******/ 4285/******/ // __webpack_public_path__ 4286/******/ __webpack_require__.p = ""; 4287/******/ 4288/******/ 4289/******/ // Load entry module and return exports 4290/******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/calderaforms.js"); 4291/******/ }) 4292/************************************************************************/ 4293/******/ ({ 4294
4295/***/ "./assets/js/src/integration/calderaforms.js": 4296/*!***************************************************!*\ 4297 !*** ./assets/js/src/integration/calderaforms.js ***! 4298 \***************************************************/ 4299/*! no exports provided */ 4300/***/ (function(module, __webpack_exports__, __webpack_require__) { 4301 4302"use strict"; 4303__webpack_require__.r(__webpack_exports__); 4304/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"); 4305/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__); 4306 4307 4308/******************************************************************************* 4309 * Copyright (c) 2020, WP Popup Maker 4310 ******************************************************************************/ 4311{ 4312 var formProvider = 'calderaforms'; 4313 var $ = window.jQuery; 4314 var $form; 4315 /** 4316 * This function is run before every CF Ajax call to store the form being submitted. 4317 * 4318 * @param event 4319 * @param obj 4320 */ 4321 4322 var beforeAjax = function beforeAjax(event, obj) { 4323 return $form = obj.$form; 4324 }; 4325 4326 $(document).on('cf.ajax.request', beforeAjax) // After all requests 4327 .on('cf.submission', function (event, obj) { 4328 // Only if status of request is complete|success. 4329 if ('complete' === obj.data.status || 'success' === obj.data.status) { 4330 //get the form that is submiting's ID attribute 4331 var _$form$attr$split = $form.attr('id').split('_'), 4332 _$form$attr$split2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_$form$attr$split, 2), 4333 formId = _$form$attr$split2[0], 4334 _$form$attr$split2$ = _$form$attr$split2[1], 4335 formInstanceId = _$form$attr$split2$ === void 0 ? null : _$form$attr$split2$; // All the magic happens here. 4336 4337 4338 window.PUM.integrations.formSubmission($form, { 4339 formProvider: formProvider, 4340 formId: formId, 4341 formInstanceId: formInstanceId, 4342 extras: { 4343 state: window.cfstate.hasOwnProperty(formId) ? window.cfstate[formId] : null 4344 } 4345 }); 4346 } 4347 }); 4348} 4349 4350/***/ }), 4351
vendor: 593 bytes, lines 4352-4372
4352/***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js": 4353/*!*****************************************************************!*\ 4354 !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***! 4355 \*****************************************************************/ 4356/*! no static exports found */ 4357/***/ (function(module, exports) { 4358 4359function _arrayLikeToArray(arr, len) { 4360 if (len == null || len > arr.length) len = arr.length; 4361 4362 for (var i = 0, arr2 = new Array(len); i < len; i++) { 4363 arr2[i] = arr[i]; 4364 } 4365 4366 return arr2; 4367} 4368 4369module.exports = _arrayLikeToArray; 4370 4371/***/ }), 4372
vendor: 457 bytes, lines 4373-4387
4373/***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js": 4374/*!***************************************************************!*\ 4375 !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***! 4376 \***************************************************************/ 4377/*! no static exports found */ 4378/***/ (function(module, exports) { 4379 4380function _arrayWithHoles(arr) { 4381 if (Array.isArray(arr)) return arr; 4382} 4383 4384module.exports = _arrayWithHoles; 4385 4386/***/ }), 4387
vendor: 980 bytes, lines 4388-4425
4388/***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js": 4389/*!*********************************************************************!*\ 4390 !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***! 4391 \*********************************************************************/ 4392/*! no static exports found */ 4393/***/ (function(module, exports) { 4394 4395function _iterableToArrayLimit(arr, i) { 4396 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; 4397 var _arr = []; 4398 var _n = true; 4399 var _d = false; 4400 var _e = undefined; 4401 4402 try { 4403 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { 4404 _arr.push(_s.value); 4405 4406 if (i && _arr.length === i) break; 4407 } 4408 } catch (err) { 4409 _d = true; 4410 _e = err; 4411 } finally { 4412 try { 4413 if (!_n && _i["return"] != null) _i["return"](); 4414 } finally { 4415 if (_d) throw _e; 4416 } 4417 } 4418 4419 return _arr; 4420} 4421 4422module.exports = _iterableToArrayLimit; 4423 4424/***/ }), 4425
vendor: 586 bytes, lines 4426-4440
4426/***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js": 4427/*!****************************************************************!*\ 4428 !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***! 4429 \****************************************************************/ 4430/*! no static exports found */ 4431/***/ (function(module, exports) { 4432 4433function _nonIterableRest() { 4434 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 4435} 4436 4437module.exports = _nonIterableRest; 4438 4439/***/ }), 4440
vendor: 1,119 bytes, lines 4441-4463
4441/***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js": 4442/*!**************************************************************!*\ 4443 !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***! 4444 \**************************************************************/ 4445/*! no static exports found */ 4446/***/ (function(module, exports, __webpack_require__) { 4447 4448var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles */ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js"); 4449 4450var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit */ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js"); 4451 4452var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"); 4453 4454var nonIterableRest = __webpack_require__(/*! ./nonIterableRest */ "./node_modules/@babel/runtime/helpers/nonIterableRest.js"); 4455 4456function _slicedToArray(arr, i) { 4457 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); 4458} 4459 4460module.exports = _slicedToArray; 4461 4462/***/ }), 4463
vendor: 4,675 bytes, lines 4464-4574
4464/***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js": 4465/*!***************************************************************************!*\ 4466 !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***! 4467 \***************************************************************************/ 4468/*! no static exports found */ 4469/***/ (function(module, exports, __webpack_require__) { 4470 4471var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js"); 4472 4473function _unsupportedIterableToArray(o, minLen) { 4474 if (!o) return; 4475 if (typeof o === "string") return arrayLikeToArray(o, minLen); 4476 var n = Object.prototype.toString.call(o).slice(8, -1); 4477 if (n === "Object" && o.constructor) n = o.constructor.name; 4478 if (n === "Map" || n === "Set") return Array.from(o); 4479 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); 4480} 4481 4482module.exports = _unsupportedIterableToArray; 4483 4484/***/ }) 4485 4486/******/ }); 4487/******/ (function(modules) { // webpackBootstrap 4488/******/ // The module cache 4489/******/ var installedModules = {}; 4490/******/ 4491/******/ // The require function 4492/******/ function __webpack_require__(moduleId) { 4493/******/ 4494/******/ // Check if module is in cache 4495/******/ if(installedModules[moduleId]) { 4496/******/ return installedModules[moduleId].exports; 4497/******/ } 4498/******/ // Create a new module (and put it into the cache) 4499/******/ var module = installedModules[moduleId] = { 4500/******/ i: moduleId, 4501/******/ l: false, 4502/******/ exports: {} 4503/******/ }; 4504/******/ 4505/******/ // Execute the module function 4506/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 4507/******/ 4508/******/ // Flag the module as loaded 4509/******/ module.l = true; 4510/******/ 4511/******/ // Return the exports of the module 4512/******/ return module.exports; 4513/******/ } 4514/******/ 4515/******/ 4516/******/ // expose the modules object (__webpack_modules__) 4517/******/ __webpack_require__.m = modules; 4518/******/ 4519/******/ // expose the module cache 4520/******/ __webpack_require__.c = installedModules; 4521/******/ 4522/******/ // define getter function for harmony exports 4523/******/ __webpack_require__.d = function(exports, name, getter) { 4524/******/ if(!__webpack_require__.o(exports, name)) { 4525/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 4526/******/ } 4527/******/ }; 4528/******/ 4529/******/ // define __esModule on exports 4530/******/ __webpack_require__.r = function(exports) { 4531/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 4532/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 4533/******/ } 4534/******/ Object.defineProperty(exports, '__esModule', { value: true }); 4535/******/ }; 4536/******/ 4537/******/ // create a fake namespace object 4538/******/ // mode & 1: value is a module id, require it 4539/******/ // mode & 2: merge all properties of value into the ns 4540/******/ // mode & 4: return value when already ns object 4541/******/ // mode & 8|1: behave like require 4542/******/ __webpack_require__.t = function(value, mode) { 4543/******/ if(mode & 1) value = __webpack_require__(value); 4544/******/ if(mode & 8) return value; 4545/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 4546/******/ var ns = Object.create(null); 4547/******/ __webpack_require__.r(ns); 4548/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 4549/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 4550/******/ return ns; 4551/******/ }; 4552/******/ 4553/******/ // getDefaultExport function for compatibility with non-harmony modules 4554/******/ __webpack_require__.n = function(module) { 4555/******/ var getter = module && module.__esModule ? 4556/******/ function getDefault() { return module['default']; } : 4557/******/ function getModuleExports() { return module; }; 4558/******/ __webpack_require__.d(getter, 'a', getter); 4559/******/ return getter; 4560/******/ }; 4561/******/ 4562/******/ // Object.prototype.hasOwnProperty.call 4563/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 4564/******/ 4565/******/ // __webpack_public_path__ 4566/******/ __webpack_require__.p = ""; 4567/******/ 4568/******/ 4569/******/ // Load entry module and return exports 4570/******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/contactform7.js"); 4571/******/ }) 4572/************************************************************************/ 4573/******/ ({ 4574
4575/***/ "./assets/js/src/integration/contactform7.js": 4576/*!***************************************************!*\ 4577 !*** ./assets/js/src/integration/contactform7.js ***! 4578 \***************************************************/ 4579/*! no exports provided */ 4580/***/ (function(module, __webpack_exports__, __webpack_require__) { 4581 4582"use strict"; 4583__webpack_require__.r(__webpack_exports__); 4584/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); 4585/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__); 4586 4587 4588/************************************** 4589 * Copyright (c) 2020, Popup Maker 4590 *************************************/ 4591{ 4592 var formProvider = "contactform7"; 4593 var $ = window.jQuery; 4594 $(document).on("wpcf7mailsent", function (event, details) { 4595 var formId = event.detail.contactFormId, 4596 $form = $(event.target), 4597 identifier = event.detail.id || event.detail.unitTag, 4598 // Converts string like wpcf7-f190-p2-o11 and reduces it to simply 11, the last o11 is the instance ID. 4599 // More accurate way of doing it in case things change in the future, this version filters out all but the o param. 4600 // formInstanceId = .split('-').filter((string) => string.indexOf('o') === 0)[0].replace('o',''); 4601 // Simpler version that simply splits and pops the last item in the array. This requires it always be the last. 4602 formInstanceId = identifier.split("-").pop().replace("o", ""); // All the magic happens here. 4603 4604 window.PUM.integrations.formSubmission($form, { 4605 formProvider: formProvider, 4606 formId: formId, 4607 formInstanceId: formInstanceId, 4608 extras: { 4609 details: details 4610 } 4611 }); 4612 /** 4613 * TODO - Move this to a backward compatiblilty file, hook it into the pum.integration.form.success action. 4614 * 4615 * Listen for older popup actions applied directly to the form. 4616 * 4617 * This is here for backward compatibility with form actions prior to v1.9. 4618 */ 4619 4620 var $settings = $form.find("input.wpcf7-pum"), 4621 settings = $settings.length ? JSON.parse($settings.val()) : false; 4622 4623 if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(settings) === "object" && settings.closedelay !== undefined && settings.closedelay.toString().length >= 3) { 4624 settings.closedelay = settings.closedelay / 1000; 4625 } // Nothing should happen if older action settings not applied 4626 // except triggering of pumFormSuccess event for old cookie method. 4627 4628 4629 window.PUM.forms.success($form, settings); 4630 }); 4631} 4632 4633/***/ }), 4634
vendor: 4,451 bytes, lines 4635-4750
4635/***/ "./node_modules/@babel/runtime/helpers/typeof.js": 4636/*!*******************************************************!*\ 4637 !*** ./node_modules/@babel/runtime/helpers/typeof.js ***! 4638 \*******************************************************/ 4639/*! no static exports found */ 4640/***/ (function(module, exports) { 4641 4642function _typeof(obj) { 4643 "@babel/helpers - typeof"; 4644 4645 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 4646 module.exports = _typeof = function _typeof(obj) { 4647 return typeof obj; 4648 }; 4649 } else { 4650 module.exports = _typeof = function _typeof(obj) { 4651 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 4652 }; 4653 } 4654 4655 return _typeof(obj); 4656} 4657 4658module.exports = _typeof; 4659 4660/***/ }) 4661 4662/******/ }); 4663/******/ (function(modules) { // webpackBootstrap 4664/******/ // The module cache 4665/******/ var installedModules = {}; 4666/******/ 4667/******/ // The require function 4668/******/ function __webpack_require__(moduleId) { 4669/******/ 4670/******/ // Check if module is in cache 4671/******/ if(installedModules[moduleId]) { 4672/******/ return installedModules[moduleId].exports; 4673/******/ } 4674/******/ // Create a new module (and put it into the cache) 4675/******/ var module = installedModules[moduleId] = { 4676/******/ i: moduleId, 4677/******/ l: false, 4678/******/ exports: {} 4679/******/ }; 4680/******/ 4681/******/ // Execute the module function 4682/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 4683/******/ 4684/******/ // Flag the module as loaded 4685/******/ module.l = true; 4686/******/ 4687/******/ // Return the exports of the module 4688/******/ return module.exports; 4689/******/ } 4690/******/ 4691/******/ 4692/******/ // expose the modules object (__webpack_modules__) 4693/******/ __webpack_require__.m = modules; 4694/******/ 4695/******/ // expose the module cache 4696/******/ __webpack_require__.c = installedModules; 4697/******/ 4698/******/ // define getter function for harmony exports 4699/******/ __webpack_require__.d = function(exports, name, getter) { 4700/******/ if(!__webpack_require__.o(exports, name)) { 4701/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 4702/******/ } 4703/******/ }; 4704/******/ 4705/******/ // define __esModule on exports 4706/******/ __webpack_require__.r = function(exports) { 4707/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 4708/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 4709/******/ } 4710/******/ Object.defineProperty(exports, '__esModule', { value: true }); 4711/******/ }; 4712/******/ 4713/******/ // create a fake namespace object 4714/******/ // mode & 1: value is a module id, require it 4715/******/ // mode & 2: merge all properties of value into the ns 4716/******/ // mode & 4: return value when already ns object 4717/******/ // mode & 8|1: behave like require 4718/******/ __webpack_require__.t = function(value, mode) { 4719/******/ if(mode & 1) value = __webpack_require__(value); 4720/******/ if(mode & 8) return value; 4721/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 4722/******/ var ns = Object.create(null); 4723/******/ __webpack_require__.r(ns); 4724/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 4725/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 4726/******/ return ns; 4727/******/ }; 4728/******/ 4729/******/ // getDefaultExport function for compatibility with non-harmony modules 4730/******/ __webpack_require__.n = function(module) { 4731/******/ var getter = module && module.__esModule ? 4732/******/ function getDefault() { return module['default']; } : 4733/******/ function getModuleExports() { return module; }; 4734/******/ __webpack_require__.d(getter, 'a', getter); 4735/******/ return getter; 4736/******/ }; 4737/******/ 4738/******/ // Object.prototype.hasOwnProperty.call 4739/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 4740/******/ 4741/******/ // __webpack_public_path__ 4742/******/ __webpack_require__.p = ""; 4743/******/ 4744/******/ 4745/******/ // Load entry module and return exports 4746/******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/formidableforms.js"); 4747/******/ }) 4748/************************************************************************/ 4749/******/ ({ 4750
vendor: 4,608 bytes, lines 4751-4870
4751/***/ "./assets/js/src/integration/formidableforms.js": 4752/*!******************************************************!*\ 4753 !*** ./assets/js/src/integration/formidableforms.js ***! 4754 \******************************************************/ 4755/*! no static exports found */ 4756/***/ (function(module, exports) { 4757 4758/*********************************** 4759 * Copyright (c) 2020, Popup Maker 4760 **********************************/ 4761{ 4762 var formProvider = "formidableforms"; 4763 var $ = window.jQuery; 4764 $(document).on("frmFormComplete", function (event, form, response) { 4765 var $form = $(form); 4766 var formId = $form.find('input[name="form_id"]').val(); 4767 var $popup = PUM.getPopup($form.find('input[name="pum_form_popup_id"]').val()); // All the magic happens here. 4768 4769 window.PUM.integrations.formSubmission($form, { 4770 popup: $popup, 4771 formProvider: formProvider, 4772 formId: formId, 4773 extras: { 4774 response: response 4775 } 4776 }); 4777 }); 4778} 4779 4780/***/ }) 4781 4782/******/ }); 4783/******/ (function(modules) { // webpackBootstrap 4784/******/ // The module cache 4785/******/ var installedModules = {}; 4786/******/ 4787/******/ // The require function 4788/******/ function __webpack_require__(moduleId) { 4789/******/ 4790/******/ // Check if module is in cache 4791/******/ if(installedModules[moduleId]) { 4792/******/ return installedModules[moduleId].exports; 4793/******/ } 4794/******/ // Create a new module (and put it into the cache) 4795/******/ var module = installedModules[moduleId] = { 4796/******/ i: moduleId, 4797/******/ l: false, 4798/******/ exports: {} 4799/******/ }; 4800/******/ 4801/******/ // Execute the module function 4802/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 4803/******/ 4804/******/ // Flag the module as loaded 4805/******/ module.l = true; 4806/******/ 4807/******/ // Return the exports of the module 4808/******/ return module.exports; 4809/******/ } 4810/******/ 4811/******/ 4812/******/ // expose the modules object (__webpack_modules__) 4813/******/ __webpack_require__.m = modules; 4814/******/ 4815/******/ // expose the module cache 4816/******/ __webpack_require__.c = installedModules; 4817/******/ 4818/******/ // define getter function for harmony exports 4819/******/ __webpack_require__.d = function(exports, name, getter) { 4820/******/ if(!__webpack_require__.o(exports, name)) { 4821/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 4822/******/ } 4823/******/ }; 4824/******/ 4825/******/ // define __esModule on exports 4826/******/ __webpack_require__.r = function(exports) { 4827/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 4828/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 4829/******/ } 4830/******/ Object.defineProperty(exports, '__esModule', { value: true }); 4831/******/ }; 4832/******/ 4833/******/ // create a fake namespace object 4834/******/ // mode & 1: value is a module id, require it 4835/******/ // mode & 2: merge all properties of value into the ns 4836/******/ // mode & 4: return value when already ns object 4837/******/ // mode & 8|1: behave like require 4838/******/ __webpack_require__.t = function(value, mode) { 4839/******/ if(mode & 1) value = __webpack_require__(value); 4840/******/ if(mode & 8) return value; 4841/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 4842/******/ var ns = Object.create(null); 4843/******/ __webpack_require__.r(ns); 4844/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 4845/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 4846/******/ return ns; 4847/******/ }; 4848/******/ 4849/******/ // getDefaultExport function for compatibility with non-harmony modules 4850/******/ __webpack_require__.n = function(module) { 4851/******/ var getter = module && module.__esModule ? 4852/******/ function getDefault() { return module['default']; } : 4853/******/ function getModuleExports() { return module; }; 4854/******/ __webpack_require__.d(getter, 'a', getter); 4855/******/ return getter; 4856/******/ }; 4857/******/ 4858/******/ // Object.prototype.hasOwnProperty.call 4859/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 4860/******/ 4861/******/ // __webpack_public_path__ 4862/******/ __webpack_require__.p = ""; 4863/******/ 4864/******/ 4865/******/ // Load entry module and return exports 4866/******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/gravityforms.js"); 4867/******/ }) 4868/************************************************************************/ 4869/******/ ({ 4870
4871/***/ "./assets/js/src/integration/gravityforms.js": 4872/*!***************************************************!*\ 4873 !*** ./assets/js/src/integration/gravityforms.js ***! 4874 \***************************************************/ 4875/*! no exports provided */ 4876/***/ (function(module, __webpack_exports__, __webpack_require__) { 4877 4878"use strict"; 4879__webpack_require__.r(__webpack_exports__); 4880/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); 4881/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__); 4882 4883 4884/*************************************** 4885 * Copyright (c) 2020, Popup Maker 4886 ***************************************/ 4887{ 4888 var formProvider = "gravityforms"; 4889 var $ = window.jQuery; 4890 var gFormSettings = {}; 4891 $(document).on("gform_confirmation_loaded", function (event, formId) { 4892 var $form = $("#gform_confirmation_wrapper_" + formId + ",#gforms_confirmation_message_" + formId)[0]; // All the magic happens here. 4893 4894 window.PUM.integrations.formSubmission($form, { 4895 formProvider: formProvider, 4896 formId: formId 4897 }); 4898 /** 4899 * TODO - Move this to a backward compatiblilty file, hook it into the pum.integration.form.success action. 4900 * 4901 * Listen for older popup actions applied directly to the form. 4902 * 4903 * This is here for backward compatibility with form actions prior to v1.9. 4904 */ 4905 // Nothing should happen if older action settings not applied 4906 // except triggering of pumFormSuccess event for old cookie method. 4907 4908 window.PUM.forms.success($form, gFormSettings[formId] || {}); 4909 }); 4910 /** 4911 * TODO - Move this to a backward compatiblilty file, hook it into the pum.integration.form.success action. 4912 * 4913 * Listen for older popup actions applied directly to the form. 4914 * 4915 * This is here for backward compatibility with form actions prior to v1.9. 4916 */ 4917 4918 $(function () { 4919 $(".gform_wrapper > form").each(function () { 4920 var $form = $(this), 4921 formId = $form.attr("id").replace("gform_", ""), 4922 $settings = $form.find("input.gforms-pum"), 4923 settings = $settings.length ? JSON.parse($settings.val()) : false; 4924 4925 if (!settings || _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(settings) !== "object") { 4926 return; 4927 } 4928 4929 if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(settings) === "object" && settings.closedelay !== undefined && settings.closedelay.toString().length >= 3) { 4930 settings.closedelay = settings.closedelay / 1000; 4931 } 4932 4933 gFormSettings[formId] = settings; 4934 }); 4935 }); 4936} 4937 4938/***/ }), 4939
vendor: 4,441 bytes, lines 4940-5055
4940/***/ "./node_modules/@babel/runtime/helpers/typeof.js": 4941/*!*******************************************************!*\ 4942 !*** ./node_modules/@babel/runtime/helpers/typeof.js ***! 4943 \*******************************************************/ 4944/*! no static exports found */ 4945/***/ (function(module, exports) { 4946 4947function _typeof(obj) { 4948 "@babel/helpers - typeof"; 4949 4950 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 4951 module.exports = _typeof = function _typeof(obj) { 4952 return typeof obj; 4953 }; 4954 } else { 4955 module.exports = _typeof = function _typeof(obj) { 4956 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 4957 }; 4958 } 4959 4960 return _typeof(obj); 4961} 4962 4963module.exports = _typeof; 4964 4965/***/ }) 4966 4967/******/ }); 4968/******/ (function(modules) { // webpackBootstrap 4969/******/ // The module cache 4970/******/ var installedModules = {}; 4971/******/ 4972/******/ // The require function 4973/******/ function __webpack_require__(moduleId) { 4974/******/ 4975/******/ // Check if module is in cache 4976/******/ if(installedModules[moduleId]) { 4977/******/ return installedModules[moduleId].exports; 4978/******/ } 4979/******/ // Create a new module (and put it into the cache) 4980/******/ var module = installedModules[moduleId] = { 4981/******/ i: moduleId, 4982/******/ l: false, 4983/******/ exports: {} 4984/******/ }; 4985/******/ 4986/******/ // Execute the module function 4987/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 4988/******/ 4989/******/ // Flag the module as loaded 4990/******/ module.l = true; 4991/******/ 4992/******/ // Return the exports of the module 4993/******/ return module.exports; 4994/******/ } 4995/******/ 4996/******/ 4997/******/ // expose the modules object (__webpack_modules__) 4998/******/ __webpack_require__.m = modules; 4999/******/ 5000/******/ // expose the module cache 5001/******/ __webpack_require__.c = installedModules; 5002/******/ 5003/******/ // define getter function for harmony exports 5004/******/ __webpack_require__.d = function(exports, name, getter) { 5005/******/ if(!__webpack_require__.o(exports, name)) { 5006/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 5007/******/ } 5008/******/ }; 5009/******/ 5010/******/ // define __esModule on exports 5011/******/ __webpack_require__.r = function(exports) { 5012/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 5013/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 5014/******/ } 5015/******/ Object.defineProperty(exports, '__esModule', { value: true }); 5016/******/ }; 5017/******/ 5018/******/ // create a fake namespace object 5019/******/ // mode & 1: value is a module id, require it 5020/******/ // mode & 2: merge all properties of value into the ns 5021/******/ // mode & 4: return value when already ns object 5022/******/ // mode & 8|1: behave like require 5023/******/ __webpack_require__.t = function(value, mode) { 5024/******/ if(mode & 1) value = __webpack_require__(value); 5025/******/ if(mode & 8) return value; 5026/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 5027/******/ var ns = Object.create(null); 5028/******/ __webpack_require__.r(ns); 5029/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 5030/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 5031/******/ return ns; 5032/******/ }; 5033/******/ 5034/******/ // getDefaultExport function for compatibility with non-harmony modules 5035/******/ __webpack_require__.n = function(module) { 5036/******/ var getter = module && module.__esModule ? 5037/******/ function getDefault() { return module['default']; } : 5038/******/ function getModuleExports() { return module; }; 5039/******/ __webpack_require__.d(getter, 'a', getter); 5040/******/ return getter; 5041/******/ }; 5042/******/ 5043/******/ // Object.prototype.hasOwnProperty.call 5044/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 5045/******/ 5046/******/ // __webpack_public_path__ 5047/******/ __webpack_require__.p = ""; 5048/******/ 5049/******/ 5050/******/ // Load entry module and return exports 5051/******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/mc4wp.js"); 5052/******/ }) 5053/************************************************************************/ 5054/******/ ({ 5055
5056/***/ "./assets/js/src/integration/mc4wp.js": 5057/*!********************************************!*\ 5058 !*** ./assets/js/src/integration/mc4wp.js ***! 5059 \********************************************/ 5060/*! no static exports found */ 5061/***/ (function(module, exports) { 5062 5063/******************************************************************************* 5064 * Copyright (c) 2020, WP Popup Maker 5065 ******************************************************************************/ 5066{ 5067 var formProvider = 'mc4wp'; 5068 var $ = window.jQuery; // Initiate when ready. 5069 5070 $(function () { 5071 if (typeof mc4wp !== 'undefined') { 5072 mc4wp.forms.on('success', function (form, data) { 5073 var $form = $(form.element), 5074 formId = form.id, 5075 formInstanceId = $('.mc4wp-form-' + form.id).index($form) + 1; // All the magic happens here. 5076 5077 window.PUM.integrations.formSubmission($form, { 5078 formProvider: formProvider, 5079 formId: formId, 5080 formInstanceId: formInstanceId, 5081 extras: { 5082 form: form, 5083 data: data 5084 } 5085 }); 5086 }); 5087 } 5088 }); 5089} 5090 5091/***/ }) 5092 5093/******/ }); 5094/******/ (function(modules) { // webpackBootstrap 5095/******/ // The module cache 5096/******/ var installedModules = {}; 5097/******/ 5098/******/ // The require function 5099/******/ function __webpack_require__(moduleId) { 5100/******/ 5101/******/ // Check if module is in cache 5102/******/ if(installedModules[moduleId]) { 5103/******/ return installedModules[moduleId].exports; 5104/******/ } 5105/******/ // Create a new module (and put it into the cache) 5106/******/ var module = installedModules[moduleId] = { 5107/******/ i: moduleId, 5108/******/ l: false, 5109/******/ exports: {} 5110/******/ }; 5111/******/ 5112/******/ // Execute the module function 5113/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 5114/******/ 5115/******/ // Flag the module as loaded 5116/******/ module.l = true; 5117/******/ 5118/******/ // Return the exports of the module 5119/******/ return module.exports; 5120/******/ } 5121/******/ 5122/******/ 5123/******/ // expose the modules object (__webpack_modules__) 5124/******/ __webpack_require__.m = modules; 5125/******/ 5126/******/ // expose the module cache 5127/******/ __webpack_require__.c = installedModules; 5128/******/ 5129/******/ // define getter function for harmony exports 5130/******/ __webpack_require__.d = function(exports, name, getter) { 5131/******/ if(!__webpack_require__.o(exports, name)) { 5132/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 5133/******/ } 5134/******/ }; 5135/******/ 5136/******/ // define __esModule on exports 5137/******/ __webpack_require__.r = function(exports) { 5138/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 5139/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 5140/******/ } 5141/******/ Object.defineProperty(exports, '__esModule', { value: true }); 5142/******/ }; 5143/******/ 5144/******/ // create a fake namespace object 5145/******/ // mode & 1: value is a module id, require it 5146/******/ // mode & 2: merge all properties of value into the ns 5147/******/ // mode & 4: return value when already ns object 5148/******/ // mode & 8|1: behave like require 5149/******/ __webpack_require__.t = function(value, mode) { 5150/******/ if(mode & 1) value = __webpack_require__(value); 5151/******/ if(mode & 8) return value; 5152/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 5153/******/ var ns = Object.create(null); 5154/******/ __webpack_require__.r(ns); 5155/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 5156/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 5157/******/ return ns; 5158/******/ }; 5159/******/ 5160/******/ // getDefaultExport function for compatibility with non-harmony modules 5161/******/ __webpack_require__.n = function(module) { 5162/******/ var getter = module && module.__esModule ? 5163/******/ function getDefault() { return module['default']; } : 5164/******/ function getModuleExports() { return module; }; 5165/******/ __webpack_require__.d(getter, 'a', getter); 5166/******/ return getter; 5167/******/ }; 5168/******/ 5169/******/ // Object.prototype.hasOwnProperty.call 5170/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 5171/******/ 5172/******/ // __webpack_public_path__ 5173/******/ __webpack_require__.p = ""; 5174/******/ 5175/******/ 5176/******/ // Load entry module and return exports 5177/******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/ninjaforms.js"); 5178/******/ }) 5179/************************************************************************/ 5180/******/ ({ 5181
5182/***/ "./assets/js/src/integration/ninjaforms.js": 5183/*!*************************************************!*\ 5184 !*** ./assets/js/src/integration/ninjaforms.js ***! 5185 \*************************************************/ 5186/*! no exports provided */ 5187/***/ (function(module, __webpack_exports__, __webpack_require__) { 5188 5189"use strict"; 5190__webpack_require__.r(__webpack_exports__); 5191/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"); 5192/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__); 5193 5194 5195/******************************************************************************* 5196 * Copyright (c) 2020, WP Popup Maker 5197 ******************************************************************************/ 5198{ 5199 var formProvider = 'ninjaforms'; 5200 var $ = window.jQuery; 5201 var pumNFController = false; 5202 5203 var initialize_nf_support = function initialize_nf_support() { 5204 /** Ninja Forms Support */ 5205 if (typeof Marionette !== 'undefined' && typeof nfRadio !== 'undefined' && false === pumNFController) { 5206 pumNFController = Marionette.Object.extend({ 5207 initialize: function initialize() { 5208 this.listenTo(nfRadio.channel('forms'), 'submit:response', this.popupMaker); 5209 }, 5210 popupMaker: function popupMaker(response, textStatus, jqXHR, formIdentifier) { 5211 var $form = $('#nf-form-' + formIdentifier + '-cont'), 5212 _formIdentifier$split = formIdentifier.split('_'), 5213 _formIdentifier$split2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_formIdentifier$split, 2), 5214 formId = _formIdentifier$split2[0], 5215 _formIdentifier$split3 = _formIdentifier$split2[1], 5216 formInstanceId = _formIdentifier$split3 === void 0 ? null : _formIdentifier$split3, 5217 settings = {}; // Bail if submission failed. 5218 5219 5220 if (response.errors && response.errors.length) { 5221 return; 5222 } // All the magic happens here. 5223 5224 5225 window.PUM.integrations.formSubmission($form, { 5226 formProvider: formProvider, 5227 formId: formId, 5228 formInstanceId: formInstanceId, 5229 extras: { 5230 response: response 5231 } 5232 }); 5233 /** 5234 * TODO - Move this to a backward compatiblilty file, hook it into the pum.integration.form.success action. 5235 * 5236 * Listen for older popup actions applied directly to the form. 5237 * 5238 * This is here for backward compatibility with form actions prior to v1.9. 5239 */ 5240 5241 if (response.data && response.data.actions) { 5242 settings.openpopup = 'undefined' !== typeof response.data.actions.openpopup; 5243 settings.openpopup_id = settings.openpopup ? parseInt(response.data.actions.openpopup) : 0; 5244 settings.closepopup = 'undefined' !== typeof response.data.actions.closepopup; 5245 settings.closedelay = settings.closepopup ? parseInt(response.data.actions.closepopup) : 0; 5246 5247 if (settings.closepopup && response.data.actions.closedelay) { 5248 settings.closedelay = parseInt(response.data.actions.closedelay); 5249 } 5250 } // Nothing should happen if older action settings not applied 5251 // except triggering of pumFormSuccess event for old cookie method. 5252 5253 5254 window.PUM.forms.success($form, settings); 5255 } 5256 }); // Initialize it. 5257 5258 new pumNFController(); 5259 } 5260 }; // Initiate when ready. 5261 5262 5263 $(initialize_nf_support); 5264} 5265 5266/***/ }), 5267
vendor: 593 bytes, lines 5268-5288
5268/***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js": 5269/*!*****************************************************************!*\ 5270 !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***! 5271 \*****************************************************************/ 5272/*! no static exports found */ 5273/***/ (function(module, exports) { 5274 5275function _arrayLikeToArray(arr, len) { 5276 if (len == null || len > arr.length) len = arr.length; 5277 5278 for (var i = 0, arr2 = new Array(len); i < len; i++) { 5279 arr2[i] = arr[i]; 5280 } 5281 5282 return arr2; 5283} 5284 5285module.exports = _arrayLikeToArray; 5286 5287/***/ }), 5288
vendor: 457 bytes, lines 5289-5303
5289/***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js": 5290/*!***************************************************************!*\ 5291 !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***! 5292 \***************************************************************/ 5293/*! no static exports found */ 5294/***/ (function(module, exports) { 5295 5296function _arrayWithHoles(arr) { 5297 if (Array.isArray(arr)) return arr; 5298} 5299 5300module.exports = _arrayWithHoles; 5301 5302/***/ }), 5303
vendor: 980 bytes, lines 5304-5341
5304/***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js": 5305/*!*********************************************************************!*\ 5306 !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***! 5307 \*********************************************************************/ 5308/*! no static exports found */ 5309/***/ (function(module, exports) { 5310 5311function _iterableToArrayLimit(arr, i) { 5312 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; 5313 var _arr = []; 5314 var _n = true; 5315 var _d = false; 5316 var _e = undefined; 5317 5318 try { 5319 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { 5320 _arr.push(_s.value); 5321 5322 if (i && _arr.length === i) break; 5323 } 5324 } catch (err) { 5325 _d = true; 5326 _e = err; 5327 } finally { 5328 try { 5329 if (!_n && _i["return"] != null) _i["return"](); 5330 } finally { 5331 if (_d) throw _e; 5332 } 5333 } 5334 5335 return _arr; 5336} 5337 5338module.exports = _iterableToArrayLimit; 5339 5340/***/ }), 5341
vendor: 586 bytes, lines 5342-5356
5342/***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js": 5343/*!****************************************************************!*\ 5344 !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***! 5345 \****************************************************************/ 5346/*! no static exports found */ 5347/***/ (function(module, exports) { 5348 5349function _nonIterableRest() { 5350 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 5351} 5352 5353module.exports = _nonIterableRest; 5354 5355/***/ }), 5356
vendor: 1,119 bytes, lines 5357-5379
5357/***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js": 5358/*!**************************************************************!*\ 5359 !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***! 5360 \**************************************************************/ 5361/*! no static exports found */ 5362/***/ (function(module, exports, __webpack_require__) { 5363 5364var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles */ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js"); 5365 5366var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit */ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js"); 5367 5368var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"); 5369 5370var nonIterableRest = __webpack_require__(/*! ./nonIterableRest */ "./node_modules/@babel/runtime/helpers/nonIterableRest.js"); 5371 5372function _slicedToArray(arr, i) { 5373 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); 5374} 5375 5376module.exports = _slicedToArray; 5377 5378/***/ }), 5379
vendor: 4,670 bytes, lines 5380-5490
5380/***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js": 5381/*!***************************************************************************!*\ 5382 !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***! 5383 \***************************************************************************/ 5384/*! no static exports found */ 5385/***/ (function(module, exports, __webpack_require__) { 5386 5387var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js"); 5388 5389function _unsupportedIterableToArray(o, minLen) { 5390 if (!o) return; 5391 if (typeof o === "string") return arrayLikeToArray(o, minLen); 5392 var n = Object.prototype.toString.call(o).slice(8, -1); 5393 if (n === "Object" && o.constructor) n = o.constructor.name; 5394 if (n === "Map" || n === "Set") return Array.from(o); 5395 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); 5396} 5397 5398module.exports = _unsupportedIterableToArray; 5399 5400/***/ }) 5401 5402/******/ }); 5403/******/ (function(modules) { // webpackBootstrap 5404/******/ // The module cache 5405/******/ var installedModules = {}; 5406/******/ 5407/******/ // The require function 5408/******/ function __webpack_require__(moduleId) { 5409/******/ 5410/******/ // Check if module is in cache 5411/******/ if(installedModules[moduleId]) { 5412/******/ return installedModules[moduleId].exports; 5413/******/ } 5414/******/ // Create a new module (and put it into the cache) 5415/******/ var module = installedModules[moduleId] = { 5416/******/ i: moduleId, 5417/******/ l: false, 5418/******/ exports: {} 5419/******/ }; 5420/******/ 5421/******/ // Execute the module function 5422/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 5423/******/ 5424/******/ // Flag the module as loaded 5425/******/ module.l = true; 5426/******/ 5427/******/ // Return the exports of the module 5428/******/ return module.exports; 5429/******/ } 5430/******/ 5431/******/ 5432/******/ // expose the modules object (__webpack_modules__) 5433/******/ __webpack_require__.m = modules; 5434/******/ 5435/******/ // expose the module cache 5436/******/ __webpack_require__.c = installedModules; 5437/******/ 5438/******/ // define getter function for harmony exports 5439/******/ __webpack_require__.d = function(exports, name, getter) { 5440/******/ if(!__webpack_require__.o(exports, name)) { 5441/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 5442/******/ } 5443/******/ }; 5444/******/ 5445/******/ // define __esModule on exports 5446/******/ __webpack_require__.r = function(exports) { 5447/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 5448/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 5449/******/ } 5450/******/ Object.defineProperty(exports, '__esModule', { value: true }); 5451/******/ }; 5452/******/ 5453/******/ // create a fake namespace object 5454/******/ // mode & 1: value is a module id, require it 5455/******/ // mode & 2: merge all properties of value into the ns 5456/******/ // mode & 4: return value when already ns object 5457/******/ // mode & 8|1: behave like require 5458/******/ __webpack_require__.t = function(value, mode) { 5459/******/ if(mode & 1) value = __webpack_require__(value); 5460/******/ if(mode & 8) return value; 5461/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 5462/******/ var ns = Object.create(null); 5463/******/ __webpack_require__.r(ns); 5464/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 5465/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 5466/******/ return ns; 5467/******/ }; 5468/******/ 5469/******/ // getDefaultExport function for compatibility with non-harmony modules 5470/******/ __webpack_require__.n = function(module) { 5471/******/ var getter = module && module.__esModule ? 5472/******/ function getDefault() { return module['default']; } : 5473/******/ function getModuleExports() { return module; }; 5474/******/ __webpack_require__.d(getter, 'a', getter); 5475/******/ return getter; 5476/******/ }; 5477/******/ 5478/******/ // Object.prototype.hasOwnProperty.call 5479/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 5480/******/ 5481/******/ // __webpack_public_path__ 5482/******/ __webpack_require__.p = ""; 5483/******/ 5484/******/ 5485/******/ // Load entry module and return exports 5486/******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/wpforms.js"); 5487/******/ }) 5488/************************************************************************/ 5489/******/ ({ 5490
5491/***/ "./assets/js/src/integration/wpforms.js": 5492/*!**********************************************!*\ 5493 !*** ./assets/js/src/integration/wpforms.js ***! 5494 \**********************************************/ 5495/*! no static exports found */ 5496/***/ (function(module, exports) { 5497 5498/******************************************************************************* 5499 * Copyright (c) 2020, WP Popup Maker 5500 ******************************************************************************/ 5501{ 5502 var formProvider = 'wpforms'; 5503 var $ = window.jQuery; 5504 $(document).on('wpformsAjaxSubmitSuccess', '.wpforms-ajax-form', function (event, details) { 5505 var $form = $(this), 5506 formId = $form.data('formid'), 5507 formInstanceId = $('form#' + $form.attr('id')).index($form) + 1; // All the magic happens here. 5508 5509 window.PUM.integrations.formSubmission($form, { 5510 formProvider: formProvider, 5511 formId: formId, 5512 formInstanceId: formInstanceId 5513 }); 5514 }); 5515} 5516 5517/***/ })
vendor: 4,896 bytes, lines 5517-5721
5517 5518 5519/******/ }); 5520(function (global, factory) { 5521 typeof exports === 'object' && typeof module !== 'undefined' ? factory() : 5522 typeof define === 'function' && define.amd ? define(factory) : 5523 (factory()); 5524}(this, (function () { 'use strict'; 5525 5526/** 5527 * @this {Promise} 5528 */ 5529function finallyConstructor(callback) { 5530 var constructor = this.constructor; 5531 return this.then( 5532 function(value) { 5533 // @ts-ignore 5534 return constructor.resolve(callback()).then(function() { 5535 return value; 5536 }); 5537 }, 5538 function(reason) { 5539 // @ts-ignore 5540 return constructor.resolve(callback()).then(function() { 5541 // @ts-ignore 5542 return constructor.reject(reason); 5543 }); 5544 } 5545 ); 5546} 5547 5548// Store setTimeout reference so promise-polyfill will be unaffected by 5549// other code modifying setTimeout (like sinon.useFakeTimers()) 5550var setTimeoutFunc = setTimeout; 5551 5552function isArray(x) { 5553 return Boolean(x && typeof x.length !== 'undefined'); 5554} 5555 5556function noop() {} 5557 5558// Polyfill for Function.prototype.bind 5559function bind(fn, thisArg) { 5560 return function() { 5561 fn.apply(thisArg, arguments); 5562 }; 5563} 5564 5565/** 5566 * @constructor 5567 * @param {Function} fn 5568 */ 5569function Promise(fn) { 5570 if (!(this instanceof Promise)) 5571 throw new TypeError('Promises must be constructed via new'); 5572 if (typeof fn !== 'function') throw new TypeError('not a function'); 5573 /** @type {!number} */ 5574 this._state = 0; 5575 /** @type {!boolean} */ 5576 this._handled = false; 5577 /** @type {Promise|undefined} */ 5578 this._value = undefined; 5579 /** @type {!Array<!Function>} */ 5580 this._deferreds = []; 5581 5582 doResolve(fn, this); 5583} 5584 5585function handle(self, deferred) { 5586 while (self._state === 3) { 5587 self = self._value; 5588 } 5589 if (self._state === 0) { 5590 self._deferreds.push(deferred); 5591 return; 5592 } 5593 self._handled = true; 5594 Promise._immediateFn(function() { 5595 var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; 5596 if (cb === null) { 5597 (self._state === 1 ? resolve : reject)(deferred.promise, self._value); 5598 return; 5599 } 5600 var ret; 5601 try { 5602 ret = cb(self._value); 5603 } catch (e) { 5604 reject(deferred.promise, e); 5605 return; 5606 } 5607 resolve(deferred.promise, ret); 5608 }); 5609} 5610 5611function resolve(self, newValue) { 5612 try { 5613 // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure 5614 if (newValue === self) 5615 throw new TypeError('A promise cannot be resolved with itself.'); 5616 if ( 5617 newValue && 5618 (typeof newValue === 'object' || typeof newValue === 'function') 5619 ) { 5620 var then = newValue.then; 5621 if (newValue instanceof Promise) { 5622 self._state = 3; 5623 self._value = newValue; 5624 finale(self); 5625 return; 5626 } else if (typeof then === 'function') { 5627 doResolve(bind(then, newValue), self); 5628 return; 5629 } 5630 } 5631 self._state = 1; 5632 self._value = newValue; 5633 finale(self); 5634 } catch (e) { 5635 reject(self, e); 5636 } 5637} 5638 5639function reject(self, newValue) { 5640 self._state = 2; 5641 self._value = newValue; 5642 finale(self); 5643} 5644 5645function finale(self) { 5646 if (self._state === 2 && self._deferreds.length === 0) { 5647 Promise._immediateFn(function() { 5648 if (!self._handled) { 5649 Promise._unhandledRejectionFn(self._value); 5650 } 5651 }); 5652 } 5653 5654 for (var i = 0, len = self._deferreds.length; i < len; i++) { 5655 handle(self, self._deferreds[i]); 5656 } 5657 self._deferreds = null; 5658} 5659 5660/** 5661 * @constructor 5662 */ 5663function Handler(onFulfilled, onRejected, promise) { 5664 this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; 5665 this.onRejected = typeof onRejected === 'function' ? onRejected : null; 5666 this.promise = promise; 5667} 5668 5669/** 5670 * Take a potentially misbehaving resolver function and make sure 5671 * onFulfilled and onRejected are only called once. 5672 * 5673 * Makes no guarantees about asynchrony. 5674 */ 5675function doResolve(fn, self) { 5676 var done = false; 5677 try { 5678 fn( 5679 function(value) { 5680 if (done) return; 5681 done = true; 5682 resolve(self, value); 5683 }, 5684 function(reason) { 5685 if (done) return; 5686 done = true; 5687 reject(self, reason); 5688 } 5689 ); 5690 } catch (ex) { 5691 if (done) return; 5692 done = true; 5693 reject(self, ex); 5694 } 5695} 5696 5697Promise.prototype['catch'] = function(onRejected) { 5698 return this.then(null, onRejected); 5699}; 5700 5701Promise.prototype.then = function(onFulfilled, onRejected) { 5702 // @ts-ignore 5703 var prom = new this.constructor(noop); 5704 5705 handle(this, new Handler(onFulfilled, onRejected, prom)); 5706 return prom; 5707}; 5708 5709Promise.prototype['finally'] = finallyConstructor; 5710 5711Promise.all = function(arr) { 5712 return new Promise(function(resolve, reject) { 5713 if (!isArray(arr)) { 5714 return reject(new TypeError('Promise.all accepts an array')); 5715 } 5716 5717 var args = Array.prototype.slice.call(arr); 5718 if (args.length === 0) return resolve([]); 5719 var remaining = args.length; 5720 5721 function res(i, val) {
vendor: 2,341 bytes, lines 5722-5822
5722 try { 5723 if (val && (typeof val === 'object' || typeof val === 'function')) { 5724 var then = val.then; 5725 if (typeof then === 'function') { 5726 then.call( 5727 val, 5728 function(val) { 5729 res(i, val); 5730 }, 5731 reject 5732 ); 5733 return; 5734 } 5735 } 5736 args[i] = val; 5737 if (--remaining === 0) { 5738 resolve(args); 5739 } 5740 } catch (ex) { 5741 reject(ex); 5742 } 5743 } 5744 5745 for (var i = 0; i < args.length; i++) { 5746 res(i, args[i]); 5747 } 5748 }); 5749}; 5750 5751Promise.resolve = function(value) { 5752 if (value && typeof value === 'object' && value.constructor === Promise) { 5753 return value; 5754 } 5755 5756 return new Promise(function(resolve) { 5757 resolve(value); 5758 }); 5759}; 5760 5761Promise.reject = function(value) { 5762 return new Promise(function(resolve, reject) { 5763 reject(value); 5764 }); 5765}; 5766 5767Promise.race = function(arr) { 5768 return new Promise(function(resolve, reject) { 5769 if (!isArray(arr)) { 5770 return reject(new TypeError('Promise.race accepts an array')); 5771 } 5772 5773 for (var i = 0, len = arr.length; i < len; i++) { 5774 Promise.resolve(arr[i]).then(resolve, reject); 5775 } 5776 }); 5777}; 5778 5779// Use polyfill for setImmediate for performance gains 5780Promise._immediateFn = 5781 // @ts-ignore 5782 (typeof setImmediate === 'function' && 5783 function(fn) { 5784 // @ts-ignore 5785 setImmediate(fn); 5786 }) || 5787 function(fn) { 5788 setTimeoutFunc(fn, 0); 5789 }; 5790 5791Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { 5792 if (typeof console !== 'undefined' && console) { 5793 console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console 5794 } 5795}; 5796 5797/** @suppress {undefinedVars} */ 5798var globalNS = (function() { 5799 // the only reliable means to get the global object is 5800 // `Function('return this')()` 5801 // However, this causes CSP violations in Chrome apps. 5802 if (typeof self !== 'undefined') { 5803 return self; 5804 } 5805 if (typeof window !== 'undefined') { 5806 return window; 5807 } 5808 if (typeof global !== 'undefined') { 5809 return global; 5810 } 5811 throw new Error('unable to locate global object'); 5812})(); 5813 5814if (!('Promise' in globalNS)) { 5815 globalNS['Promise'] = Promise; 5816} else if (!globalNS.Promise.prototype['finally']) { 5817 globalNS.Promise.prototype['finally'] = finallyConstructor; 5818} 5819 5820}))); 5821 5822
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.