PluginProbe
Boxzilla – WordPress Popup Builder / 3.1.9
Boxzilla – WordPress Popup Builder v3.1.9
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
← All changes | assets/js/script.min.js +1 -1 3.1.13.1.9 View file →
@@ -1,2 +1,2 @@
1 -"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};!function(){var e=void 0,t=void 0;!function i(t,n,o){function r(a,l){if(!n[a]){if(!t[a]){var c="function"==typeof e&&e;if(!l&&c)return c(a,!0);if(s)return s(a,!0);var d=new Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var i=t[a][1][e];return r(i?i:e)},f,f.exports,i,t,n,o)}return n[a].exports}for(var s="function"==typeof e&&e,a=0;a<o.length;a++)r(o[a]);return r}({1:[function(e,t,i){function n(e,t){t.background_color&&(e.style.background=t.background_color),t.color&&(e.style.color=t.color),t.border_color&&(e.style.borderColor=t.border_color),t.border_width&&(e.style.borderWidth=parseInt(t.border_width)+"px"),t.border_style&&(e.style.borderStyle=t.border_style),t.width&&(e.style.maxWidth=parseInt(t.width)+"px")}var o=e("boxzilla"),r=window.boxzilla_options,s=document.body.className.indexOf("logged-in")>-1;s&&r.testMode&&console.log("Boxzilla: Test mode is enabled. Please disable test mode if you're done testing."),o.init();for(var a=0;a<r.boxes.length;a++){var l=r.boxes[a];l.testMode=s&&r.testMode,"https"===window.location.origin.substring(0,5)&&(l.content=l.content.replace(window.location.origin.replace("https","http"),window.location.origin));var c=o.create(l.id,l);n(c.element,l.css)}window.addEventListener("load",function(){if("object"===_typeof(window.mc4wp_forms_config)&&window.mc4wp_forms_config.submitted_form){var e="#"+window.mc4wp_forms_config.submitted_form.element_id,t=o.boxes;for(var i in t)if(t.hasOwnProperty(i)){var n=t[i];if(n.element.querySelector(e))return void n.show()}}}),window.Boxzilla=o},{boxzilla:4}],2:[function(e,t,i){function n(e,t){for(var i in t)e.style[i]=t[i]}function o(e,t){for(var i={},n=0;n<e.length;n++)i[e[n]]=t;return i}function r(e,t){for(var i={},n=0;n<e.length;n++)i[e[n]]=t[e[n]];return i}function s(e){return!!e.getAttribute("data-animated")}function a(e,t){var i="none"!=e.style.display||e.offsetLeft>0,s=e.cloneNode(!0),a=function(){e.removeAttribute("data-animated"),e.setAttribute("style",s.getAttribute("style")),e.style.display=i?"none":""};e.setAttribute("data-animated","true"),i||(e.style.display="");var c,d;if("slide"===t){if(c=o(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],0),d={},!i){var f=window.getComputedStyle(e);d=r(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],f),n(e,c)}e.style.overflowY="hidden",l(e,i?c:d,a)}else c={opacity:0},d={opacity:1},i||n(e,c),l(e,i?c:d,a)}function l(e,t,i){var n=+new Date,o=window.getComputedStyle(e),r={},s={};for(var a in t){t[a]=parseFloat(t[a]);var l=t[a],d=parseFloat(o[a]);d!=l?(s[a]=(l-d)/c,r[a]=d):delete t[a]}var f=function u(){var o,a,l,c,d=+new Date,f=d-n,h=!0;for(var g in t){o=s[g],a=t[g],l=o*f,c=r[g]+l,o>0&&c>=a||o<0&&c<=a?c=a:h=!1,r[g]=c;var p="opacity"!==g?"px":"";e.style[g]=c+p}n=+new Date,h?i&&i():window.requestAnimationFrame&&requestAnimationFrame(u)||setTimeout(u,32)};f()}var c=320;t.exports={toggle:a,animate:l,animated:s}},{}],3:[function(e,t,i){function n(e,t){var i={};for(var n in e)i[n]=e[n];for(var n in t)i[n]=t[n];return i}function o(){var e=document.body,t=document.documentElement,i=Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight);return i}var r,s={animation:"fade",rehide:!1,content:"",cookie:null,icon:"&times",minimumScreenWidth:0,position:"center",testMode:!1,trigger:!1,closable:!0},a=e("./animator.js"),l=function(e,t){this.id=e,this.config=n(s,t),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.dismissed=!1,this.triggered=!1,this.triggerHeight=0,this.cookieSet=!1,this.element=null,this.closeIcon=null,this.config.trigger&&("percentage"!==this.config.trigger.method&&"element"!==this.config.trigger.method||(this.triggerHeight=this.calculateTriggerHeight()),this.cookieSet=this.isCookieSet()),this.dom(),this.events()};l.prototype.events=function(){var e=this;this.closeIcon&&this.closeIcon.addEventListener("click",e.dismiss.bind(this)),this.element.addEventListener("click",function(t){"A"===t.target.tagName&&r.trigger("box.interactions.link",[e,t.target])},!1),this.element.addEventListener("submit",function(t){e.setCookie(),r.trigger("box.interactions.form",[e,t.target])},!1),window.addEventListener("hashchange",function(){var t="#boxzilla-"+e.id;location.hash===t&&e.toggle()}),this.fits()&&this.locationHashRefersBox()&&window.addEventListener("load",this.show.bind(this))},l.prototype.dom=function(){var e=document.createElement("div");e.className="boxzilla-container boxzilla-"+this.config.position+"-container";var t=document.createElement("div");t.setAttribute("id","boxzilla-"+this.id),t.className="boxzilla boxzilla-"+this.id+" boxzilla-"+this.config.position,t.style.display="none",e.appendChild(t);var i=document.createElement("div");i.className="boxzilla-content",i.innerHTML=this.config.content,t.appendChild(i);var n=i.querySelectorAll("script");if(n.length){for(var o=document.createElement("script"),r=0;r<n.length;r++)o.appendChild(document.createTextNode(n[r].text)),n[r].parentNode.removeChild(n[r]);document.body.appendChild(o)}if(this.config.closable&&this.config.icon){var s=document.createElement("span");s.className="boxzilla-close-icon",s.innerHTML=this.config.icon,t.appendChild(s),this.closeIcon=s}document.body.appendChild(e),this.element=t},l.prototype.setCustomBoxStyling=function(){var e=this.element.style.display;this.element.style.display="",this.element.style.overflowY="auto",this.element.style.maxHeight="none";var t=window.innerHeight,i=this.element.clientHeight;if(i>t&&(this.element.style.maxHeight=t+"px",this.element.style.overflowY="scroll"),"center"===this.config.position){var n=(t-i)/2;n=n>=0?n:0,this.element.style.marginTop=n+"px"}this.element.style.display=e},l.prototype.toggle=function(e){if("undefined"==typeof e&&(e=!this.visible),e===this.visible)return!1;if(a.animated(this.element))return!1;if(!e&&!this.config.closable)return!1;this.visible=e,this.setCustomBoxStyling(),r.trigger("box."+(e?"show":"hide"),[this]),"center"===this.config.position&&a.toggle(this.overlay,"fade"),a.toggle(this.element,this.config.animation);var t=this.element.querySelector("input, textarea");return t&&t.focus(),!0},l.prototype.show=function(){return this.toggle(!0)},l.prototype.hide=function(){return this.toggle(!1)},l.prototype.calculateTriggerHeight=function(){var e=0;if("element"===this.config.trigger.method){var t=document.body.querySelector(this.config.trigger.value);if(t){var i=t.getBoundingClientRect();e=i.top}}else"percentage"===this.config.trigger.method&&(e=this.config.trigger.value/100*o());return e},l.prototype.locationHashRefersBox=function(){if(!window.location.hash||0===window.location.hash.length)return!1;var e=window.location.hash.substring(1);return e===this.element.id||!!this.element.querySelector("#"+e)},l.prototype.fits=function(){return this.config.minimumScreenWidth<=0||window.innerWidth>this.config.minimumScreenWidth},l.prototype.mayAutoShow=function(){return!this.dismissed&&(!!this.fits()&&(!!this.config.trigger&&!this.cookieSet))},l.prototype.mayRehide=function(){return this.config.rehide&&this.triggered},l.prototype.isCookieSet=function(){if(this.config.testMode)return!1;if(!this.config.cookie||!this.config.cookie.triggered&&!this.config.cookie.dismissed)return!1;var e="true"===document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*boxzilla_box_"+this.id+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1");return e},l.prototype.setCookie=function(e){var t=new Date;t.setHours(t.getHours()+e),document.cookie="boxzilla_box_"+this.id+"=true; expires="+t.toUTCString()+"; path=/"},l.prototype.trigger=function(){var e=this.show();e&&(this.triggered=!0,this.config.cookie&&this.config.cookie.triggered&&this.setCookie(this.config.cookie.triggered))},l.prototype.dismiss=function(){this.hide(),this.config.cookie&&this.config.cookie.dismissed&&this.setCookie(this.config.cookie.dismissed),this.dismissed=!0,r.trigger("box.dismiss",[this])},t.exports=function(e){return r=e,l}},{"./animator.js":2}],4:[function(e,t,i){function n(e,t){for(var i in e)e.hasOwnProperty(i)&&t(e[i])}function o(e,t,i){t||(t=250);var n,o;return function(){var r=i||this,s=+new Date,a=arguments;n&&s<n+t?(clearTimeout(o),o=setTimeout(function(){n=s,e.apply(r,a)},t)):(n=s,e.apply(r,a))}}function r(e){27==e.keyCode&&x.dismiss()}function s(){n(E,function(e){e.mayAutoShow()&&"pageviews"===e.config.trigger.method&&b>=e.config.trigger.value&&e.trigger()})}function a(){n(E,function(e){e.mayAutoShow()&&("time_on_site"===e.config.trigger.method&&v.time>=e.config.trigger.value&&e.trigger(),"time_on_page"===e.config.trigger.method&&y.time>=e.config.trigger.value&&e.trigger())})}function l(){var e=(window.scrollY||window.pageYOffset)+.75*window.innerHeight;n(E,function(t){!t.mayAutoShow()||t.triggerHeight<=0||(e>t.triggerHeight?t.trigger():t.mayRehide()&&t.hide())})}function c(){n(E,function(e){e.setCustomBoxStyling()})}function d(e){var t=e.offsetX,i=e.offsetY;n(E,function(e){var n=e.element.getBoundingClientRect(),o=100+.05*window.innerWidth;(t<n.left-o||t>n.right+o||i<n.top-o||i>n.bottom+o)&&e.dismiss()})}function f(){m||(n(E,function(e){e.mayAutoShow()&&"exit_intent"===e.config.trigger.method&&e.trigger()}),m=!0)}function u(e){var t=400;e.clientY<=0&&(p=window.setTimeout(f,t))}function h(){p&&(window.clearInterval(p),p=null)}var g,p,m,v,y,b,w=e("wolfy87-eventemitter"),x=Object.create(w.prototype),_=e("./box.js")(x),z=e("./timer.js"),E={},L={start:function(){var e=sessionStorage.getItem("boxzilla_timer");e&&(v.time=e),v.start(),y.start()},stop:function(){sessionStorage.setItem("boxzilla_timer",v.time),v.stop(),y.stop()}};x.init=function(){v=new z(sessionStorage.getItem("boxzilla_timer")||0),y=new z(0),b=sessionStorage.getItem("boxzilla_pageviews")||0;var t=e("./styles.js"),i=document.createElement("style");i.setAttribute("type","text/css"),i.innerHTML=t,document.head.appendChild(i),g=document.createElement("div"),g.style.display="none",g.id="boxzilla-overlay",document.body.appendChild(g),window.addEventListener("scroll",o(l)),window.addEventListener("resize",o(c)),window.addEventListener("load",c),g.addEventListener("click",d),window.setInterval(a,1e3),window.setTimeout(s,1e3),document.addEventListener("mouseleave",u),document.addEventListener("mouseenter",h),document.addEventListener("keyup",r),L.start(),window.addEventListener("focus",L.start),window.addEventListener("beforeunload",function(){L.stop(),sessionStorage.setItem("boxzilla_pageviews",++b)}),window.addEventListener("blur",L.stop),x.trigger("ready")},x.create=function(e,t){return E[e]=new _(e,t),E[e]},x.dismiss=function(e){"undefined"==typeof e?n(E,function(e){e.dismiss()}):"object"===_typeof(E[e])&&E[e].dismiss()},x.hide=function(e){"undefined"==typeof e?n(E,function(e){e.hide()}):"object"===_typeof(E[e])&&E[e].hide()},x.show=function(e){"undefined"==typeof e?n(E,function(e){e.show()}):"object"===_typeof(E[e])&&E[e].show()},x.toggle=function(e){"undefined"==typeof e?n(E,function(e){e.toggle()}):"object"===_typeof(E[e])&&E[e].toggle()},x.boxes=E,window.Boxzilla=x,"undefined"!=typeof t&&t.exports&&(t.exports=x)},{"./box.js":3,"./styles.js":5,"./timer.js":6,"wolfy87-eventemitter":7}],5:[function(e,t,i){var n="#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}";t.exports=n},{}],6:[function(e,t,i){var n=function(e){this.time=e,this.interval=0};n.prototype.tick=function(){this.time++},n.prototype.start=function(){this.interval||(this.interval=window.setInterval(this.tick.bind(this),1e3))},n.prototype.stop=function(){window.clearInterval(this.interval),this.interval=0},t.exports=n},{}],7:[function(e,i,n){(function(){function e(){}function n(e,t){for(var i=e.length;i--;)if(e[i].listener===t)return i;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}var r=e.prototype,s=this,a=s.EventEmitter;r.getListeners=function(e){var t,i,n=this._getEvents();if(e instanceof RegExp){t={};for(i in n)n.hasOwnProperty(i)&&e.test(i)&&(t[i]=n[i])}else t=n[e]||(n[e]=[]);return t},r.flattenListeners=function(e){var t,i=[];for(t=0;t<e.length;t+=1)i.push(e[t].listener);return i},r.getListenersAsObject=function(e){var t,i=this.getListeners(e);return i instanceof Array&&(t={},t[e]=i),t||i},r.addListener=function(e,t){var i,o=this.getListenersAsObject(e),r="object"===("undefined"==typeof t?"undefined":_typeof(t));for(i in o)o.hasOwnProperty(i)&&n(o[i],t)===-1&&o[i].push(r?t:{listener:t,once:!1});return this},r.on=o("addListener"),r.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},r.once=o("addOnceListener"),r.defineEvent=function(e){return this.getListeners(e),this},r.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},r.removeListener=function(e,t){var i,o,r=this.getListenersAsObject(e);for(o in r)r.hasOwnProperty(o)&&(i=n(r[o],t),i!==-1&&r[o].splice(i,1));return this},r.off=o("removeListener"),r.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},r.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},r.manipulateListeners=function(e,t,i){var n,o,r=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!==("undefined"==typeof t?"undefined":_typeof(t))||t instanceof RegExp)for(n=i.length;n--;)r.call(this,t,i[n]);else for(n in t)t.hasOwnProperty(n)&&(o=t[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},r.removeEvent=function(e){var t,i="undefined"==typeof e?"undefined":_typeof(e),n=this._getEvents();if("string"===i)delete n[e];else if(e instanceof RegExp)for(t in n)n.hasOwnProperty(t)&&e.test(t)&&delete n[t];else delete this._events;return this},r.removeAllListeners=o("removeEvent"),r.emitEvent=function(e,t){var i,n,o,r,s,a=this.getListenersAsObject(e);for(r in a)if(a.hasOwnProperty(r))for(i=a[r].slice(0),o=i.length;o--;)n=i[o],n.once===!0&&this.removeListener(e,n.listener),s=n.listener.apply(this,t||[]),s===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},r.trigger=o("emitEvent"),r.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},r.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},r._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},r._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return s.EventEmitter=a,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"===("undefined"==typeof i?"undefined":_typeof(i))&&i.exports?i.exports=e:s.EventEmitter=e}).call(this)},{}]},{},[1])}();
1 +!function(){var t=void 0,e=void 0;!function i(e,o,n){function r(l,a){if(!o[l]){if(!e[l]){var c="function"==typeof t&&t;if(!a&&c)return c(l,!0);if(s)return s(l,!0);var d=new Error("Cannot find module '"+l+"'");throw d.code="MODULE_NOT_FOUND",d}var f=o[l]={exports:{}};e[l][0].call(f.exports,function(t){var i=e[l][1][t];return r(i?i:t)},f,f.exports,i,e,o,n)}return o[l].exports}for(var s="function"==typeof t&&t,l=0;l<n.length;l++)r(n[l]);return r}({1:[function(t,e,i){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(){function e(t){"loading"!=document.readyState?t():document.addEventListener("DOMContentLoaded",t)}function i(t,e){e.background_color&&(t.style.background=e.background_color),e.color&&(t.style.color=e.color),e.border_color&&(t.style.borderColor=e.border_color),e.border_width&&(t.style.borderWidth=parseInt(e.border_width)+"px"),e.border_style&&(t.style.borderStyle=e.border_style),e.width&&(t.style.maxWidth=parseInt(e.width)+"px")}function n(){var t=document.body.className.indexOf("logged-in")>-1;if(!l.inited){t&&l.testMode&&console.log("Boxzilla: Test mode is enabled. Please disable test mode if you're done testing."),s.init();for(var e=0;e<l.boxes.length;e++){var o=l.boxes[e];if(o.testMode=t&&l.testMode,"https:"===window.location.protocol&&window.location.host){var n="http://"+window.location.host,a=n.replace("http://","https://");o.content=o.content.replace(n,a)}var c=s.create(o.id,o);c.element.className=c.element.className+" boxzilla-"+o.post.slug,i(c.element,o.css),c.element.firstChild.firstChild.className+=" first-child",c.element.firstChild.lastChild.className+=" last-child"}window.addEventListener("load",r),l.inited=!0,s.trigger("done")}}function r(){if("object"===o(window.mc4wp_forms_config)&&window.mc4wp_forms_config.submitted_form){var t="#"+window.mc4wp_forms_config.submitted_form.element_id,e=s.boxes;for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(n.element.querySelector(t))return void n.show()}}}var s=t("boxzilla"),l=window.boxzilla_options;window.Boxzilla=s,e(n)}()},{boxzilla:4}],2:[function(t,e,i){"use strict";function o(t,e){for(var i in e)t.style[i]=e[i]}function n(t,e){for(var i={},o=0;o<t.length;o++)i[t[o]]=e;return i}function r(t,e){for(var i={},o=0;o<t.length;o++)i[t[o]]=e[t[o]];return i}function s(t){return!!t.getAttribute("data-animated")}function l(t,e){var i="none"!=t.style.display||t.offsetLeft>0,s=t.cloneNode(!0),l=function(){t.removeAttribute("data-animated"),t.setAttribute("style",s.getAttribute("style")),t.style.display=i?"none":""};t.setAttribute("data-animated","true"),i||(t.style.display="");var c,d;if("slide"===e){if(c=n(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],0),d={},!i){var f=window.getComputedStyle(t);d=r(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],f),o(t,c)}t.style.overflowY="hidden",a(t,i?c:d,l)}else c={opacity:0},d={opacity:1},i||o(t,c),a(t,i?c:d,l)}function a(t,e,i){var o=+new Date,n=window.getComputedStyle(t),r={},s={};for(var l in e){e[l]=parseFloat(e[l]);var a=e[l],d=parseFloat(n[l]);d!=a?(s[l]=(a-d)/c,r[l]=d):delete e[l]}var f=function h(){var n,l,a,c,d=+new Date,f=d-o,u=!0;for(var g in e){n=s[g],l=e[g],a=n*f,c=r[g]+a,n>0&&c>=l||n<0&&c<=l?c=l:u=!1,r[g]=c;var m="opacity"!==g?"px":"";t.style[g]=c+m}o=+new Date,u?i&&i():window.requestAnimationFrame&&requestAnimationFrame(h)||setTimeout(h,32)};f()}var c=320;e.exports={toggle:l,animate:a,animated:s}},{}],3:[function(t,e,i){"use strict";function o(t,e){var i={};for(var o in t)i[o]=t[o];for(var o in e)i[o]=e[o];return i}function n(){var t=document.body,e=document.documentElement,i=Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight);return i}var r,s={animation:"fade",rehide:!1,content:"",cookie:null,icon:"&times",minimumScreenWidth:0,position:"center",testMode:!1,trigger:!1,closable:!0},l=t("./animator.js"),a=function(t,e){this.id=t,this.config=o(s,e),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.dismissed=!1,this.triggered=!1,this.triggerHeight=0,this.cookieSet=!1,this.element=null,this.closeIcon=null,this.config.trigger&&("percentage"!==this.config.trigger.method&&"element"!==this.config.trigger.method||(this.triggerHeight=this.calculateTriggerHeight()),this.cookieSet=this.isCookieSet()),this.dom(),this.events()};a.prototype.events=function(){var t=this;this.closeIcon&&this.closeIcon.addEventListener("click",this.dismiss.bind(this)),this.element.addEventListener("click",function(e){"A"===e.target.tagName&&r.trigger("box.interactions.link",[t,e.target])},!1),this.element.addEventListener("submit",function(e){t.setCookie(),r.trigger("box.interactions.form",[t,e.target])},!1),this.fits()&&this.locationHashRefersBox()&&window.addEventListener("load",this.show.bind(this))},a.prototype.dom=function(){var t=document.createElement("div");t.className="boxzilla-container boxzilla-"+this.config.position+"-container";var e=document.createElement("div");e.setAttribute("id","boxzilla-"+this.id),e.className="boxzilla boxzilla-"+this.id+" boxzilla-"+this.config.position,e.style.display="none",t.appendChild(e);var i=document.createElement("div");i.className="boxzilla-content",i.innerHTML=this.config.content,e.appendChild(i);var o=i.querySelectorAll("script");if(o.length){for(var n=document.createElement("script"),r=0;r<o.length;r++)n.appendChild(document.createTextNode(o[r].text)),o[r].parentNode.removeChild(o[r]);document.body.appendChild(n)}if(this.config.closable&&this.config.icon){var s=document.createElement("span");s.className="boxzilla-close-icon",s.innerHTML=this.config.icon,e.appendChild(s),this.closeIcon=s}document.body.appendChild(t),this.element=e},a.prototype.setCustomBoxStyling=function(){var t=this.element.style.display;this.element.style.display="",this.element.style.overflowY="auto",this.element.style.maxHeight="none";var e=window.innerHeight,i=this.element.clientHeight;if(i>e&&(this.element.style.maxHeight=e+"px",this.element.style.overflowY="scroll"),"center"===this.config.position){var o=(e-i)/2;o=o>=0?o:0,this.element.style.marginTop=o+"px"}this.element.style.display=t},a.prototype.toggle=function(t){return"undefined"==typeof t&&(t=!this.visible),t!==this.visible&&(!l.animated(this.element)&&(!(!t&&!this.config.closable)&&(this.visible=t,this.setCustomBoxStyling(),r.trigger("box."+(t?"show":"hide"),[this]),"center"===this.config.position&&(this.overlay.classList.toggle("boxzilla-"+this.id+"-overlay"),l.toggle(this.overlay,"fade")),l.toggle(this.element,this.config.animation),!0)))},a.prototype.show=function(){return this.toggle(!0)},a.prototype.hide=function(){return this.toggle(!1)},a.prototype.calculateTriggerHeight=function(){var t=0;if("element"===this.config.trigger.method){var e=document.body.querySelector(this.config.trigger.value);if(e){var i=e.getBoundingClientRect();t=i.top}}else"percentage"===this.config.trigger.method&&(t=this.config.trigger.value/100*n());return t},a.prototype.locationHashRefersBox=function(){if(!window.location.hash||0===window.location.hash.length)return!1;var t=window.location.hash.substring(1);return t===this.element.id||!!this.element.querySelector("#"+t)},a.prototype.fits=function(){return this.config.minimumScreenWidth<=0||window.innerWidth>this.config.minimumScreenWidth},a.prototype.mayAutoShow=function(){return!this.dismissed&&(!!this.fits()&&(!!this.config.trigger&&!this.cookieSet))},a.prototype.mayRehide=function(){return this.config.rehide&&this.triggered},a.prototype.isCookieSet=function(){if(this.config.testMode)return!1;if(!this.config.cookie||!this.config.cookie.triggered&&!this.config.cookie.dismissed)return!1;var t="true"===document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*boxzilla_box_"+this.id+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1");return t},a.prototype.setCookie=function(t){var e=new Date;e.setHours(e.getHours()+t),document.cookie="boxzilla_box_"+this.id+"=true; expires="+e.toUTCString()+"; path=/"},a.prototype.trigger=function(){var t=this.show();t&&(this.triggered=!0,this.config.cookie&&this.config.cookie.triggered&&this.setCookie(this.config.cookie.triggered))},a.prototype.dismiss=function(t){return t&&t.preventDefault(),!!this.visible&&(this.hide(),this.config.cookie&&this.config.cookie.dismissed&&this.setCookie(this.config.cookie.dismissed),this.dismissed=!0,r.trigger("box.dismiss",[this]),!0)},e.exports=function(t){return r=t,a}},{"./animator.js":2}],4:[function(t,e,i){"use strict";function o(t,e,i){e||(e=250);var o,n;return function(){var r=i||this,s=+new Date,l=arguments;o&&s<o+e?(clearTimeout(n),n=setTimeout(function(){o=s,t.apply(r,l)},e)):(o=s,t.apply(r,l))}}function n(t){27==t.keyCode&&z.dismiss()}function r(){h()||S.forEach(function(t){t.mayAutoShow()&&"pageviews"===t.config.trigger.method&&w>=t.config.trigger.value&&t.trigger()})}function s(){h()||S.forEach(function(t){t.mayAutoShow()&&("time_on_site"===t.config.trigger.method&&y.time>=t.config.trigger.value&&t.trigger(),"time_on_page"===t.config.trigger.method&&b.time>=t.config.trigger.value&&t.trigger())})}function l(){var t=k.hasOwnProperty("scrollY")?k.scrollY:k.scrollTop;t+=.75*window.innerHeight,console.log(t),S.forEach(function(e){if(e.mayAutoShow()&&!(e.triggerHeight<=0))if(t>e.triggerHeight){if(h())return;e.trigger()}else e.mayRehide()&&e.hide()})}function a(){S.forEach(function(t){t.setCustomBoxStyling()})}function c(t){var e=t.offsetX,i=t.offsetY;S.forEach(function(t){var o=t.element.getBoundingClientRect(),n=100+.05*window.innerWidth;(e<o.left-n||e>o.right+n||i<o.top-n||i>o.bottom+n)&&t.dismiss()})}function d(){v||h()||(S.forEach(function(t){t.mayAutoShow()&&"exit_intent"===t.config.trigger.method&&t.trigger()}),v=!0)}function f(t){var e=400;t.clientY<=0&&(p=window.setTimeout(d,e))}function h(){for(var t=0;t<S.length;t++){var e=S[t];if(e.visible)return!0}return!1}function u(){p&&(window.clearInterval(p),p=null)}function g(t){var e=t.target||t.srcElement;if(e&&"A"===e.tagName&&0===e.getAttribute("href").indexOf("#boxzilla-")){var i=t.target.getAttribute("href").substring("#boxzilla-".length);z.toggle(i)}}var m,p,v,y,b,w,x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E=t("wolfy87-eventemitter"),z=Object.create(E.prototype),L=t("./box.js")(z),_=t("./timer.js"),S=[],k=window,C={start:function(){try{var t=sessionStorage.getItem("boxzilla_timer");t&&(y.time=t)}catch(e){}y.start(),b.start()},stop:function(){sessionStorage.setItem("boxzilla_timer",y.time),y.stop(),b.stop()}};z.init=function(){document.body.addEventListener("click",g,!1);try{w=sessionStorage.getItem("boxzilla_pageviews")||0}catch(e){w=0}y=new _(0),b=new _(0);var i=t("./styles.js"),d=document.createElement("style");d.setAttribute("type","text/css"),d.innerHTML=i,document.head.appendChild(d),m=document.createElement("div"),m.style.display="none",m.id="boxzilla-overlay",document.body.appendChild(m),k.addEventListener("touchstart",o(l),!0),k.addEventListener("scroll",o(l),!0),window.addEventListener("resize",o(a)),window.addEventListener("load",a),m.addEventListener("click",c),window.setInterval(s,1e3),window.setTimeout(r,1e3),document.documentElement.addEventListener("mouseleave",f),document.documentElement.addEventListener("mouseenter",u),document.addEventListener("keyup",n),C.start(),window.addEventListener("focus",C.start),window.addEventListener("beforeunload",function(){C.stop(),sessionStorage.setItem("boxzilla_pageviews",++w)}),window.addEventListener("blur",C.stop),z.trigger("ready")},z.create=function(t,e){var i=new L(t,e);return S.push(i),i},z.get=function(t){for(var e=0;e<S.length;e++){var i=S[e];if(i.id==t)return i}throw new Error("No box exists with ID "+t)},z.dismiss=function(t){"undefined"==typeof t?S.forEach(function(t){t.dismiss()}):"object"===x(S[t])&&z.get(t).dismiss()},z.hide=function(t){"undefined"==typeof t?S.forEach(function(t){t.hide()}):z.get(t).hide()},z.show=function(t){"undefined"==typeof t?S.forEach(function(t){t.show()}):z.get(t).show()},z.toggle=function(t){"undefined"==typeof t?S.forEach(function(t){t.toggle()}):z.get(t).toggle()},z.boxes=S,window.Boxzilla=z,"undefined"!=typeof e&&e.exports&&(e.exports=z)},{"./box.js":3,"./styles.js":5,"./timer.js":6,"wolfy87-eventemitter":7}],5:[function(t,e,i){"use strict";var o="#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}";e.exports=o},{}],6:[function(t,e,i){"use strict";var o=function(t){this.time=t,this.interval=0};o.prototype.tick=function(){this.time++},o.prototype.start=function(){this.interval||(this.interval=window.setInterval(this.tick.bind(this),1e3))},o.prototype.stop=function(){this.interval&&(window.clearInterval(this.interval),this.interval=0)},e.exports=o},{}],7:[function(t,i,o){(function(){"use strict";function t(){}function o(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function n(t){return function(){return this[t].apply(this,arguments)}}var r=t.prototype,s=this,l=s.EventEmitter;r.getListeners=function(t){var e,i,o=this._getEvents();if(t instanceof RegExp){e={};for(i in o)o.hasOwnProperty(i)&&t.test(i)&&(e[i]=o[i])}else e=o[t]||(o[t]=[]);return e},r.flattenListeners=function(t){var e,i=[];for(e=0;e<t.length;e+=1)i.push(t[e].listener);return i},r.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&(e={},e[t]=i),e||i},r.addListener=function(t,e){var i,n=this.getListenersAsObject(t),r="object"==typeof e;for(i in n)n.hasOwnProperty(i)&&o(n[i],e)===-1&&n[i].push(r?e:{listener:e,once:!1});return this},r.on=n("addListener"),r.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},r.once=n("addOnceListener"),r.defineEvent=function(t){return this.getListeners(t),this},r.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},r.removeListener=function(t,e){var i,n,r=this.getListenersAsObject(t);for(n in r)r.hasOwnProperty(n)&&(i=o(r[n],e),i!==-1&&r[n].splice(i,1));return this},r.off=n("removeListener"),r.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},r.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},r.manipulateListeners=function(t,e,i){var o,n,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(o=i.length;o--;)r.call(this,e,i[o]);else for(o in e)e.hasOwnProperty(o)&&(n=e[o])&&("function"==typeof n?r.call(this,o,n):s.call(this,o,n));return this},r.removeEvent=function(t){var e,i=typeof t,o=this._getEvents();if("string"===i)delete o[t];else if(t instanceof RegExp)for(e in o)o.hasOwnProperty(e)&&t.test(e)&&delete o[e];else delete this._events;return this},r.removeAllListeners=n("removeEvent"),r.emitEvent=function(t,e){var i,o,n,r,s,l=this.getListenersAsObject(t);for(r in l)if(l.hasOwnProperty(r))for(i=l[r].slice(0),n=i.length;n--;)o=i[n],o.once===!0&&this.removeListener(t,o.listener),s=o.listener.apply(this,e||[]),s===this._getOnceReturnValue()&&this.removeListener(t,o.listener);return this},r.trigger=n("emitEvent"),r.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},r.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},r._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},r._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return s.EventEmitter=l,t},"function"==typeof e&&e.amd?e(function(){return t}):"object"==typeof i&&i.exports?i.exports=t:s.EventEmitter=t}).call(this)},{}]},{},[1])}();
2 2 //# sourceMappingURL=script.min.js.map