PageSourceSearch

https://umedvidku.cz/wp-content/plugins/wp-popups-lite/src/assets/js/wppopups.js?ver=2.2.0.8

js umedvidku.cz collected 2026-09-24 22:40:33 UTC 49,496 bytes, 1,506 lines download raw bytes

1"use strict";
2
3;
4/* global wppopups_settings,*/
5
6(function ($) {
7  'use strict';
8
9  var WPPopups = {
10    popups: {},
11    byBind: {
12      'class': [],
13      'href': []
14    },
15
16    /**
17     * Start the engine.
18     *
19     * @since 2.0.0
20     */
21    init: function init() {
22      // Document ready
23      $(document).ready(WPPopups.ready); // Page load
24
25      $(window).on('load', WPPopups.load); // Document ready
26
27      $(document).on('wppopupsAjaxReady', WPPopups.ajaxStart);
28      WPPopups.bindUIActions();
29    },
30
31    /**
32    * Document ready.
33    *
34    * @since 2.0.0
35    */
36    ready: function ready() {
37      $(document).trigger('wppopupsBeforeReady');
38      if ($(".spu-box").length == 0) return false;
39      var data = {
40        action: 'wppopups_rules',
41        pid: wppopups_vars.pid,
42        referrer: document.referrer,
43        user_agent: navigator.userAgent,
44        url: document.documentURI,
45        query_string: document.location.search,
46        is_category: wppopups_vars.is_category,
47        is_archive: wppopups_vars.is_archive,
48        is_singular: wppopups_vars.is_singular,
49        is_preview: wppopups_vars.is_preview,
50        is_search: wppopups_vars.is_search,
51        is_front_page: wppopups_vars.is_front_page,
52        is_blog_page: wppopups_vars.is_blog_page,
53        woo_is_shop: wppopups_vars.woo_is_shop,
54        woo_is_order_received: wppopups_vars.woo_is_order_received,
55        woo_is_product_category: wppopups_vars.woo_is_product_category,
56        woo_is_product_tag: wppopups_vars.woo_is_product_tag,
57        woo_is_product: wppopups_vars.woo_is_product,
58        woo_is_cart: wppopups_vars.woo_is_cart,
59        woo_is_checkout: wppopups_vars.woo_is_checkout,
60        woo_is_account_page: wppopups_vars.woo_is_account_page,
61        popups: []
62      }; // save all popups rules into data
63
64      $(".spu-box").each(function () {
65        var $popup = $(this),
66            $id = $popup.data('id'),
67            $need_ajax = $popup.data('need_ajax'),
68            $rules = WPPopups.settings($popup, 'rules'),
69            $global_rules = WPPopups.settings($popup, 'global_rules'); // if old popup it's enabled id will be empty and break things
70
71        if ($id && $need_ajax) {
72          data.popups.push({
73            id: $id,
74            rules: JSON.stringify($rules),
75            global_rules: JSON.stringify($global_rules),
76            parent: $popup.data('parent')
77          });
78        }
79      });
80      var ajax = {
81        url: wppopups_vars.ajax_url,
82        data: window.wp.hooks.applyFilters('wppopups_pre_ready_data', data),
83        cache: false,
84        type: 'POST',
85        dataType: 'json',
86        timeout: 30000,
87        success: function success(r) {
88          if (r.success) {
89            r.success.forEach(function (id) {
90              WPPopups.removePopup(id);
91            });
92          }
93
94          $(document).trigger('wppopupsAjaxReady');
95        },
96        error: function error(r) {
97          console.log(r);
98        }
99      };
100
101      if (data.popups.length) {
102        $.ajax(ajax);
103      }
104
105      WPPopups.initVideoSources();
106      WPPopups.resetPopupsContent();
107      WPPopups.hashTriggerPopups(); // init popups that doesn't need ajax
108
109      $(".spu-box").each(function () {
110        var $popup = $(this),
111            $need_ajax = $popup.data('need_ajax');
112
113        if ($need_ajax) {
114          $popup.hide();
115          return;
116        }
117
118        WPPopups.initPopup($popup);
119      });
120      WPPopups.loadValidation();
121      WPPopups.initSocialShortcodes();
122      $(document).trigger('wppopupsReady');
123    },
124
125    /**
126     * Page load.
127     *
128     * @since 2.0.0
129     */
130    load: function load() {
131      // center again once it's loaded
132      $(".spu-box").each(function () {
133        var $popup = $(this);
134        WPPopups.centerPopup($popup);
135      });
136    },
137    ajaxStart: function ajaxStart() {
138      $(".spu-box").each(function () {
139        var $popup = $(this),
140            $need_ajax = $popup.data('need_ajax');
141
142        if (!$need_ajax) {
143          return;
144        }
145
146        WPPopups.initPopup($popup);
147      });
148      $(document).trigger('wppopupsAjaxStarted');
149    },
150
151    /**
152     * Configure each popup
153     */
154    initPopup: function initPopup($popup) {
155      var $id = $popup.data('id'); // Save popup for later
156
157      WPPopups.popups[$id] = $popup; // all triggers added by users
158
159      WPPopups.bindPopupTriggers($popup); // click triggers
160
161      WPPopups.bindClickTriggers($popup); // Forms inside popups
162
163      WPPopups.formSubmissions($popup); // Forms Email Marketing
164      //WPPopups.formOptinSubmissions($popup);
165      // Events bindings
166
167      $(window).resize(function () {
168        WPPopups.checkPopupSize($popup);
169        WPPopups.centerPopup($popup);
170      });
171      $popup.find('input').on('change', function () {
172        WPPopups.checkPopupSize($popup);
173      }); // This hook will be used by third parties
174
175      window.wp.hooks.doAction('wppopups_loop', $popup);
176      window.wp.hooks.addAction('wppopups_show_popup', 'wppopups', WPPopups.centerPopup, 99); // hide it
177
178      $popup.hide();
179    },
180    // --------------------------------------------------------------------//
181    // Triggers
182    // --------------------------------------------------------------------//
183
184    /**
185    * Trigger popup after N seconds
186     * @param value
187     * @param $popup
188     */
189    triggerBySeconds: function triggerBySeconds(value, $popup) {
190      // if not value provided abort
191      if (value === '') {
192        return;
193      }
194
195      if ($popup.timer) {
196        clearTimeout($popup.timer);
197      }
198
199      $popup.timer = window.setTimeout(function () {
200        if (WPPopups.checkConvertion($popup)) {
201          WPPopups.showPopup($popup);
202        }
203      }, parseInt(value, 10) * 1000);
204    },
205
206    /**
207    * Trigger if scroll % amount of screen
208     * @param value
209     * @param $popup
210     */
211    triggerByPercentage: function triggerByPercentage(value, $popup) {
212      // if not value provided abort
213      if (value === '') {
214        return;
215      }
216
217      var $settings = WPPopups.settings($popup, 'settings'); // use custom namespace bind for off later
218
219      $(window).on('scroll.per' + $popup.data('id'), function () {
220        if ($popup.timer) {
221          clearTimeout($popup.timer);
222        }
223
224        $popup.timer = window.setTimeout(function () {
225          var triggerHeight = parseInt(value, 10) / 100 * $(document).height();
226          var scrollY = $(window).scrollTop(),
227              trigger = scrollY + $(window).height() >= triggerHeight; // show box when criteria for this box is matched
228
229          if (trigger && WPPopups.checkConvertion($popup)) {
230            // remove listen event if box shouldn't be hidden again. TODO: add auto hide in trigger settings
231            if (!$settings.auto_hide) {
232              $(window).off('scroll.per' + $popup.data('id'));
233            }
234
235            WPPopups.showPopup($popup);
236          } else if ($settings.auto_hide) {
237            WPPopups.hidePopup($popup, false, 10, false);
238          }
239        }, 100);
240      });
241    },
242
243    /**
244    * Bind TRigger after user scrolled X pixels
245     * @param value
246     * @param $popup
247     */
248    triggerByPixels: function triggerByPixels(value, $popup) {
249      // if not pixels provided abort
250      if (value === '') {
251        return;
252      }
253
254      var $settings = WPPopups.settings($popup, 'settings');
255      $(window).on('scroll.pix' + $popup.data('id'), function () {
256        if ($popup.timer) {
257          clearTimeout($popup.timer);
258        }
259
260        $popup.timer = window.setTimeout(function () {
261          var scrollY = $(window).scrollTop(),
262              trigger = scrollY >= parseInt(value, 10); //triggerSeconds equals to the number field really
263          // show box when criteria for this box is matched
264
265          if (trigger && WPPopups.checkConvertion($popup)) {
266            // remove listen event if box shouldn't be hidden again
267            if (!$settings.auto_hide) {
268              $(window).off('scroll.pix' + $popup.data('id'));
269            }
270
271            WPPopups.showPopup($popup);
272          } else if ($settings.auto_hide) {
273            WPPopups.hidePopup($popup, false, 10, false);
274          }
275        }, 100);
276      });
277    },
278    triggerByClass: function triggerByClass(value, $popup) {
279      // if not class provided abort
280      if (value === '') {
281        return;
282      } // add . to class attribute if missing
283
284
285      value = value.charAt(0) != '.' ? '.' + value : value;
286      WPPopups.setBindActions(value, 'class'); // Only add the trigger if not cookies are set for popup
287
288      if (WPPopups.hasCookies($popup)) {
289        return;
290      }
291
292      $(document.body).on('click', value, function (e) {
293        e.preventDefault();
294        WPPopups.showPopup($popup);
295      });
296    },
297    // --------------------------------------------------------------------//
298    // Binds
299    // --------------------------------------------------------------------//
300
301    /**
302    * Bind document triggers for popups
303     * @param $popup
304     */
305    bindClickTriggers: function bindClickTriggers($popup) {
306      var id = $popup.data('id');
307      WPPopups.setBindActions('.spu-open-' + id, 'class');
308      WPPopups.setBindActions('#spu-' + id, 'href'); // Only add the trigger if not cookies are set for popup
309
310      if (WPPopups.hasCookies($popup)) {
311        return;
312      } // add link listener for this box
313
314
315      $(document.body).on('click', 'a[href="#spu-' + id + '"], .spu-open-' + id, function (e) {
316        e.preventDefault();
317        WPPopups.showPopup($popup, true);
318      });
319      $('a[href="#spu-' + id + '"], .spu-open-' + id).css('cursor', 'pointer').addClass('spu-clickable');
320    },
321
322    /**
323    * Bind triggers set in popup settings
324     * @param $popup
325     */
326    bindPopupTriggers: function bindPopupTriggers($popup) {
327      if (window.wp.hooks.applyFilters('wppopups_disable_triggers', false, $popup)) return;
328      var $triggers = WPPopups.settings($popup, 'triggers');
329
330      if (Object.keys($triggers).length) {
331        for (var i in $triggers) {
332          var func = 'triggerBy' + $triggers[i].trigger.charAt(0).toUpperCase() + $triggers[i].trigger.substr(1),
333              settings = WPPopups.settings($popup, 'settings');
334
335          if (!WPPopups.hasCookies($popup) || wppopups_vars.is_preview || func == 'triggerByClass' || wppopups_vars.is_admin && settings.test_mode == '1') {
336            // only try if func really exist , may be premium one
337            if (typeof WPPopups[func] == 'function') {
338              WPPopups[func]($triggers[i].value, $popup);
339            } // hook for premium
340
341
342            window.wp.hooks.doAction('wppopups_trigger_popup', func, $triggers[i].value, $popup);
343          }
344        }
345      }
346    },
347
348    /**
349    * Element bindings.
350    *
351    * @since 2.0.0
352    */
353    bindUIActions: function bindUIActions() {
354      // Custom links inside popups conversion
355      $(document).on('click', '.spu-box a:not(".spu-close-popup, .spu-box .flp_wrapper a, .spu-box .spu-not-close, .spu-box .spu-not-close a, .spu-box .spu-gdpr a")', function () {
356        // hide the popup and track conversion
357        WPPopups.hidePopup($(this), true);
358      }); // Close and convert button, similar to above
359
360      $(document).on('click', '.spu-box .spu-close-convert,.spu-box .spu-close-convert a', function (e) {
361        e.preventDefault(); // hide the popup and track conversion
362
363        WPPopups.hidePopup($(this), true);
364      }); //close popup
365
366      $(document).on('click', '.spu-box .spu-close-popup', function (e) {
367        e.preventDefault(); // hide box, no conversion
368
369        WPPopups.hidePopup($(this), false);
370      }); //close with esc
371
372      $(document).on('keyup', function (e) {
373        if (e.keyCode == 27) {
374          WPPopups.togglePopups(false, false);
375        }
376      }); // close by clicking outside of popup
377      // get event by device or browser
378
379      var ua = navigator.userAgent,
380          event = ua.match(/iPad/i) || ua.match(/iPhone/i) ? "touchstart" : "click";
381      $('body').on(event, function (ev) {
382        var $target = $(ev.target); // TODO:
383        // for some reason ninja form not working, added this dirty workaround
384        // $target.is('.spu-box *, .spu-box') return false, same for .has .parents, etc
385        // so no popup closing when form is clicked
386
387        if ($target.is('input.nf-element')) return; // Forminator datepicker and also others it may be needed
388
389        if ($target.is(window.wp.hooks.applyFilters('wppopups_disable_click_out_classes', '.flatpickr-calendar,.flatpickr-calendar *, .ui-datepicker-header *,.ui-widget,.ui-widget *'))) return; // verify if some bindAction is present
390
391        if (WPPopups.checkBindActions($target)) return;
392        if (window.wp.hooks.applyFilters('wppopups_disable_click_out', false, $target)) return; // test that event is user triggered and not programatically,
393        // and that it is not fired  within the box
394
395        if (ev.originalEvent !== undefined && !$target.is('.spu-box *, .spu-box')) {
396          WPPopups.togglePopups(false, false);
397        }
398      });
399    },
400
401    /**
402    * Return setting from popup
403     * @param popup
404     * @param key
405     * @returns {*}
406     */
407    settings: function settings(popup, key) {
408      var settings = {};
409
410      if (popup.data('settings')) {
411        settings = popup.data('settings');
412      }
413
414      if (key) {
415        if (typeof settings[key] == 'undefined') return {};
416        return settings[key];
417      }
418
419      return settings;
420    },
421
422    /**
423    * Wrapper to execute toggle box on all popups
424     * @param elements
425     * @param show
426     * @param conversion
427     */
428    togglePopups: function togglePopups(show, conversion) {
429      $('.spu-box').each(function () {
430        if (show) {
431          WPPopups.showPopup($(this));
432        } else {
433          // premium version may disable advanced closing methods which use tooglePopups
434          if (window.wp.hooks.applyFilters('wppopups_allow_togglePopups', true, $(this))) {
435            WPPopups.hidePopup($(this), conversion);
436          }
437        }
438      });
439    },
440
441    /**
442    * Show given popup
443     * @param popup
444     * @param forse true/false
445     * @returns {boolean}
446     */
447    showPopup: function showPopup(popup) {
448      var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
449      var $popup = WPPopups.getPopup(popup),
450          $id = $popup.data('id'),
451          $bg = $('#spu-bg-' + $id); // don't do anything if box is undergoing an animation or already visible
452
453      if ($popup.is(":visible")) {
454        return false;
455      } // don't do anything if popup has any cookie created
456
457
458      if (!force && WPPopups.hasCookies($popup)) {
459        return false;
460      } // if has gf, make it visible to properly center
461
462
463      var gf = $popup.find('.gform_wrapper');
464
465      if (gf) {
466        gf.show();
467      } // Hook before the popup it's shown
468
469
470      window.wp.hooks.doAction('wppopups_before_show_popup', $popup); // show container and the popup
471
472      $popup.parent('.wppopups-whole').show(); // Overlay Blur
473
474      WPPopups.toggleBlur($popup, true);
475      WPPopups.centerPopup($popup); // I want to stop  supporting social shortcodes, let's see how many complain
476
477      /* setTimeout(function(){
478           WPPopups.centerShortcodes($popup);
479       },1500);*/
480      // Add scroll if needed
481
482      WPPopups.checkPopupSize($popup); // show box
483
484      var animation = WPPopups.settings($popup, 'animation');
485
486      switch (animation.animation) {
487        case 'fade':
488          $popup.hide().fadeIn('slow');
489          break;
490
491        case 'slide':
492          $popup.hide().slideDown('slow');
493          break;
494
495        default:
496          $popup.show();
497          break;
498      } //background only if not bottom/top bars
499
500
501      if (!$popup.hasClass('spu-position-top-bar') && !$popup.hasClass('spu-position-bottom-bar')) {
502        if (animation.animation === 'disable') {
503          $bg.show();
504        } else {
505          $bg.fadeIn();
506        }
507      } // Hook for show popup, used for example for premium animations
508
509
510      window.wp.hooks.doAction('wppopups_show_popup', $popup); // show videos if any
511
512      WPPopups.toggleVideoSources($popup, true); // trigger opening
513
514      $popup.trigger('wppopups.popup_opened', [$id]);
515    },
516
517    /**
518    * Hide given popup
519     * @param popup
520     * @param conversion
521     * @param time
522     * @returns {boolean}
523     */
524    hidePopup: function hidePopup(popup, conversion) {
525      var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
526      var cookie = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
527      var $popup = WPPopups.getPopup(popup),
528          $id = $popup.data('id'),
529          $bg = $('#spu-bg-' + $id); // don't do anything if box is undergoing an animation or already visible
530
531      if ($popup.is(":animated") || $popup.is(":hidden") || window.wp.hooks.applyFilters('wppopups_cancel_hide', false, $popup, conversion)) {
532        return false;
533      } // save cookie
534
535
536      if (conversion === true) {
537        WPPopups.popupConverted($popup, cookie);
538      }
539
540      var settings = WPPopups.settings($popup, 'settings');
541
542      if (settings.close_on_conversion == '1' && conversion || !conversion) {
543        setTimeout(function () {
544          var animation = WPPopups.settings($popup, 'animation'); // Hide with animation
545
546          switch (animation.animation) {
547            case 'slide':
548              $popup.slideUp('slow');
549              $bg.fadeOut();
550              break;
551
552            case 'disable':
553              $popup.hide();
554              $bg.hide();
555              break;
556
557            default:
558              $popup.removeClass('spu-animation-animated');
559              $popup.fadeOut('slow');
560              $bg.fadeOut();
561              break;
562          } // Hook for show popup, used for example for premium animations
563
564
565          window.wp.hooks.doAction('wppopups_hide_popup', $popup); // hide videos if any
566
567          WPPopups.toggleVideoSources($popup, false);
568        }, parseInt(time, 10));
569      } // Overlay Blur
570
571
572      WPPopups.toggleBlur($popup, false); // save cookie
573
574      WPPopups.popupClosed($popup, cookie);
575    },
576    centerPopup: function centerPopup(popup, animate) {
577      if (!popup.hasClass('spu-position-centered') && !popup.hasClass('spu-position-float-right') && !popup.hasClass('spu-position-float-left')) {
578        return;
579      }
580
581      if (popup.is(':animated')) {
582        return;
583      }
584
585      var ww = $(window).width(),
586          wh = $(window).height(),
587          pw = popup.outerWidth(),
588          ph = popup.outerHeight(); // To center the box
589
590      var boxLeft = ww / 2 - pw / 2,
591          boxTop = wh / 2 - ph / 2;
592      var css = {
593        top: boxTop
594      };
595
596      if (popup.hasClass('spu-position-centered')) {
597        css.left = boxLeft;
598      }
599
600      if (animate) {
601        popup.animate(css, {
602          queue: !1,
603          duration: 200
604        });
605      } else {
606        popup.css(css);
607      }
608    },
609
610    /**
611     * Removes the popup from DOM
612     * @param $popup
613     */
614    removePopup: function removePopup(popup) {
615      var $popup = WPPopups.getPopup(popup),
616          $id = $popup.data('id'),
617          $bg = $('#spu-bg-' + $id),
618          $css = $('#spu-css-' + $id);
619      $popup.remove();
620      $bg.remove();
621      $css.remove();
622    },
623
624    /**
625     * Track popup conversion (save cookie)
626     * @param $popup
627     */
628    popupConverted: function popupConverted($popup) {
629      var cookie = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
630
631      if (cookie) {
632        // set cookie
633        var settings = WPPopups.settings($popup, 'settings'),
634            duration = parseFloat(settings.conversion_cookie_duration),
635            _cookie = settings.conversion_cookie_name,
636            type = settings.conversion_cookie_type;
637
638        if (duration > 0) {
639          WPPopups.createCookie(_cookie, true, duration, type);
640        }
641      }
642
643      $popup.trigger('wppopups.popup_converted', [$popup.data('id')]);
644    },
645
646    /**
647     * Track popup closing (save cookie)
648     * @param $popup
649     */
650    popupClosed: function popupClosed($popup) {
651      var cookie = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
652
653      if (cookie) {
654        // set cookie
655        var settings = WPPopups.settings($popup, 'settings'),
656            duration = parseFloat(settings.closing_cookie_duration),
657            _cookie2 = settings.closing_cookie_name,
658            type = settings.closing_cookie_type;
659
660        if (duration > 0) {
661          WPPopups.createCookie(_cookie2, true, duration, type);
662        }
663      }
664
665      $popup.trigger('wppopups.popup_closed', [$popup.data('id')]);
666    },
667
668    /**
669     * Check if the popup has any cookies created.
670     * @param $popup
671     */
672    hasCookies: function hasCookies($popup) {
673      var $settings = WPPopups.settings($popup, 'settings'),
674          conversion_name = $settings.conversion_cookie_name,
675          closing_name = $settings.closing_cookie_name;
676      var hasCookies = false;
677
678      if (!(wppopups_vars.is_admin && $settings.test_mode == '1') && (WPPopups.getCookie(conversion_name) || WPPopups.getCookie(closing_name))) {
679        hasCookies = true;
680      }
681
682      return hasCookies;
683    },
684
685    /**
686     * Apply Overlay Blur
687     * @param  $popup
688     * @param  show   true/false
689     * @return        
690     */
691    toggleBlur: function toggleBlur($popup, show) {
692      // Overlay Blur
693      var colors = WPPopups.settings($popup, 'colors'),
694          $id = $popup.data('id'),
695          $box_css = $('#spu-css-' + $id);
696
697      if (colors.show_overlay == 'yes-blur') {
698        if (show) {
699          var blur_px = colors.overlay_blur ? colors.overlay_blur : 2,
700              blur_css = '/* ini:blur */body > *:not(.wppopups-whole) { -webkit-filter: blur(' + blur_px + 'px); -moz-filter: blur(' + blur_px + 'px); -o-filter: blur(' + blur_px + 'px); -ms-filter: blur(' + blur_px + 'px); filter: blur(' + blur_px + 'px); }/* fin:blur */';
701          $box_css.append(blur_css);
702        } else {
703          var css = $box_css.text(),
704              ini = css.indexOf('/* ini:blur */'),
705              pro = css.substring(ini);
706          $box_css.text(css.replace(pro, ''));
707        }
708      }
709    },
710
711    /**
712    * Check all iframes and set source to empty on page load
713     */
714    initVideoSources: function initVideoSources() {
715      var iframe = $('.spu-box iframe');
716
717      if (iframe && iframe.length) {
718        iframe.each(function () {
719          WPPopups.initSources($(this));
720        });
721      }
722
723      var video = $('.spu-box video');
724
725      if (video && video.length) {
726        video.each(function () {
727          WPPopups.initSources($(this));
728        });
729      }
730    },
731    initSources: function initSources(el) {
732      var iframeSrc = el.attr('src');
733
734      if (iframeSrc && iframeSrc.indexOf('recaptcha') !== -1) {// do nothing
735      } else {
736        el.attr('spusrc', iframeSrc);
737        el.attr('src', 'https://#');
738      }
739    },
740
741    /**
742    * Toggle a popup iframe source
743     * @param popup
744     * @param show
745     */
746    toggleVideoSources: function toggleVideoSources(popup, show) {
747      var iframe = popup.find('iframe');
748
749      if (iframe && iframe.length) {
750        iframe.each(function () {
751          WPPopups.toggleSource($(this), show);
752        });
753      }
754
755      var video = popup.find('video');
756
757      if (video && video.length) {
758        video.each(function () {
759          WPPopups.toggleSource($(this), show);
760        });
761      }
762    },
763    toggleSource: function toggleSource(el, show) {
764      if (show) {
765        if (el.attr('spusrc')) {
766          el.attr('src', el.attr('spusrc'));
767          el.css("width", "");
768          el.css("height", "");
769        }
770      } else {
771        var iframeSrc = el.attr('src');
772
773        if (iframeSrc && iframeSrc.indexOf('recaptcha') !== -1) {// do nothing
774        } else {
775          // destroy videos so they stop playing
776          el.attr('src', 'https://#');
777        }
778      }
779    },
780
781    /**
782    * remove paddings and margins from first and last items inside popups
783    * so it looks even with the given padding
784     */
785    resetPopupsContent: function resetPopupsContent() {
786      $(".spu-content").children().first().not('.spu-fields-container').css({
787        "margin-top": 0,
788        "padding-top": 0
789      }).end().last().not('.spu-fields-container').css({
790        'margin-bottom': 0,
791        'padding-bottom': 0
792      });
793    },
794
795    /**
796     * Trigger popup opening if anyone use #spu-open-123 in url
797     */
798    hashTriggerPopups: function hashTriggerPopups() {
799      // shows the box when hash refers to a box
800      if (window.location.hash && window.location.hash.length > 0) {
801        var hash = window.location.hash,
802            form_key = hash.substring(1).indexOf('spu-form'),
803            link_key = hash.substring(1).indexOf('spu-open'),
804            form_popup = form_key !== -1,
805            link_popup = link_key !== -1;
806        if (form_popup) var i = form_key + 10;else if (link_popup) var i = link_key + 10;
807
808        if ((link_popup || form_popup) && $('#spu-' + hash.substring(i)).is('.spu-box')) {
809          var popup = $('#spu-' + hash.substring(i)); // if triggered by a form add a close button if don't exist already one
810
811          if (form_popup && popup.find('.spu-close-popup').length < 2) {
812            popup.find('.spu-content').append('<p style="text-align: center"><button class="btn btn-primary spu-close-popup">Close</button></p>');
813          } // unbind regular triggers and set conversion
814
815
816          if (form_popup) {
817            $(window).off('scroll.per' + popup.data('id'));
818            $(window).off('scroll.pix' + popup.data('id'));
819            WPPopups.popupConverted(popup);
820          }
821
822          setTimeout(function () {
823            WPPopups.showPopup(popup, true);
824          }, 200);
825        }
826      }
827    },
828
829    /**
830    * Handle form submissions in two ways. Adding ajax most known forms callbacks
831     * and adding #spu-form to action for regular forms that will open on page load
832     * @param $popup
833     */
834    formSubmissions: function formSubmissions($popup) {
835      var popup_id = $popup.data('id');
836      $popup.find('form').each(function () {
837        var box_form = $(this),
838            action = box_form.attr('action') || '';
839
840        if (!wppopups_vars.disable_form_reopen) {
841          box_form.attr('action', action + '#spu-form-' + popup_id);
842        } // only run if not our form
843
844
845        if (box_form.hasClass('spu-optin-form')) {
846          return;
847        } // If url is external, we need to track popup before submission
848
849
850        if (WPPopups.isExternal(action)) {
851          box_form.on('submit', function () {
852            WPPopups.hidePopup($popup, true);
853          });
854        }
855      }); // Ninja forms don't use form elements O_o
856
857      $(document).on('nfFormSubmitResponse', function () {
858        $popup.trigger('wppopups.form_submitted', [popup_id]);
859        WPPopups.hidePopup($popup, true, 2000);
860      }); // Forminator
861
862      $(document).on('forminator:form:submit:success', function () {
863        $popup.trigger('wppopups.form_submitted', [popup_id]);
864        WPPopups.hidePopup($popup, true, 2000);
865      }); // Contact form 7
866
867      $popup.on('wpcf7mailsent', function () {
868        $popup.trigger('wppopups.form_submitted', [popup_id]);
869        WPPopups.hidePopup($popup, true, 2000);
870      }); // Gravity forms (ajax mode)
871
872      $(document).on('gform_post_render', function (jqXHR, form_id) {
873        var $form = $('#gform_ajax_frame_' + form_id);
874
875        if (!$form.is('.spu-box *')) {
876          return;
877        }
878
879        var contents = $form.contents().find('*').html(),
880            form_content = $form.contents().find('#gform_wrapper_' + form_id),
881            is_confirmation = $form.contents().find('#gform_confirmation_wrapper_' + form_id).length > 0,
882            is_redirect = contents.indexOf('gformRedirect(){') >= 0;
883
884        if (is_confirmation || is_redirect) {
885          $popup.trigger('wppopups.form_submitted', [popup_id]);
886          WPPopups.hidePopup($popup, true, 2000);
887        }
888      }); // Caldera Forms (ajax mode)
889
890      $(document).on('cf.submission', function () {
891        $popup.trigger('wppopups.form_submitted', [popup_id]);
892        WPPopups.hidePopup($popup, true, 2000);
893      }); // WPForms (ajax mode)
894
895      $(document).on('wpformsAjaxSubmitSuccess', function () {
896        $popup.trigger('wppopups.form_submitted', [popup_id]);
897        WPPopups.hidePopup($popup, true, 2000);
898      }); // Yikes form
899
900      $(document).on('yikes_mailchimp_ajax_submission', function (e, response) {
901        if (response.success) {
902          $popup.trigger('wppopups.form_submitted', [popup_id]);
903          WPPopups.hidePopup($popup, true, 2000);
904        }
905      });
906    },
907
908    /**
909     * Check if url is external
910     * @param url
911     * @returns {boolean}
912     */
913    isExternal: function isExternal(url) {
914      if (url.length === 0) {
915        return false;
916      }
917
918      var domain = function domain(url) {
919        return url.replace('http://', '').replace('https://', '').split('/')[0];
920      };
921
922      if (domain(url) == '') {
923        return false;
924      }
925
926      return domain(location.href) !== domain(url);
927    },
928
929    /**
930     * Forms to Email Marketing
931     * @param $popup
932     */
933    formOptinSubmissions: function formOptinSubmissions($popup) {
934      var popup_id = $popup.data('id'),
935          $form = $popup.find('.wppopups-form'),
936          $submit_btn = $form.find('.wppopups-submit-button');
937      WPPopups.toggleButton($submit_btn, true);
938      var data = $form.serializeArray();
939      data.push({
940        name: 'action',
941        value: 'wppopups_optin_submit'
942      });
943      data.push({
944        name: 'id',
945        value: popup_id
946      });
947      var ajax = {
948        url: wppopups_vars.ajax_url,
949        data: data,
950        cache: false,
951        type: 'POST',
952        dataType: 'json',
953        timeout: 30000,
954        success: function success(r) {
955          console.log(r);
956
957          if (r.success) {
958            // redirect if set in settings
959            if (r.data[1] && r.data[1].optin_redirect) {
960              $popup.trigger('wppopups.optin_on_redirect', [popup_id]);
961              var redirect = r.data[1].optin_redirect;
962
963              if (r.data[1].pass_lead_data && r.data[1].pass_lead_data == 1) {
964                var qstring = [];
965                var sep = redirect.match(/[\?]/g) ? '&' : '?';
966
967                for (var key in data) {
968                  if (data[key]['value'] == '') continue;
969                  qstring.push(encodeURIComponent(data[key]['name']) + '=' + encodeURIComponent(data[key]['value']));
970                }
971
972                redirect = redirect + sep + qstring.join('&');
973              }
974
975              WPPopups.hidePopup($popup, true);
976              window.location.href = redirect;
977              return;
978            } // clear errors
979
980
981            $popup.find('.optin-errors').html('').hide(); // success message
982
983            if (r.data[0] && r.data[0].optin_success) {
984              WPPopups.popupConverted($popup);
985              $popup.find('.spu-content').html(r.data[0].optin_success);
986              WPPopups.centerPopup($popup, true);
987
988              if (r.data[0].optin_success_seconds && parseInt(r.data[0].optin_success_seconds) > 0) {
989                var seconds = parseInt(r.data[0].optin_success_seconds, 10) * 1000;
990                WPPopups.hidePopup($popup, false, seconds);
991              }
992            } else {
993              WPPopups.hidePopup($popup, true);
994            }
995          } else {
996            $popup.find('.optin-errors').html(r.data).fadeIn();
997          }
998
999          $popup.trigger('wppopups.optin_form_submitted', [popup_id, r]);
1000          WPPopups.toggleButton($submit_btn, false);
1001        },
1002        error: function error(r) {
1003          console.log(r);
1004          WPPopups.toggleButton($submit_btn, false);
1005        }
1006      };
1007      $.ajax(ajax);
1008    },
1009    loadValidation: function loadValidation() {
1010      // Only load if jQuery validation library exists.
1011      if (typeof $.fn.validate !== 'undefined') {
1012        // Prepend URL field contents with http:// if user input doesn't contain a schema.
1013        $('.wppopups-validate input[type=url]').change(function () {
1014          var url = $(this).val();
1015
1016          if (!url) {
1017            return false;
1018          }
1019
1020          if (url.substr(0, 7) !== 'http://' && url.substr(0, 8) !== 'https://') {
1021            $(this).val('http://' + url);
1022          }
1023        });
1024        $.validator.messages.required = wppopups_vars.val_required;
1025        $.validator.messages.url = wppopups_vars.val_url;
1026        $.validator.messages.email = wppopups_vars.val_email;
1027        $.validator.messages.number = wppopups_vars.val_number; // Validate email addresses.
1028
1029        $.validator.methods.email = function (value, element) {
1030          return this.optional(element) || /^[a-z0-9.!#$%&'*+\/=?^_`{|}~-]+@((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}$/i.test(value);
1031        }; // Validate checkbox choice limit.
1032
1033
1034        $.validator.addMethod('check-limit', function (value, element) {
1035          var $ul = $(element).closest('ul'),
1036              $checked = $ul.find('input[type="checkbox"]:checked'),
1037              choiceLimit = parseInt($ul.attr('data-choice-limit') || 0, 10);
1038
1039          if (0 === choiceLimit) {
1040            return true;
1041          }
1042
1043          return $checked.length <= choiceLimit;
1044        }, function (params, element) {
1045          var choiceLimit = parseInt($(element).closest('ul').attr('data-choice-limit') || 0, 10);
1046          return wppopups_vars.val_checklimit.replace('{#}', choiceLimit);
1047        }); // Finally load jQuery Validation library for our forms.
1048
1049        $('.wppopups-validate').each(function () {
1050          var form = $(this),
1051              popupID = form.data('popupid'),
1052              properties; // TODO: cleanup this BC with wppopups_validate.
1053
1054          if (typeof window['wppopups_' + popupID] !== 'undefined' && window['wppopups_' + popupID].hasOwnProperty('val
1054idate')) {
1055            properties = window['wppopups_' + popupID].validate;
1056          } else if (typeof wppopups_validate !== 'undefined') {
1057            properties = wppopups_validate;
1058          } else {
1059            properties = {
1060              errorClass: 'wppopups-error',
1061              validClass: 'wppopups-valid',
1062              errorPlacement: function errorPlacement(error, element) {
1063                if ('radio' === element.attr('type') || 'checkbox' === element.attr('type')) {
1064                  if (element.hasClass('wppopups-likert-scale-option')) {
1065                    if (element.closest('table').hasClass('single-row')) {
1066                      element.closest('table').after(error);
1067                    } else {
1068                      element.closest('tr').find('th').append(error);
1069                    }
1070                  } else if (element.hasClass('wppopups-net-promoter-score-option')) {
1071                    element.closest('table').after(error);
1072                  } else {
1073                    element.closest('.wppopups-field-checkbox').find('label.wppopups-error').remove();
1074                    element.parent().parent().parent().append(error);
1075                  }
1076                } else if (element.is('select') && element.attr('class').match(/date-month|date-day|date-year/)) {
1077                  if (0 === element.parent().find('label.wppopups-error:visible').length) {
1078                    element.parent().find('select:last').after(error);
1079                  }
1080                } else if (element.hasClass('wppopups-smart-phone-field')) {
1081                  element.parent().after(error);
1082                } else if (element.hasClass('wppopups-validation-group-member')) {
1083                  element.closest('.wppopups-field').append(error);
1084                } else {
1085                  error.insertAfter(element);
1086                }
1087              },
1088              highlight: function highlight(element, errorClass, validClass) {
1089                var $element = $(element),
1090                    $field = $element.closest('.wppopups-field'),
1091                    inputName = $element.attr('name');
1092
1093                if ('radio' === $element.attr('type') || 'checkbox' === $element.attr('type')) {
1094                  $field.find('input[name="' + inputName + '"]').addClass(errorClass).removeClass(validClass);
1095                } else {
1096                  $element.addClass(errorClass).removeClass(validClass);
1097                }
1098
1099                $field.addClass('wppopups-has-error');
1100              },
1101              unhighlight: function unhighlight(element, errorClass, validClass) {
1102                var $element = $(element),
1103                    $field = $element.closest('.wppopups-field'),
1104                    inputName = $element.attr('name');
1105
1106                if ('radio' === $element.attr('type') || 'checkbox' === $element.attr('type')) {
1107                  $field.find('input[name="' + inputName + '"]').addClass(validClass).removeClass(errorClass);
1108                } else {
1109                  $element.addClass(validClass).removeClass(errorClass);
1110                }
1111
1112                $field.removeClass('wppopups-has-error');
1113              },
1114              submitHandler: function submitHandler(form) {
1115                var $popup = $('#spu-' + popupID);
1116                WPPopups.formOptinSubmissions($popup);
1117              },
1118              invalidHandler: function invalidHandler(event, validator) {//if ( typeof validator.errorList[0] !== 'undefined' ) {
1119                //    app.scrollToError( $( validator.errorList[0].element ) );
1120                //}
1121              },
1122              onkeyup: function onkeyup(element, event) {
1123                // This code is copied from JQuery Validate 'onkeyup' method with only one change: 'wppopups-novalidate-onkeyup' class check.
1124                var excludedKeys = [16, 17, 18, 20, 35, 36, 37, 38, 39, 40, 45, 144, 225];
1125
1126                if ($(element).hasClass('wppopups-novalidate-onkeyup')) {
1127                  return; // Disable onkeyup validation for some elements (e.g. remote calls).
1128                }
1129
1130                if (9 === event.which && '' === this.elementValue(element) || $.inArray(event.keyCode, excludedKeys) !== -1) {
1131                  return;
1132                } else if (element.name in this.submitted || element.name in this.invalid) {
1133                  this.element(element);
1134                }
1135              },
1136              onfocusout: function onfocusout(element) {
1137                // This code is copied from JQuery Validate 'onfocusout' method with only one change: 'wppopups-novalidate-onkeyup' class check.
1138                var validate = false;
1139
1140                if ($(element).hasClass('wppopups-novalidate-onkeyup') && !element.value) {
1141                  validate = true; // Empty value error handling for elements with onkeyup validation disabled.
1142                }
1143
1144                if (!this.checkable(element) && (element.name in this.submitted || !this.optional(element))) {
1145                  validate = true;
1146                }
1147
1148                if (validate) {
1149                  this.element(element);
1150                }
1151              },
1152              onclick: function onclick(element) {
1153                var validate = false,
1154                    type = (element || {}).type,
1155                    $el = $(element);
1156
1157                if (['checkbox', 'radio'].indexOf(type) > -1) {
1158                  if ($el.hasClass('wppopups-likert-scale-option')) {
1159                    $el = $el.closest('tr');
1160                  } else {
1161                    $el = $el.closest('.wppopups-field');
1162                  }
1163
1164                  $el.find('label.wppopups-error').remove();
1165                  validate = true;
1166                }
1167
1168                if (validate) {
1169                  this.element(element);
1170                }
1171              }
1172            };
1173          }
1174
1175          form.validate(properties);
1176        });
1177      }
1178    },
1179
1180    /**
1181     * Helper func to toggle optin button
1182     * @param $submit_btn
1183     * @param disable
1184     */
1185    toggleButton: function toggleButton($submit_btn, disable) {
1186      var oldText = $submit_btn.data('submit-text'),
1187          altText = $submit_btn.data('alt-text');
1188
1189      if (disable) {
1190        // Display processing text.
1191        if (altText) {
1192          $submit_btn.text(altText);
1193        }
1194
1195        $submit_btn.addClass('spu-sending');
1196        $submit_btn.attr('disabled', 'disabled');
1197      } else {
1198        if (oldText) {
1199          $submit_btn.text(oldText);
1200        }
1201
1202        $submit_btn.removeClass('spu-sending');
1203        $submit_btn.removeAttr('disabled');
1204      }
1205    },
1206
1207    /**
1208     * Check if popup it's bigger than windows to add scroll bars
1209     * @param $popup
1210     */
1211    checkPopupSize: function checkPopupSize($popup) {
1212      // add 150 to give some margins on top/bottom
1213      if ($popup.outerHeight() + 150 >= $(window).height()) {
1214        $popup.css('overflow', 'auto').addClass('spu-scrollable');
1215        $popup.css('max-height', $(window).height());
1216      } else {
1217        $popup.css('overflow', 'initial').removeClass('spu-scrollable');
1218        $popup.css('max-height', '');
1219      }
1220    },
1221    initSocialShortcodes: function initSocialShortcodes() {
1222      // if facebook being used on any popup
1223      if (wppopups_vars.facebook) {
1224        var SPUfb = false,
1225            FbTimer = setInterval(function () {
1226          if (typeof FB !== 'undefined' && !SPUfb) {
1227            try {
1228              FB.Event.subscribe('edge.create', function (href, html_element) {
1229                var $popup = $(html_element).parents('.spu-box');
1230
1231                if ($popup.length) {
1232                  WPPopups.hidePopup($popup, true);
1233                }
1234              });
1235            } catch (ex) {
1236              console.log(ex);
1237            }
1238
1239            SPUfb = true;
1240            clearInterval(FbTimer);
1241          }
1242        }, 1000);
1243      }
1244
1245      if (wppopups_vars.twitter) {
1246        if (typeof twttr !== 'undefined') {
1247          try {
1248            twttr.ready(function (twttr) {
1249              twttr.events.bind('tweet', WPPopups.twitterCB);
1250              twttr.events.bind('follow', WPPopups.twitterCB);
1251            });
1252          } catch (ex) {}
1253        }
1254      }
1255
1256      if (wppopups_vars.google) {
1257        if (typeof twttr !== 'undefined') {
1258          try {
1259            twttr.ready(function (twttr) {
1260              twttr.events.bind('tweet', WPPopups.twitterCB);
1261              twttr.events.bind('follow', WPPopups.twitterCB);
1262            });
1263          } catch (ex) {}
1264        }
1265      }
1266    },
1267    googleCB: function googleCB(a) {
1268      if ("on" == a.state) {
1269        var box_id = $('.spu-gogl').data('box-id');
1270
1271        if (box_id) {
1272          WPPopups.hidePopup(box_id, true);
1273        }
1274      }
1275    },
1276    closeGoogle: function closeGoogle(a) {
1277      if ("confirm" == a.type) {
1278        var box_id = $('.spu-gogl').data('box-id');
1279
1280        if (box_id) {
1281          WPPopups.hidePopup(box_id, true);
1282        }
1283      }
1284    },
1285
1286    /**
1287     * Twitter callback function
1288     * @param intent_event
1289     */
1290    twitterCB: function twitterCB(intent_event) {
1291      var $popup = $(intent_event.target).parents('.spu-box');
1292
1293      if ($popup) {
1294        WPPopups.hidePopup($popup, true);
1295      }
1296    },
1297
1298    /**
1299     * Set cookie container user UUID.
1300     *
1301     */
1302    setUserIndentifier: function setUserIndentifier() {
1303      if (wppopups_settings.uuid_cookie && !WPPopups.getCookie('_wpfuuid')) {
1304        // Generate UUID - http://stackoverflow.com/a/873856/1489528
1305        var s = new Array(36),
1306            hexDigits = '0123456789abcdef',
1307            uuid;
1308
1309        for (var i = 0; i < 36; i++) {
1310          s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
1311        }
1312
1313        s[14] = "4";
1314        s[19] = hexDigits.substr(s[19] & 0x3 | 0x8, 1);
1315        s[8] = s[13] = s[18] = s[23] = '-';
1316        uuid = s.join("");
1317        WPPopups.createCookie('_wpfuuid', uuid, 3999);
1318      }
1319    },
1320
1321    /**
1322     * Set classes or href link in a global array
1323     * @param bind_name
1324     * @param bind_type
1325     */
1326    setBindActions: function setBindActions() {
1327      var bind_name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1328      var bind_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'class';
1329
1330      if (bind_name != '') {
1331        switch (bind_type) {
1332          case 'class':
1333            bind_name = bind_name.charAt(0) == '.' ? bind_name.substring(1) : bind_name;
1334            if ($.inArray(bind_name, WPPopups.byBind['class']) === -1) WPPopups.byBind['class'].push(bind_name);
1335            break;
1336
1337          case 'href':
1338            if ($.inArray(bind_name, WPPopups.byBind['href']) === -1) WPPopups.byBind['href'].push(bind_name);
1339            break;
1340        }
1341
1342        window.wp.hooks.doAction('wppopups_set_bindactions', bind_name, bind_type);
1343      }
1344    },
1345
1346    /**
1347     * Check if exists any BindActions when happen a event
1348     * @param target
1349     */
1350    checkBindActions: function checkBindActions(target) {
1351      var $classes = WPPopups.byBind['class'];
1352
1353      for (var i = 0; i < $classes.length; i++) {
1354        if ($classes[i]) {
1355          if (target.hasClass($classes[i]) || target.closest('.' + $classes[i]).length) {
1356            return true;
1357          }
1358        }
1359      }
1360
1361      var $href = WPPopups.byBind['href'];
1362
1363      for (var _i = 0; _i < $href.length; _i++) {
1364        if ($href[_i] && target.attr('href') == $href[_i]) {
1365          return true;
1366        }
1367      }
1368
1369      return false;
1370    },
1371
1372    /**
1373     * Create cookie.
1374     *
1375     * @since 2.0.0
1376     */
1377    createCookie: function createCookie(name, value) {
1378      var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 999;
1379      var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'd';
1380      var expires = ''; // If we have a duration value, set it in the expiry of the cookie.
1381
1382      if (duration && type) {
1383        // If -1 is our value, set a session based cookie instead of a persistent cookie.
1384        if ('-1' === duration) {
1385          expires = '';
1386        } else {
1387          var cookie_time;
1388
1389          switch (type) {
1390            case 'm':
1391              cookie_time = 60 * 1000;
1392              break;
1393
1394            case 'h':
1395              cookie_time = 60 * 60 * 1000;
1396              break;
1397
1398            default:
1399              cookie_time = 24 * 60 * 60 * 1000;
1400          }
1401
1402          var date = new Date();
1403          date.setTime(date.getTime() + parseInt(duration) * cookie_time);
1404          expires = '; expires=' + date.toGMTString();
1405        }
1406      } else {
1407        expires = '; expires=Thu, 01 Jan 1970 00:00:01 GMT';
1408      } // Write the cookie.
1409
1410
1411      document.cookie = name + '=' + value + expires + '; path=/';
1412    },
1413
1414    /**
1415     * Retrieve cookie.
1416     *
1417     * @since 2.0.0
1418     */
1419    getCookie: function getCookie(name) {
1420      var nameEQ = name + '=',
1421          ca = document.cookie.split(';');
1422
1423      for (var i = 0; i < ca.length; i++) {
1424        var c = ca[i];
1425
1426        while (c.charAt(0) === ' ') {
1427          c = c.substring(1, c.length);
1428        }
1429
1430        if (c.indexOf(nameEQ) == 0) {
1431          return c.substring(nameEQ.length, c.length);
1432        }
1433      }
1434
1435      return null;
1436    },
1437
1438    /**
1439     * Delete cookie.
1440     */
1441    removeCookie: function removeCookie(name) {
1442      WPPopups.createCookie(name, '', -1);
1443    },
1444
1445    /**
1446     * Check if it's a number. So (12) and ('12') will be good
1447     * @param n
1448     * @returns {boolean}
1449     */
1450    isNumber: function isNumber(n) {
1451      return !isNaN(parseFloat(n)) && !isNaN(n - 0);
1452    },
1453
1454    /**
1455     * Get a popup from a string, or selector or inner selector such as coming from event
1456     * @param popup
1457     */
1458    getPopup: function getPopup(popup) {
1459      if (WPPopups.isNumber(popup)) {
1460        return $('#spu-' + parseInt(popup));
1461      }
1462
1463      if (popup.is('.spu-box')) {
1464        return popup;
1465      }
1466
1467      return popup.closest('.spu-box');
1468    },
1469
1470    /**
1471     * Check if the popup has convertion rules and fire if needed
1472     * We need to runt his check on js because some popups fire when other convert in the same page load
1473     * Eg: Show exit popup A if popup B fails
1474     * @param $popup
1475     * @returns {boolean}
1476     */
1477    checkConvertion: function checkConvertion($popup) {
1478      // if no class trigger as normal
1479      if (!$popup.hasClass('yes-convert') && !$popup.hasClass('no-convert')) return true;
1480      var $settings = WPPopups.settings($('#spu-' + $popup.data('convert-id')), 'settings');
1481      var popup_converted = false;
1482
1483      if (WPPopups.getCookie($settings.conversion_cookie_name)) {
1484        popup_converted = true;
1485      }
1486
1487      if ($popup.hasClass('yes-convert')) {
1488        return popup_converted;
1489      } else {
1490        return !popup_converted;
1491      }
1492    },
1493    isMobile: function isMobile() {
1494      var Android = navigator.userAgent.match(/Android/i),
1495          BlackBerry = navigator.userAgent.match(/BlackBerry/i),
1496          iOS = navigator.userAgent.match(/iPhone|iPad|iPod/i),
1497          Opera = navigator.userAgent.match(/Opera Mini/i),
1498          Windows = navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i);
1499      return Android || BlackBerry || iOS || Opera || Windows;
1500    }
1501  }; // Initialize.
1502
1503  WPPopups.init(); // Add to global scope.
1504
1505  window.wppopups = WPPopups;
1506})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.