Version Description
Download this release
Release Info
Developer | DvanKooten |
Plugin | Boxzilla |
Version | 3.1.23 |
Comparing to | |
See all releases |
Code changes from version 3.1.22 to 3.1.23
- assets/js/admin-script.js +20 -8
- assets/js/admin-script.min.js +1 -1
- assets/js/admin-script.min.js.map +1 -1
- assets/js/script.js +1144 -1144
- assets/js/script.min.js +1 -1
- assets/js/script.min.js.map +1 -1
- boxzilla.php +2 -2
- readme.txt +10 -3
- src/admin/class-admin.php +13 -14
- src/default-actions.php +2 -2
assets/js/admin-script.js
CHANGED
@@ -331,13 +331,13 @@ module.exports = Option;
|
|
331 |
|
332 |
},{}],5:[function(require,module,exports){
|
333 |
/*!
|
334 |
-
* EventEmitter
|
335 |
* Unlicense - http://unlicense.org/
|
336 |
* Oliver Caldwell - http://oli.me.uk/
|
337 |
* @preserve
|
338 |
*/
|
339 |
|
340 |
-
;(function () {
|
341 |
'use strict';
|
342 |
|
343 |
/**
|
@@ -350,7 +350,6 @@ module.exports = Option;
|
|
350 |
|
351 |
// Shortcuts to improve speed and size
|
352 |
var proto = EventEmitter.prototype;
|
353 |
-
var exports = this;
|
354 |
var originalGlobalValue = exports.EventEmitter;
|
355 |
|
356 |
/**
|
@@ -451,6 +450,16 @@ module.exports = Option;
|
|
451 |
return response || listeners;
|
452 |
};
|
453 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
/**
|
455 |
* Adds a listener function to the specified event.
|
456 |
* The listener will not be added if it is a duplicate.
|
@@ -462,6 +471,10 @@ module.exports = Option;
|
|
462 |
* @return {Object} Current instance of EventEmitter for chaining.
|
463 |
*/
|
464 |
proto.addListener = function addListener(evt, listener) {
|
|
|
|
|
|
|
|
|
465 |
var listeners = this.getListenersAsObject(evt);
|
466 |
var listenerIsWrapped = typeof listener === 'object';
|
467 |
var key;
|
@@ -561,7 +574,7 @@ module.exports = Option;
|
|
561 |
|
562 |
/**
|
563 |
* Adds listeners in bulk using the manipulateListeners method.
|
564 |
-
* If you pass an object as the
|
565 |
* You can also pass it a regular expression to add the array of listeners to all events that match it.
|
566 |
* Yeah, this function does quite a bit. That's probably a bad thing.
|
567 |
*
|
@@ -576,7 +589,7 @@ module.exports = Option;
|
|
576 |
|
577 |
/**
|
578 |
* Removes listeners in bulk using the manipulateListeners method.
|
579 |
-
* If you pass an object as the
|
580 |
* You can also pass it an event name and an array of listeners to be removed.
|
581 |
* You can also pass it a regular expression to remove the listeners from all events that match it.
|
582 |
*
|
@@ -700,9 +713,8 @@ module.exports = Option;
|
|
700 |
for (key in listenersMap) {
|
701 |
if (listenersMap.hasOwnProperty(key)) {
|
702 |
listeners = listenersMap[key].slice(0);
|
703 |
-
i = listeners.length;
|
704 |
|
705 |
-
|
706 |
// If the listener returns true then it shall be removed from the event
|
707 |
// The function is executed either with a basic call or an apply if there is an args array
|
708 |
listener = listeners[i];
|
@@ -803,7 +815,7 @@ module.exports = Option;
|
|
803 |
else {
|
804 |
exports.EventEmitter = EventEmitter;
|
805 |
}
|
806 |
-
}
|
807 |
|
808 |
},{}]},{},[1]);
|
809 |
; })();
|
331 |
|
332 |
},{}],5:[function(require,module,exports){
|
333 |
/*!
|
334 |
+
* EventEmitter v5.2.4 - git.io/ee
|
335 |
* Unlicense - http://unlicense.org/
|
336 |
* Oliver Caldwell - http://oli.me.uk/
|
337 |
* @preserve
|
338 |
*/
|
339 |
|
340 |
+
;(function (exports) {
|
341 |
'use strict';
|
342 |
|
343 |
/**
|
350 |
|
351 |
// Shortcuts to improve speed and size
|
352 |
var proto = EventEmitter.prototype;
|
|
|
353 |
var originalGlobalValue = exports.EventEmitter;
|
354 |
|
355 |
/**
|
450 |
return response || listeners;
|
451 |
};
|
452 |
|
453 |
+
function isValidListener (listener) {
|
454 |
+
if (typeof listener === 'function' || listener instanceof RegExp) {
|
455 |
+
return true
|
456 |
+
} else if (listener && typeof listener === 'object') {
|
457 |
+
return isValidListener(listener.listener)
|
458 |
+
} else {
|
459 |
+
return false
|
460 |
+
}
|
461 |
+
}
|
462 |
+
|
463 |
/**
|
464 |
* Adds a listener function to the specified event.
|
465 |
* The listener will not be added if it is a duplicate.
|
471 |
* @return {Object} Current instance of EventEmitter for chaining.
|
472 |
*/
|
473 |
proto.addListener = function addListener(evt, listener) {
|
474 |
+
if (!isValidListener(listener)) {
|
475 |
+
throw new TypeError('listener must be a function');
|
476 |
+
}
|
477 |
+
|
478 |
var listeners = this.getListenersAsObject(evt);
|
479 |
var listenerIsWrapped = typeof listener === 'object';
|
480 |
var key;
|
574 |
|
575 |
/**
|
576 |
* Adds listeners in bulk using the manipulateListeners method.
|
577 |
+
* If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
|
578 |
* You can also pass it a regular expression to add the array of listeners to all events that match it.
|
579 |
* Yeah, this function does quite a bit. That's probably a bad thing.
|
580 |
*
|
589 |
|
590 |
/**
|
591 |
* Removes listeners in bulk using the manipulateListeners method.
|
592 |
+
* If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
593 |
* You can also pass it an event name and an array of listeners to be removed.
|
594 |
* You can also pass it a regular expression to remove the listeners from all events that match it.
|
595 |
*
|
713 |
for (key in listenersMap) {
|
714 |
if (listenersMap.hasOwnProperty(key)) {
|
715 |
listeners = listenersMap[key].slice(0);
|
|
|
716 |
|
717 |
+
for (i = 0; i < listeners.length; i++) {
|
718 |
// If the listener returns true then it shall be removed from the event
|
719 |
// The function is executed either with a basic call or an apply if there is an args array
|
720 |
listener = listeners[i];
|
815 |
else {
|
816 |
exports.EventEmitter = EventEmitter;
|
817 |
}
|
818 |
+
}(this || {}));
|
819 |
|
820 |
},{}]},{},[1]);
|
821 |
; })();
|
assets/js/admin-script.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
!function(){var e=void 0,t=void 0;!function n
|
2 |
//# sourceMappingURL=admin-script.min.js.map
|
1 |
+
!function(){var e=void 0,t=void 0;!function t(n,r,o){function i(s,a){if(!r[s]){if(!n[s]){var u="function"==typeof e&&e;if(!a&&u)return u(s,!0);if(l)return l(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var p=r[s]={exports:{}};n[s][0].call(p.exports,function(e){var t=n[s][1][e];return i(t||e)},p,p.exports,t,n,r,o)}return r[s].exports}for(var l="function"==typeof e&&e,s=0;s<o.length;s++)i(o[s]);return i}({1:[function(e,t,n){"use strict";window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(e,t,n){"use strict";!function(){function n(){var e="tr"===this.tagName.toLowerCase()?this:r(this).parents("tr").get(0),t=e.querySelector(".boxzilla-rule-condition").value,n=e.querySelector(".boxzilla-rule-value"),o=e.querySelector(".boxzilla-rule-qualifier"),i=n.cloneNode(!0),l=r(i);switch(r(e.querySelectorAll(".boxzilla-helper")).remove(),i.removeAttribute("name"),i.className=i.className+" boxzilla-helper",n.parentNode.insertBefore(i,n.nextSibling),l.change(function(){n.value=this.value}),i.style.display="",n.style.display="none",o.style.display="",s.parentNode&&s.parentNode.removeChild(s),t){default:i.placeholder=p.enterCommaSeparatedValues;break;case"":case"everywhere":o.value="1",n.value="",i.style.display="none",o.style.display="none";break;case"is_single":case"is_post":i.placeholder=p.enterCommaSeparatedPosts,l.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":i.placeholder=p.enterCommaSeparatedPages,l.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":i.placeholder=p.enterCommaSeparatedPostTypes,l.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":i.placeholder=p.enterCommaSeparatedRelativeUrls;break;case"is_post_in_category":l.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=category",{multiple:!0,multipleSep:","});break;case"is_post_with_tag":l.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_tag",{multiple:!0,multipleSep:","});break;case"is_user_logged_in":i.style.display="none",n.parentNode.insertBefore(s,n.nextSibling)}}var r=window.jQuery,o=e("./_option.js"),i=document.getElementById("boxzilla-box-options-controls"),l=r(i),s=document.createTextNode(" logged in");if(0!==l.length){var a=new(e("wolfy87-eventemitter")),u=e("./_designer.js")(r,o,a),c=wp.template("rule-row-template"),p=boxzilla_i18n;l.on("click",".boxzilla-add-rule",function(){var e={key:i.querySelectorAll(".boxzilla-rule-row").length},t=c(e);return r(document.getElementById("boxzilla-box-rules")).after(t),!1}),l.on("click",".boxzilla-remove-rule",function(){r(this).parents("tr").remove()}),l.on("change",".boxzilla-rule-condition",n),l.find(".boxzilla-auto-show-trigger").on("change",function(){l.find(".boxzilla-trigger-options").toggle(""!==this.value)}),r(window).load(function(){void 0===window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),r(".boxzilla-rule-row").each(n),t.exports={Designer:u,Option:o,events:a}}}()},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.exports=function(e,t,n){function o(){return!!c&&(s.css({"border-color":u.borderColor.getColorValue(),"border-width":u.borderWidth.getPxValue(),"border-style":u.borderStyle.getValue(),"background-color":u.backgroundColor.getColorValue(),width:u.width.getPxValue(),color:u.color.getColorValue()}),n.trigger("editor.styles.apply"),!0)}var i,l,s,a=document.getElementById("post_ID").value||0,u={},c=!1,p=e("#boxzilla-box-appearance-controls");return u.borderColor=new t("border-color"),u.borderWidth=new t("border-width"),u.borderStyle=new t("border-style"),u.backgroundColor=new t("background-color"),u.width=new t("width"),u.color=new t("color"),p.find("input.boxzilla-color-field").wpColorPicker({change:o,clear:o}),p.find(":input").not(".boxzilla-color-field").change(o),n.on("editor.init",o),{init:function(){"object"===r(window.tinyMCE)&&null!==tinyMCE.get("content")&&(l=e("#content_ifr"),(i=l.contents().find("html")).css({background:"white"}),(s=i.find("#tinymce")).addClass("boxzilla boxzilla-"+a),s.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),s.get(0).style.cssText+=";padding: 25px !important;",c=!0,n.trigger("editor.init"))},resetStyles:function(){for(var e in u)"theme"!==e.substring(0,5)&&u[e].clear();o(),n.trigger("editor.styles.reset")},options:u}}},{}],4:[function(e,t,n){"use strict";var r=window.jQuery,o=function(e){"string"==typeof e&&(e=document.getElementById("boxzilla-"+e)),e||console.error("Unable to find option element."),this.element=e};o.prototype.getColorValue=function(){return this.element.value.length>0?r(this.element).hasClass("wp-color-field")?r(this.element).wpColorPicker("color"):this.element.value:""},o.prototype.getPxValue=function(e){return this.element.value.length>0?parseInt(this.element.value)+"px":e||""},o.prototype.getValue=function(e){return this.element.value.length>0?this.element.value:e||""},o.prototype.clear=function(){this.element.value=""},o.prototype.setValue=function(e){this.element.value=e},t.exports=o},{}],5:[function(e,n,r){!function(e){"use strict";function r(){}function o(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function i(e){return function(){return this[e].apply(this,arguments)}}function l(e){return"function"==typeof e||e instanceof RegExp||!(!e||"object"!=typeof e)&&l(e.listener)}var s=r.prototype,a=e.EventEmitter;s.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},s.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},s.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&((t={})[e]=n),t||n},s.addListener=function(e,t){if(!l(t))throw new TypeError("listener must be a function");var n,r=this.getListenersAsObject(e),i="object"==typeof t;for(n in r)r.hasOwnProperty(n)&&-1===o(r[n],t)&&r[n].push(i?t:{listener:t,once:!1});return this},s.on=i("addListener"),s.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},s.once=i("addOnceListener"),s.defineEvent=function(e){return this.getListeners(e),this},s.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},s.removeListener=function(e,t){var n,r,i=this.getListenersAsObject(e);for(r in i)i.hasOwnProperty(r)&&-1!==(n=o(i[r],t))&&i[r].splice(n,1);return this},s.off=i("removeListener"),s.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},s.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},s.manipulateListeners=function(e,t,n){var r,o,i=e?this.removeListener:this.addListener,l=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)i.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(o=t[r])&&("function"==typeof o?i.call(this,r,o):l.call(this,r,o));return this},s.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},s.removeAllListeners=i("removeEvent"),s.emitEvent=function(e,t){var n,r,o,i,l=this.getListenersAsObject(e);for(i in l)if(l.hasOwnProperty(i))for(n=l[i].slice(0),o=0;o<n.length;o++)!0===(r=n[o]).once&&this.removeListener(e,r.listener),r.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},s.trigger=i("emitEvent"),s.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},s.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},s._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},s._getEvents=function(){return this._events||(this._events={})},r.noConflict=function(){return e.EventEmitter=a,r},"function"==typeof t&&t.amd?t(function(){return r}):"object"==typeof n&&n.exports?n.exports=r:e.EventEmitter=r}(this||{})},{}]},{},[1])}();
|
2 |
//# sourceMappingURL=admin-script.min.js.map
|
assets/js/admin-script.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["admin-script.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","window","Boxzilla_Admin","./admin/_admin.js","2","toggleTriggerOptions","$optionControls","find","toggle","this","value","removeRule","$","parents","remove","setContextualHelpers","context","tagName","toLowerCase","get","condition","querySelector","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","querySelectorAll","removeAttribute","className","parentNode","insertBefore","nextSibling","change","style","display","tnLoggedIn","removeChild","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","addRuleFields","data","key","optionControls","html","rowTemplate","document","getElementById","after","jQuery","Option","createTextNode","EventEmitter","events","Designer","wp","template","boxzilla_i18n","on","load","tinyMCE","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","_typeof","Symbol","iterator","obj","constructor","prototype","init","$editorFrame","$editor","contents","css","background","$innerEditor","addClass","boxId","margin","width","min-width","position","cssText","visualEditorInitialised","trigger","applyStyles","border-color","options","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","color","resetStyles","substring","clear","$appearanceControls","wpColorPicker","not","4","element","console","error","hasClass","fallbackValue","parseInt","setValue","5","indexOfListener","listeners","listener","alias","name","apply","arguments","proto","originalGlobalValue","getListeners","evt","response","_getEvents","RegExp","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAgEC,EAASD,QAAW,QAAUE,G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C,KAAKrF,IAAOqH,GACR,GAAIA,EAAa5B,eAAezF,GAI5B,IAHA4E,EAAYyC,EAAarH,GAAKsH,MAAM,GACpClL,EAAIwI,EAAUjI,OAEPP,KAGHyI,EAAWD,EAAUxI,GAEjByI,EAASqB,QAAS,GAClB5I,KAAKiJ,eAAelB,EAAKR,EAASA,UAGtCS,EAAWT,EAASA,SAASG,MAAM1H,KAAM8J,OAErC9B,IAAahI,KAAKiK,uBAClBjK,KAAKiJ,eAAelB,EAAKR,EAASA,SAMlD,OAAOvH,OAMX4H,EAAMrC,QAAUiC,EAAM,aAUtBI,EAAMsC,KAAO,SAAcnC,GACvB,GAAI+B,GAAOrB,MAAMlE,UAAUyF,MAAM5K,KAAKuI,UAAW,EACjD,OAAO3H,MAAK6J,UAAU9B,EAAK+B,IAW/BlC,EAAMuC,mBAAqB,SAA4BlK,GAEnD,MADAD,MAAKoK,iBAAmBnK,EACjBD,MAWX4H,EAAMqC,oBAAsB,WACxB,OAAIjK,KAAKmI,eAAe,qBACbnI,KAAKoK,kBAapBxC,EAAMK,WAAa,WACf,MAAOjI,MAAK2J,UAAY3J,KAAK2J,aAQjCvG,EAAaiH,WAAa,WAEtB,MADAlL,GAAQiE,aAAeyE,EAChBzE,GAIW,kBAAX/E,IAAyBA,EAAOiM,IACvCjM,EAAO,WACH,MAAO+E,KAGY,gBAAX7D,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUiE,EAGjBjE,EAAQiE,aAAeA,IAE7BhE,KAAKY,gBAEI","file":"admin-script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\nwindow.Boxzilla_Admin = require('./admin/_admin.js');\n\n},{\"./admin/_admin.js\":2}],2:[function(require,module,exports){\n'use strict';\n\n(function () {\n 'use strict';\n\n var $ = window.jQuery;\n var Option = require('./_option.js');\n var optionControls = document.getElementById('boxzilla-box-options-controls');\n var $optionControls = $(optionControls);\n var tnLoggedIn = document.createTextNode(' logged in');\n\n // sanity check, are we on the correct page?\n if ($optionControls.length === 0) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter');\n var events = new EventEmitter();\n var Designer = require('./_designer.js')($, Option, events);\n var rowTemplate = wp.template('rule-row-template');\n var i18n = boxzilla_i18n;\n\n // events\n $optionControls.on('click', \".boxzilla-add-rule\", addRuleFields);\n $optionControls.on('click', \".boxzilla-remove-rule\", removeRule);\n $optionControls.on('change', \".boxzilla-rule-condition\", setContextualHelpers);\n $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);\n\n $(window).load(function () {\n if (typeof window.tinyMCE === \"undefined\") {\n document.getElementById('notice-notinymce').style.display = '';\n }\n });\n\n // call contextual helper method for each row\n $('.boxzilla-rule-row').each(setContextualHelpers);\n\n function toggleTriggerOptions() {\n $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n }\n\n function removeRule() {\n $(this).parents('tr').remove();\n }\n\n function setContextualHelpers() {\n var context = this.tagName.toLowerCase() === \"tr\" ? this : $(this).parents('tr').get(0);\n var condition = context.querySelector('.boxzilla-rule-condition').value;\n var valueInput = context.querySelector('.boxzilla-rule-value');\n var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n var betterInput = valueInput.cloneNode(true);\n var $betterInput = $(betterInput);\n\n // remove previously added helpers\n $(context.querySelectorAll('.boxzilla-helper')).remove();\n\n // prepare better input\n betterInput.removeAttribute('name');\n betterInput.className = betterInput.className + ' boxzilla-helper';\n valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n $betterInput.change(function () {\n valueInput.value = this.value;\n });\n\n betterInput.style.display = '';\n valueInput.style.display = 'none';\n qualifierInput.style.display = '';\n if (tnLoggedIn.parentNode) {\n tnLoggedIn.parentNode.removeChild(tnLoggedIn);\n }\n\n // change placeholder for textual help\n switch (condition) {\n default:\n betterInput.placeholder = i18n.enterCommaSeparatedValues;\n break;\n\n case '':\n case 'everywhere':\n qualifierInput.value = '1';\n valueInput.value = '';\n betterInput.style.display = 'none';\n qualifierInput.style.display = 'none';\n break;\n\n case 'is_single':\n case 'is_post':\n betterInput.placeholder = i18n.enterCommaSeparatedPosts;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_page':\n betterInput.placeholder = i18n.enterCommaSeparatedPages;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_type':\n betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_url':\n betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n break;\n\n case 'is_post_in_category':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_with_tag':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_user_logged_in':\n betterInput.style.display = 'none';\n valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);\n break;\n\n }\n }\n\n function addRuleFields() {\n var data = {\n 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length\n };\n var html = rowTemplate(data);\n $(document.getElementById('boxzilla-box-rules')).after(html);\n return false;\n }\n\n module.exports = {\n 'Designer': Designer,\n 'Option': Option,\n 'events': events\n };\n})();\n\n},{\"./_designer.js\":3,\"./_option.js\":4,\"wolfy87-eventemitter\":5}],3:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar Designer = function Designer($, Option, events) {\n\n\t// vars\n\tvar boxId = document.getElementById('post_ID').value || 0,\n\t $editor,\n\t $editorFrame,\n\t $innerEditor,\n\t options = {},\n\t visualEditorInitialised = false;\n\n\tvar $appearanceControls = $(\"#boxzilla-box-appearance-controls\");\n\n\t// create Option objects\n\toptions.borderColor = new Option('border-color');\n\toptions.borderWidth = new Option('border-width');\n\toptions.borderStyle = new Option('border-style');\n\toptions.backgroundColor = new Option('background-color');\n\toptions.width = new Option('width');\n\toptions.color = new Option('color');\n\n\t// functions\n\tfunction init() {\n\n\t\t// Only run if TinyMCE has actually inited\n\t\tif (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// add classes to TinyMCE <html>\n\t\t$editorFrame = $(\"#content_ifr\");\n\t\t$editor = $editorFrame.contents().find('html');\n\t\t$editor.css({\n\t\t\t'background': 'white'\n\t\t});\n\n\t\t// add content class and padding to TinyMCE <body>\n\t\t$innerEditor = $editor.find('#tinymce');\n\t\t$innerEditor.addClass('boxzilla boxzilla-' + boxId);\n\t\t$innerEditor.css({\n\t\t\t'margin': 0,\n\t\t\t'background': 'white',\n\t\t\t'display': 'inline-block',\n\t\t\t'width': 'auto',\n\t\t\t'min-width': '240px',\n\t\t\t'position': 'relative'\n\t\t});\n\t\t$innerEditor.get(0).style.cssText += ';padding: 25px !important;';\n\n\t\tvisualEditorInitialised = true;\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.init');\n\t}\n\n\t/**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n\tfunction applyStyles() {\n\n\t\tif (!visualEditorInitialised) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// apply styles from CSS editor\n\t\t$innerEditor.css({\n\t\t\t'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),\n\t\t\t'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),\n\t\t\t'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),\n\t\t\t'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),\n\t\t\t'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),\n\t\t\t'color': options.color.getColorValue() // getColorValue( 'color', '' )\n\t\t});\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.apply');\n\n\t\treturn true;\n\t}\n\n\tfunction resetStyles() {\n\t\tfor (var key in options) {\n\t\t\tif (key.substring(0, 5) === 'theme') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toptions[key].clear();\n\t\t}\n\t\tapplyStyles();\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.reset');\n\t}\n\n\t// event binders\n\t$appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });\n\t$appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n\tevents.on('editor.init', applyStyles);\n\n\t// public methods\n\treturn {\n\t\t'init': init,\n\t\t'resetStyles': resetStyles,\n\t\t'options': options\n\t};\n};\n\nmodule.exports = Designer;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\n\nvar Option = function Option(element) {\n\n\t// find corresponding element\n\tif (typeof element == \"string\") {\n\t\telement = document.getElementById('boxzilla-' + element);\n\t}\n\n\tif (!element) {\n\t\tconsole.error(\"Unable to find option element.\");\n\t}\n\n\tthis.element = element;\n};\n\nOption.prototype.getColorValue = function () {\n\tif (this.element.value.length > 0) {\n\t\tif ($(this.element).hasClass('wp-color-field')) {\n\t\t\treturn $(this.element).wpColorPicker('color');\n\t\t} else {\n\t\t\treturn this.element.value;\n\t\t}\n\t}\n\n\treturn '';\n};\n\nOption.prototype.getPxValue = function (fallbackValue) {\n\tif (this.element.value.length > 0) {\n\t\treturn parseInt(this.element.value) + \"px\";\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.getValue = function (fallbackValue) {\n\n\tif (this.element.value.length > 0) {\n\t\treturn this.element.value;\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.clear = function () {\n\tthis.element.value = '';\n};\n\nOption.prototype.setValue = function (value) {\n\tthis.element.value = value;\n};\n\nmodule.exports = Option;\n\n},{}],5:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}]},{},[1]);\n; })();"]}
|
1 |
+
{"version":3,"sources":["admin-script.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","window","Boxzilla_Admin","./admin/_admin.js","2","setContextualHelpers","context","this","tagName","toLowerCase","$","parents","get","condition","querySelector","value","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","querySelectorAll","remove","removeAttribute","className","parentNode","insertBefore","nextSibling","change","style","display","tnLoggedIn","removeChild","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","jQuery","Option","optionControls","document","getElementById","$optionControls","createTextNode","events","Designer","rowTemplate","wp","template","boxzilla_i18n","on","data","key","html","after","find","toggle","load","tinyMCE","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","_typeof","Symbol","iterator","obj","constructor","prototype","applyStyles","visualEditorInitialised","$innerEditor","css","border-color","options","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","width","color","trigger","$editor","$editorFrame","boxId","$appearanceControls","wpColorPicker","clear","not","init","contents","background","addClass","margin","min-width","position","cssText","resetStyles","substring","4","element","console","error","hasClass","fallbackValue","parseInt","setValue","5","EventEmitter","indexOfListener","listeners","listener","alias","name","apply","arguments","isValidListener","RegExp","proto","originalGlobalValue","getListeners","evt","response","_getEvents","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","TypeError","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"CAAA,WAAe,IAAIA,OAAUC,EAAgEC,OAASD,GAAW,SAAUE,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAkB,mBAATV,GAAqBA,EAAQ,IAAIS,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EAAEG,IAAIQ,YAAYZ,EAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,IAAIE,EAAED,EAAEI,GAAG,GAAGL,GAAG,OAAOI,EAAEF,GAAIF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGQ,QAAkD,IAAI,IAA1CL,EAAkB,mBAATX,GAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAAvb,EAA4bY,GAAG,SAASnB,EAAQoB,EAAOJ,GACxkB,aAEAK,OAAOC,eAAiBtB,EAAQ,uBAE7BuB,oBAAoB,IAAIC,GAAG,SAASxB,EAAQoB,EAAOJ,GACtD,cAEA,WA2CI,SAASS,IACL,IAAIC,EAAyC,OAA/BC,KAAKC,QAAQC,cAAyBF,KAAOG,EAAEH,MAAMI,QAAQ,MAAMC,IAAI,GACjFC,EAAYP,EAAQQ,cAAc,4BAA4BC,MAC9DC,EAAaV,EAA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eA,EA5d9B,CA8dCnH,oBAES,IAnzBX","file":"admin-script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\nwindow.Boxzilla_Admin = require('./admin/_admin.js');\n\n},{\"./admin/_admin.js\":2}],2:[function(require,module,exports){\n'use strict';\n\n(function () {\n 'use strict';\n\n var $ = window.jQuery;\n var Option = require('./_option.js');\n var optionControls = document.getElementById('boxzilla-box-options-controls');\n var $optionControls = $(optionControls);\n var tnLoggedIn = document.createTextNode(' logged in');\n\n // sanity check, are we on the correct page?\n if ($optionControls.length === 0) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter');\n var events = new EventEmitter();\n var Designer = require('./_designer.js')($, Option, events);\n var rowTemplate = wp.template('rule-row-template');\n var i18n = boxzilla_i18n;\n\n // events\n $optionControls.on('click', \".boxzilla-add-rule\", addRuleFields);\n $optionControls.on('click', \".boxzilla-remove-rule\", removeRule);\n $optionControls.on('change', \".boxzilla-rule-condition\", setContextualHelpers);\n $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);\n\n $(window).load(function () {\n if (typeof window.tinyMCE === \"undefined\") {\n document.getElementById('notice-notinymce').style.display = '';\n }\n });\n\n // call contextual helper method for each row\n $('.boxzilla-rule-row').each(setContextualHelpers);\n\n function toggleTriggerOptions() {\n $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n }\n\n function removeRule() {\n $(this).parents('tr').remove();\n }\n\n function setContextualHelpers() {\n var context = this.tagName.toLowerCase() === \"tr\" ? this : $(this).parents('tr').get(0);\n var condition = context.querySelector('.boxzilla-rule-condition').value;\n var valueInput = context.querySelector('.boxzilla-rule-value');\n var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n var betterInput = valueInput.cloneNode(true);\n var $betterInput = $(betterInput);\n\n // remove previously added helpers\n $(context.querySelectorAll('.boxzilla-helper')).remove();\n\n // prepare better input\n betterInput.removeAttribute('name');\n betterInput.className = betterInput.className + ' boxzilla-helper';\n valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n $betterInput.change(function () {\n valueInput.value = this.value;\n });\n\n betterInput.style.display = '';\n valueInput.style.display = 'none';\n qualifierInput.style.display = '';\n if (tnLoggedIn.parentNode) {\n tnLoggedIn.parentNode.removeChild(tnLoggedIn);\n }\n\n // change placeholder for textual help\n switch (condition) {\n default:\n betterInput.placeholder = i18n.enterCommaSeparatedValues;\n break;\n\n case '':\n case 'everywhere':\n qualifierInput.value = '1';\n valueInput.value = '';\n betterInput.style.display = 'none';\n qualifierInput.style.display = 'none';\n break;\n\n case 'is_single':\n case 'is_post':\n betterInput.placeholder = i18n.enterCommaSeparatedPosts;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_page':\n betterInput.placeholder = i18n.enterCommaSeparatedPages;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_type':\n betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_url':\n betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n break;\n\n case 'is_post_in_category':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_with_tag':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_user_logged_in':\n betterInput.style.display = 'none';\n valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);\n break;\n\n }\n }\n\n function addRuleFields() {\n var data = {\n 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length\n };\n var html = rowTemplate(data);\n $(document.getElementById('boxzilla-box-rules')).after(html);\n return false;\n }\n\n module.exports = {\n 'Designer': Designer,\n 'Option': Option,\n 'events': events\n };\n})();\n\n},{\"./_designer.js\":3,\"./_option.js\":4,\"wolfy87-eventemitter\":5}],3:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar Designer = function Designer($, Option, events) {\n\n\t// vars\n\tvar boxId = document.getElementById('post_ID').value || 0,\n\t $editor,\n\t $editorFrame,\n\t $innerEditor,\n\t options = {},\n\t visualEditorInitialised = false;\n\n\tvar $appearanceControls = $(\"#boxzilla-box-appearance-controls\");\n\n\t// create Option objects\n\toptions.borderColor = new Option('border-color');\n\toptions.borderWidth = new Option('border-width');\n\toptions.borderStyle = new Option('border-style');\n\toptions.backgroundColor = new Option('background-color');\n\toptions.width = new Option('width');\n\toptions.color = new Option('color');\n\n\t// functions\n\tfunction init() {\n\n\t\t// Only run if TinyMCE has actually inited\n\t\tif (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// add classes to TinyMCE <html>\n\t\t$editorFrame = $(\"#content_ifr\");\n\t\t$editor = $editorFrame.contents().find('html');\n\t\t$editor.css({\n\t\t\t'background': 'white'\n\t\t});\n\n\t\t// add content class and padding to TinyMCE <body>\n\t\t$innerEditor = $editor.find('#tinymce');\n\t\t$innerEditor.addClass('boxzilla boxzilla-' + boxId);\n\t\t$innerEditor.css({\n\t\t\t'margin': 0,\n\t\t\t'background': 'white',\n\t\t\t'display': 'inline-block',\n\t\t\t'width': 'auto',\n\t\t\t'min-width': '240px',\n\t\t\t'position': 'relative'\n\t\t});\n\t\t$innerEditor.get(0).style.cssText += ';padding: 25px !important;';\n\n\t\tvisualEditorInitialised = true;\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.init');\n\t}\n\n\t/**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n\tfunction applyStyles() {\n\n\t\tif (!visualEditorInitialised) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// apply styles from CSS editor\n\t\t$innerEditor.css({\n\t\t\t'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),\n\t\t\t'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),\n\t\t\t'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),\n\t\t\t'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),\n\t\t\t'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),\n\t\t\t'color': options.color.getColorValue() // getColorValue( 'color', '' )\n\t\t});\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.apply');\n\n\t\treturn true;\n\t}\n\n\tfunction resetStyles() {\n\t\tfor (var key in options) {\n\t\t\tif (key.substring(0, 5) === 'theme') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toptions[key].clear();\n\t\t}\n\t\tapplyStyles();\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.reset');\n\t}\n\n\t// event binders\n\t$appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });\n\t$appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n\tevents.on('editor.init', applyStyles);\n\n\t// public methods\n\treturn {\n\t\t'init': init,\n\t\t'resetStyles': resetStyles,\n\t\t'options': options\n\t};\n};\n\nmodule.exports = Designer;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\n\nvar Option = function Option(element) {\n\n\t// find corresponding element\n\tif (typeof element == \"string\") {\n\t\telement = document.getElementById('boxzilla-' + element);\n\t}\n\n\tif (!element) {\n\t\tconsole.error(\"Unable to find option element.\");\n\t}\n\n\tthis.element = element;\n};\n\nOption.prototype.getColorValue = function () {\n\tif (this.element.value.length > 0) {\n\t\tif ($(this.element).hasClass('wp-color-field')) {\n\t\t\treturn $(this.element).wpColorPicker('color');\n\t\t} else {\n\t\t\treturn this.element.value;\n\t\t}\n\t}\n\n\treturn '';\n};\n\nOption.prototype.getPxValue = function (fallbackValue) {\n\tif (this.element.value.length > 0) {\n\t\treturn parseInt(this.element.value) + \"px\";\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.getValue = function (fallbackValue) {\n\n\tif (this.element.value.length > 0) {\n\t\treturn this.element.value;\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.clear = function () {\n\tthis.element.value = '';\n};\n\nOption.prototype.setValue = function (value) {\n\tthis.element.value = value;\n};\n\nmodule.exports = Option;\n\n},{}],5:[function(require,module,exports){\n/*!\n * EventEmitter v5.2.4 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function (exports) {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n function isValidListener (listener) {\n if (typeof listener === 'function' || listener instanceof RegExp) {\n return true\n } else if (listener && typeof listener === 'object') {\n return isValidListener(listener.listener)\n } else {\n return false\n }\n }\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n if (!isValidListener(listener)) {\n throw new TypeError('listener must be a function');\n }\n\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n\n for (i = 0; i < listeners.length; i++) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}(this || {}));\n\n},{}]},{},[1]);\n; })();"]}
|
assets/js/script.js
CHANGED
@@ -164,1379 +164,1379 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
|
|
164 |
window.setTimeout(createBoxesFromConfig, 1);
|
165 |
})();
|
166 |
|
167 |
-
},{"boxzilla":
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
element.style[property] = styles[property];
|
175 |
-
}
|
176 |
-
}
|
177 |
-
|
178 |
-
function initObjectProperties(properties, value) {
|
179 |
-
var newObject = {};
|
180 |
-
for (var i = 0; i < properties.length; i++) {
|
181 |
-
newObject[properties[i]] = value;
|
182 |
-
}
|
183 |
-
return newObject;
|
184 |
-
}
|
185 |
|
186 |
-
function
|
187 |
-
|
188 |
-
for (var i = 0; i < properties.length; i++) {
|
189 |
-
newObject[properties[i]] = object[properties[i]];
|
190 |
-
}
|
191 |
-
return newObject;
|
192 |
-
}
|
193 |
|
194 |
-
/**
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
function
|
201 |
-
return !!element.getAttribute('data-animated');
|
202 |
-
}
|
203 |
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
* @param animation Either "fade" or "slide"
|
209 |
-
*/
|
210 |
-
function toggle(element, animation, callbackFn) {
|
211 |
-
var nowVisible = element.style.display != 'none' || element.offsetLeft > 0;
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
222 |
-
};
|
223 |
-
|
224 |
-
// store attribute so everyone knows we're animating this element
|
225 |
-
element.setAttribute('data-animated', "true");
|
226 |
|
227 |
-
|
228 |
-
if (!nowVisible) {
|
229 |
-
element.style.display = '';
|
230 |
}
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
-
css(element, hiddenStyles);
|
249 |
}
|
250 |
-
|
251 |
-
|
252 |
-
element.style.overflowY = 'hidden';
|
253 |
-
animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);
|
254 |
-
} else {
|
255 |
-
hiddenStyles = { opacity: 0 };
|
256 |
-
visibleStyles = { opacity: 1 };
|
257 |
-
if (!nowVisible) {
|
258 |
-
css(element, hiddenStyles);
|
259 |
}
|
260 |
|
261 |
-
|
262 |
-
}
|
263 |
-
}
|
264 |
-
|
265 |
-
function animate(element, targetStyles, fn) {
|
266 |
-
var last = +new Date();
|
267 |
-
var initialStyles = window.getComputedStyle(element);
|
268 |
-
var currentStyles = {};
|
269 |
-
var propSteps = {};
|
270 |
-
|
271 |
-
for (var property in targetStyles) {
|
272 |
-
// make sure we have an object filled with floats
|
273 |
-
targetStyles[property] = parseFloat(targetStyles[property]);
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
|
279 |
-
|
280 |
-
|
281 |
-
delete targetStyles[property];
|
282 |
-
continue;
|
283 |
}
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
}
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
|
|
|
|
|
|
|
|
|
|
293 |
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
increment = step * timeSinceLastTick;
|
299 |
-
newValue = currentStyles[property] + increment;
|
300 |
|
301 |
-
|
302 |
-
|
303 |
-
} else {
|
304 |
-
done = false;
|
305 |
-
}
|
306 |
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
|
310 |
-
|
311 |
-
|
|
|
|
|
|
|
|
|
|
|
312 |
}
|
313 |
|
314 |
-
|
315 |
-
|
316 |
-
// keep going until we're done for all props
|
317 |
-
if (!done) {
|
318 |
-
window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);
|
319 |
-
} else {
|
320 |
-
// call callback
|
321 |
-
fn && fn();
|
322 |
-
}
|
323 |
};
|
324 |
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
'toggle': toggle,
|
330 |
-
'animate': animate,
|
331 |
-
'animated': animated
|
332 |
-
};
|
333 |
|
334 |
-
|
335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
'cookie': null,
|
342 |
-
'icon': '×',
|
343 |
-
'screenWidthCondition': null,
|
344 |
-
'position': 'center',
|
345 |
-
'testMode': false,
|
346 |
-
'trigger': false,
|
347 |
-
'closable': true
|
348 |
-
},
|
349 |
-
Boxzilla,
|
350 |
-
Animator = require('./animator.js');
|
351 |
|
352 |
-
/**
|
353 |
-
*
|
354 |
-
*
|
355 |
-
*
|
356 |
-
* @param
|
357 |
-
* @
|
358 |
-
*/
|
359 |
-
function
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
}
|
364 |
-
for (var attrname in obj2) {
|
365 |
-
obj3[attrname] = obj2[attrname];
|
366 |
-
}
|
367 |
-
return obj3;
|
368 |
-
}
|
369 |
|
370 |
-
/**
|
371 |
-
*
|
372 |
-
*
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
|
|
|
|
|
|
|
|
|
|
377 |
|
378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
|
380 |
-
|
381 |
-
|
|
|
382 |
|
383 |
-
|
384 |
-
|
385 |
-
|
|
|
|
|
386 |
|
387 |
-
|
388 |
-
|
389 |
|
390 |
-
|
391 |
-
|
|
|
|
|
392 |
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
|
|
|
|
|
|
|
|
|
|
402 |
|
403 |
-
|
404 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
|
406 |
-
|
407 |
-
|
408 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
|
410 |
-
//
|
411 |
-
|
412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
|
414 |
-
|
415 |
-
|
416 |
-
this.closeIcon.addEventListener('click', this.dismiss.bind(this));
|
417 |
-
}
|
418 |
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
|
431 |
-
|
432 |
-
|
433 |
-
var wrapper = document.createElement('div');
|
434 |
-
wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';
|
435 |
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
|
|
441 |
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
446 |
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
box.appendChild(closeIcon);
|
452 |
-
this.closeIcon = closeIcon;
|
453 |
-
}
|
454 |
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
|
460 |
-
|
461 |
-
|
|
|
462 |
|
463 |
-
|
464 |
-
var origDisplay = this.element.style.display;
|
465 |
-
this.element.style.display = '';
|
466 |
-
this.element.style.overflowY = 'auto';
|
467 |
-
this.element.style.maxHeight = 'none';
|
468 |
|
469 |
-
|
470 |
-
|
471 |
-
|
|
|
|
|
|
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
this.element.style.maxHeight = windowHeight + "px";
|
476 |
-
this.element.style.overflowY = 'scroll';
|
477 |
-
}
|
478 |
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
this.element.style.marginTop = newTopMargin + "px";
|
484 |
-
}
|
485 |
|
486 |
-
|
487 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
|
489 |
-
|
490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
491 |
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
|
|
|
|
|
|
|
|
|
|
501 |
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
|
|
|
|
|
|
|
|
|
|
506 |
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
|
512 |
-
|
513 |
-
|
514 |
|
515 |
-
|
516 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
|
518 |
-
|
519 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
|
521 |
-
|
522 |
-
|
523 |
-
this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');
|
524 |
-
Animator.toggle(this.overlay, "fade");
|
525 |
-
}
|
526 |
|
527 |
-
|
528 |
-
if (
|
529 |
-
|
530 |
}
|
531 |
-
this.contentElement.innerHTML = this.contentElement.innerHTML;
|
532 |
-
}.bind(this));
|
533 |
|
534 |
-
|
535 |
-
};
|
536 |
|
537 |
-
//
|
538 |
-
|
539 |
-
|
540 |
-
};
|
541 |
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
};
|
546 |
|
547 |
-
//
|
548 |
-
|
549 |
-
|
|
|
|
|
|
|
|
|
550 |
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
}
|
561 |
-
}
|
562 |
|
563 |
-
|
564 |
-
}
|
|
|
565 |
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
|
|
570 |
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
case "smaller":
|
575 |
-
return window.innerWidth < this.config.screenWidthCondition.value;
|
576 |
-
}
|
577 |
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
|
|
586 |
|
587 |
-
//
|
588 |
-
|
|
|
589 |
|
590 |
-
|
591 |
-
|
592 |
-
|
|
|
593 |
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
|
|
|
|
598 |
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
|
|
603 |
|
604 |
-
|
605 |
-
|
606 |
-
};
|
607 |
|
608 |
-
|
609 |
-
|
610 |
-
}
|
611 |
|
612 |
-
|
613 |
-
// always show on test mode or when no auto-trigger is configured
|
614 |
-
if (this.config.testMode || !this.config.trigger) {
|
615 |
-
return false;
|
616 |
-
}
|
617 |
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
|
|
|
|
|
|
|
|
622 |
|
623 |
-
|
624 |
-
|
625 |
-
};
|
626 |
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
document.cookie = 'boxzilla_box_' + this.id + '=true; expires=' + expiryDate.toUTCString() + '; path=/';
|
632 |
};
|
633 |
|
634 |
-
|
635 |
-
|
636 |
-
if (!shown) {
|
637 |
-
return;
|
638 |
-
}
|
639 |
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
645 |
|
646 |
/**
|
647 |
-
*
|
648 |
*
|
649 |
-
* @param
|
650 |
-
* @
|
|
|
651 |
*/
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
// only dismiss box if it's currently open.
|
657 |
-
if (!this.visible) {
|
658 |
-
return false;
|
659 |
-
}
|
660 |
-
|
661 |
-
// hide box element
|
662 |
-
this.hide();
|
663 |
-
|
664 |
-
// set cookie
|
665 |
-
if (this.config.cookie && this.config.cookie.dismissed) {
|
666 |
-
this.setCookie(this.config.cookie.dismissed);
|
667 |
}
|
|
|
|
|
|
|
|
|
|
|
668 |
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
return Box;
|
677 |
-
};
|
678 |
-
|
679 |
-
},{"./animator.js":2}],4:[function(require,module,exports){
|
680 |
-
'use strict';
|
681 |
-
|
682 |
-
var EventEmitter = require('wolfy87-eventemitter'),
|
683 |
-
Boxzilla = Object.create(EventEmitter.prototype),
|
684 |
-
Box = require('./box.js')(Boxzilla),
|
685 |
-
Timer = require('./timer.js'),
|
686 |
-
boxes = [],
|
687 |
-
overlay,
|
688 |
-
scrollElement = window,
|
689 |
-
exitIntentDelayTimer,
|
690 |
-
exitIntentTriggered,
|
691 |
-
siteTimer,
|
692 |
-
pageTimer,
|
693 |
-
pageViews;
|
694 |
|
695 |
-
|
696 |
-
threshhold || (threshhold = 250);
|
697 |
-
var last, deferTimer;
|
698 |
-
return function () {
|
699 |
-
var context = scope || this;
|
700 |
|
701 |
-
|
702 |
-
args = arguments;
|
703 |
-
if (last && now < last + threshhold) {
|
704 |
-
// hold on to it
|
705 |
-
clearTimeout(deferTimer);
|
706 |
-
deferTimer = setTimeout(function () {
|
707 |
-
last = now;
|
708 |
-
fn.apply(context, args);
|
709 |
-
}, threshhold);
|
710 |
-
} else {
|
711 |
-
last = now;
|
712 |
-
fn.apply(context, args);
|
713 |
-
}
|
714 |
-
};
|
715 |
}
|
716 |
|
717 |
-
//
|
718 |
-
function
|
719 |
-
|
720 |
-
Boxzilla.dismiss();
|
721 |
-
}
|
722 |
-
}
|
723 |
|
724 |
-
//
|
725 |
-
|
726 |
|
727 |
-
|
728 |
-
|
729 |
-
return;
|
730 |
-
}
|
731 |
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
|
|
|
|
|
|
|
|
|
|
736 |
|
737 |
-
|
738 |
-
|
739 |
-
}
|
740 |
-
});
|
741 |
-
}
|
742 |
|
743 |
-
//
|
744 |
-
|
745 |
-
|
746 |
-
if (isAnyBoxVisible()) {
|
747 |
-
return;
|
748 |
-
}
|
749 |
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
}
|
754 |
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
}
|
766 |
|
767 |
-
|
768 |
-
|
|
|
|
|
|
|
769 |
|
770 |
-
|
771 |
-
|
|
|
|
|
772 |
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
|
|
777 |
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
}
|
783 |
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
}
|
791 |
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
});
|
797 |
-
}
|
798 |
|
799 |
-
|
800 |
-
|
801 |
-
var y = e.offsetY;
|
802 |
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
|
|
807 |
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
}
|
812 |
-
});
|
813 |
-
}
|
814 |
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
|
|
826 |
|
827 |
-
|
828 |
-
}
|
829 |
|
830 |
-
|
831 |
-
|
832 |
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
}
|
838 |
|
839 |
-
|
|
|
|
|
|
|
840 |
|
841 |
-
|
842 |
-
|
|
|
|
|
843 |
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
|
|
|
|
|
|
848 |
|
849 |
-
|
850 |
-
|
851 |
|
852 |
-
|
853 |
-
|
854 |
-
window.clearInterval(exitIntentDelayTimer);
|
855 |
-
exitIntentDelayTimer = null;
|
856 |
-
}
|
857 |
-
}
|
858 |
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
if (!el || el.tagName === 'A') {
|
865 |
-
break;
|
866 |
-
}
|
867 |
|
868 |
-
|
|
|
|
|
869 |
}
|
|
|
|
|
870 |
|
871 |
-
|
872 |
-
|
873 |
-
}
|
874 |
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
}
|
880 |
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
var sessionTime = sessionStorage.getItem('boxzilla_timer');
|
885 |
-
if (sessionTime) siteTimer.time = sessionTime;
|
886 |
-
} catch (e) {}
|
887 |
-
siteTimer.start();
|
888 |
-
pageTimer.start();
|
889 |
-
},
|
890 |
-
stop: function stop() {
|
891 |
-
sessionStorage.setItem('boxzilla_timer', siteTimer.time);
|
892 |
-
siteTimer.stop();
|
893 |
-
pageTimer.stop();
|
894 |
-
}
|
895 |
};
|
896 |
|
897 |
-
//
|
898 |
-
|
899 |
-
|
900 |
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
|
|
|
|
|
|
|
|
|
|
905 |
}
|
|
|
906 |
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
// insert styles into DOM
|
911 |
-
var styles = require('./styles.js');
|
912 |
-
var styleElement = document.createElement('style');
|
913 |
-
styleElement.setAttribute("type", "text/css");
|
914 |
-
styleElement.innerHTML = styles;
|
915 |
-
document.head.appendChild(styleElement);
|
916 |
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
document.body.appendChild(overlay);
|
922 |
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
window.setInterval(checkTimeCriteria, 1000);
|
930 |
-
window.setTimeout(checkPageViewsCriteria, 1000);
|
931 |
-
document.documentElement.addEventListener('mouseleave', onMouseLeave);
|
932 |
-
document.documentElement.addEventListener('mouseenter', onMouseEnter);
|
933 |
-
document.addEventListener('keyup', onKeyUp);
|
934 |
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
timers.stop();
|
939 |
-
sessionStorage.setItem('boxzilla_pageviews', ++pageViews);
|
940 |
-
});
|
941 |
-
window.addEventListener('blur', timers.stop);
|
942 |
|
943 |
-
|
|
|
|
|
944 |
};
|
945 |
|
946 |
-
|
947 |
-
|
948 |
-
*
|
949 |
-
* @param string id
|
950 |
-
* @param object opts
|
951 |
-
*
|
952 |
-
* @returns Box
|
953 |
-
*/
|
954 |
-
Boxzilla.create = function (id, opts) {
|
955 |
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
condition: "larger",
|
960 |
-
value: opts.minimumScreenWidth
|
961 |
-
};
|
962 |
-
}
|
963 |
|
964 |
-
|
965 |
-
|
966 |
-
return
|
967 |
-
}
|
968 |
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
return box;
|
974 |
-
}
|
975 |
-
}
|
976 |
|
977 |
-
|
|
|
978 |
};
|
979 |
|
980 |
-
|
981 |
-
|
982 |
-
// if no id given, dismiss all current open boxes
|
983 |
-
if (typeof id === "undefined") {
|
984 |
-
boxes.forEach(function (box) {
|
985 |
-
box.dismiss();
|
986 |
-
});
|
987 |
-
} else {
|
988 |
-
Boxzilla.get(id).dismiss();
|
989 |
-
}
|
990 |
};
|
991 |
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
} else {
|
998 |
-
Boxzilla.get(id).hide();
|
999 |
-
}
|
1000 |
-
};
|
1001 |
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
}
|
1010 |
};
|
1011 |
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
} else {
|
1018 |
-
Boxzilla.get(id).toggle();
|
1019 |
-
}
|
1020 |
};
|
1021 |
|
1022 |
-
|
1023 |
-
|
|
|
|
|
|
|
1024 |
|
1025 |
-
|
1026 |
-
|
|
|
|
|
|
|
1027 |
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1031 |
|
1032 |
-
|
1033 |
-
|
|
|
|
|
1034 |
|
1035 |
-
|
1036 |
-
|
1037 |
|
1038 |
-
|
1039 |
-
|
|
|
|
|
1040 |
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
};
|
1045 |
|
1046 |
-
|
1047 |
-
|
|
|
1048 |
};
|
1049 |
|
1050 |
-
|
1051 |
-
|
1052 |
-
this.interval = window.setInterval(this.tick.bind(this), 1000);
|
1053 |
-
}
|
1054 |
-
};
|
1055 |
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1062 |
|
1063 |
-
|
|
|
|
|
|
|
|
|
1064 |
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1072 |
|
1073 |
-
|
1074 |
-
|
|
|
|
|
|
|
|
|
1075 |
|
1076 |
-
|
1077 |
-
|
1078 |
-
* Can be extended to provide event functionality in other classes.
|
1079 |
-
*
|
1080 |
-
* @class EventEmitter Manages event registering and emitting.
|
1081 |
-
*/
|
1082 |
-
function EventEmitter() {}
|
1083 |
|
1084 |
-
//
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
* @param {Function[]} listeners Array of listeners to search through.
|
1093 |
-
* @param {Function} listener Method to look for.
|
1094 |
-
* @return {Number} Index of the specified listener, -1 if not found
|
1095 |
-
* @api private
|
1096 |
-
*/
|
1097 |
-
function indexOfListener(listeners, listener) {
|
1098 |
-
var i = listeners.length;
|
1099 |
-
while (i--) {
|
1100 |
-
if (listeners[i].listener === listener) {
|
1101 |
-
return i;
|
1102 |
-
}
|
1103 |
}
|
1104 |
|
1105 |
-
|
1106 |
-
|
|
|
|
|
|
|
1107 |
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
* @api private
|
1114 |
-
*/
|
1115 |
-
function alias(name) {
|
1116 |
-
return function aliasClosure() {
|
1117 |
-
return this[name].apply(this, arguments);
|
1118 |
-
};
|
1119 |
}
|
1120 |
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
* Each property in the object response is an array of listener functions.
|
1126 |
-
*
|
1127 |
-
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
1128 |
-
* @return {Function[]|Object} All listener functions for the event.
|
1129 |
-
*/
|
1130 |
-
proto.getListeners = function getListeners(evt) {
|
1131 |
-
var events = this._getEvents();
|
1132 |
-
var response;
|
1133 |
-
var key;
|
1134 |
|
1135 |
-
//
|
1136 |
-
|
1137 |
-
|
1138 |
-
response = {};
|
1139 |
-
for (key in events) {
|
1140 |
-
if (events.hasOwnProperty(key) && evt.test(key)) {
|
1141 |
-
response[key] = events[key];
|
1142 |
-
}
|
1143 |
-
}
|
1144 |
}
|
1145 |
-
|
1146 |
-
|
|
|
|
|
1147 |
}
|
|
|
|
|
1148 |
|
1149 |
-
|
1150 |
-
|
1151 |
|
1152 |
-
|
1153 |
-
|
1154 |
-
*
|
1155 |
-
* @param {Object[]} listeners Raw listener objects.
|
1156 |
-
* @return {Function[]} Just the listener functions.
|
1157 |
-
*/
|
1158 |
-
proto.flattenListeners = function flattenListeners(listeners) {
|
1159 |
-
var flatListeners = [];
|
1160 |
-
var i;
|
1161 |
|
1162 |
-
|
1163 |
-
|
|
|
1164 |
}
|
1165 |
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
*
|
1172 |
-
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
1173 |
-
* @return {Object} All listener functions for an event in an object.
|
1174 |
-
*/
|
1175 |
-
proto.getListenersAsObject = function getListenersAsObject(evt) {
|
1176 |
-
var listeners = this.getListeners(evt);
|
1177 |
-
var response;
|
1178 |
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
|
|
1182 |
}
|
|
|
|
|
1183 |
|
1184 |
-
|
1185 |
-
|
|
|
|
|
|
|
|
|
1186 |
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
|
|
1201 |
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
|
|
|
|
1209 |
}
|
|
|
1210 |
|
1211 |
-
|
1212 |
-
|
1213 |
|
1214 |
-
|
1215 |
-
|
1216 |
-
*/
|
1217 |
-
proto.on = alias('addListener');
|
1218 |
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
1225 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
1226 |
-
*/
|
1227 |
-
proto.addOnceListener = function addOnceListener(evt, listener) {
|
1228 |
-
return this.addListener(evt, {
|
1229 |
-
listener: listener,
|
1230 |
-
once: true
|
1231 |
-
});
|
1232 |
-
};
|
1233 |
|
1234 |
-
|
1235 |
-
* Alias of addOnceListener.
|
1236 |
-
*/
|
1237 |
-
proto.once = alias('addOnceListener');
|
1238 |
|
1239 |
-
|
1240 |
-
|
1241 |
-
* You need to tell it what event names should be matched by a regex.
|
1242 |
-
*
|
1243 |
-
* @param {String} evt Name of the event to create.
|
1244 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
1245 |
-
*/
|
1246 |
-
proto.defineEvent = function defineEvent(evt) {
|
1247 |
-
this.getListeners(evt);
|
1248 |
-
return this;
|
1249 |
-
};
|
1250 |
|
1251 |
-
|
1252 |
-
|
1253 |
-
*
|
1254 |
-
* @param {String[]} evts An array of event names to define.
|
1255 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
1256 |
-
*/
|
1257 |
-
proto.defineEvents = function defineEvents(evts) {
|
1258 |
-
for (var i = 0; i < evts.length; i += 1) {
|
1259 |
-
this.defineEvent(evts[i]);
|
1260 |
}
|
1261 |
-
|
1262 |
-
};
|
1263 |
|
1264 |
-
|
1265 |
-
|
1266 |
-
* When passed a regular expression as the event name, it will remove the listener from all events that match it.
|
1267 |
-
*
|
1268 |
-
* @param {String|RegExp} evt Name of the event to remove the listener from.
|
1269 |
-
* @param {Function} listener Method to remove from the event.
|
1270 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
1271 |
-
*/
|
1272 |
-
proto.removeListener = function removeListener(evt, listener) {
|
1273 |
-
var listeners = this.getListenersAsObject(evt);
|
1274 |
-
var index;
|
1275 |
-
var key;
|
1276 |
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
|
|
|
|
|
|
1280 |
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
|
|
|
|
|
|
1285 |
}
|
1286 |
|
1287 |
-
|
1288 |
-
}
|
1289 |
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
proto.off = alias('removeListener');
|
1294 |
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
*
|
1301 |
-
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
|
1302 |
-
* @param {Function[]} [listeners] An optional array of listener functions to add.
|
1303 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
1304 |
-
*/
|
1305 |
-
proto.addListeners = function addListeners(evt, listeners) {
|
1306 |
-
// Pass through to manipulateListeners
|
1307 |
-
return this.manipulateListeners(false, evt, listeners);
|
1308 |
-
};
|
1309 |
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
}
|
|
|
1324 |
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
* If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
1329 |
-
* You can also pass it an event name and an array of listeners to be added/removed.
|
1330 |
-
* You can also pass it a regular expression to manipulate the listeners of all events that match it.
|
1331 |
-
*
|
1332 |
-
* @param {Boolean} remove True if you want to remove listeners, false if you want to add.
|
1333 |
-
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
|
1334 |
-
* @param {Function[]} [listeners] An optional array of listener functions to add/remove.
|
1335 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
1336 |
-
*/
|
1337 |
-
proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
|
1338 |
-
var i;
|
1339 |
-
var value;
|
1340 |
-
var single = remove ? this.removeListener : this.addListener;
|
1341 |
-
var multiple = remove ? this.removeListeners : this.addListeners;
|
1342 |
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1367 |
|
1368 |
-
|
1369 |
-
|
1370 |
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
proto.removeEvent = function removeEvent(evt) {
|
1381 |
-
var type = typeof evt;
|
1382 |
-
var events = this._getEvents();
|
1383 |
-
var key;
|
1384 |
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
for (key in events) {
|
1393 |
-
if (events.hasOwnProperty(key) && evt.test(key)) {
|
1394 |
-
delete events[key];
|
1395 |
-
}
|
1396 |
-
}
|
1397 |
-
}
|
1398 |
-
else {
|
1399 |
-
// Remove all listeners in all events
|
1400 |
-
delete this._events;
|
1401 |
-
}
|
1402 |
|
1403 |
-
|
1404 |
-
|
|
|
|
|
1405 |
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
|
|
1412 |
|
1413 |
-
|
1414 |
-
|
1415 |
-
* When emitted, every listener attached to that event will be executed.
|
1416 |
-
* If you pass the optional argument array then those arguments will be passed to every listener upon execution.
|
1417 |
-
* Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
|
1418 |
-
* So they will not arrive within the array on the other side, they will be separate.
|
1419 |
-
* You can also pass a regular expression to emit to all events that match it.
|
1420 |
-
*
|
1421 |
-
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
1422 |
-
* @param {Array} [args] Optional array of arguments to be passed to each listener.
|
1423 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
1424 |
-
*/
|
1425 |
-
proto.emitEvent = function emitEvent(evt, args) {
|
1426 |
-
var listenersMap = this.getListenersAsObject(evt);
|
1427 |
-
var listeners;
|
1428 |
-
var listener;
|
1429 |
-
var i;
|
1430 |
-
var key;
|
1431 |
-
var response;
|
1432 |
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1437 |
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
|
|
|
|
|
|
|
|
|
|
1442 |
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1446 |
|
1447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1448 |
|
1449 |
-
|
1450 |
-
|
1451 |
-
}
|
1452 |
-
}
|
1453 |
-
}
|
1454 |
-
}
|
1455 |
|
1456 |
-
|
1457 |
-
|
1458 |
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
proto.trigger = alias('emitEvent');
|
1463 |
|
1464 |
-
|
1465 |
-
|
1466 |
-
* As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
|
1467 |
-
*
|
1468 |
-
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
1469 |
-
* @param {...*} Optional additional arguments to be passed to each listener.
|
1470 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
1471 |
-
*/
|
1472 |
-
proto.emit = function emit(evt) {
|
1473 |
-
var args = Array.prototype.slice.call(arguments, 1);
|
1474 |
-
return this.emitEvent(evt, args);
|
1475 |
-
};
|
1476 |
|
1477 |
-
|
1478 |
-
|
1479 |
-
* listeners return value matches the one set here then it will be removed
|
1480 |
-
* after execution. This value defaults to true.
|
1481 |
-
*
|
1482 |
-
* @param {*} value The new value to check for when executing listeners.
|
1483 |
-
* @return {Object} Current instance of EventEmitter for chaining.
|
1484 |
-
*/
|
1485 |
-
proto.setOnceReturnValue = function setOnceReturnValue(value) {
|
1486 |
-
this._onceReturnValue = value;
|
1487 |
-
return this;
|
1488 |
-
};
|
1489 |
|
1490 |
-
|
1491 |
-
|
1492 |
-
* the listeners return value matches this one then it should be removed
|
1493 |
-
* automatically. It will return true by default.
|
1494 |
-
*
|
1495 |
-
* @return {*|Boolean} The current value to check for or the default, true.
|
1496 |
-
* @api private
|
1497 |
-
*/
|
1498 |
-
proto._getOnceReturnValue = function _getOnceReturnValue() {
|
1499 |
-
if (this.hasOwnProperty('_onceReturnValue')) {
|
1500 |
-
return this._onceReturnValue;
|
1501 |
-
}
|
1502 |
-
else {
|
1503 |
-
return true;
|
1504 |
-
}
|
1505 |
-
};
|
1506 |
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
* @api private
|
1512 |
-
*/
|
1513 |
-
proto._getEvents = function _getEvents() {
|
1514 |
-
return this._events || (this._events = {});
|
1515 |
-
};
|
1516 |
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
* @return {Function} Non conflicting EventEmitter class.
|
1521 |
-
*/
|
1522 |
-
EventEmitter.noConflict = function noConflict() {
|
1523 |
-
exports.EventEmitter = originalGlobalValue;
|
1524 |
-
return EventEmitter;
|
1525 |
-
};
|
1526 |
|
1527 |
-
|
1528 |
-
if (
|
1529 |
-
|
1530 |
-
return EventEmitter;
|
1531 |
-
});
|
1532 |
-
}
|
1533 |
-
else if (typeof module === 'object' && module.exports){
|
1534 |
-
module.exports = EventEmitter;
|
1535 |
}
|
1536 |
-
|
1537 |
-
|
|
|
|
|
|
|
|
|
1538 |
}
|
1539 |
-
}
|
|
|
|
|
1540 |
|
1541 |
},{}]},{},[1]);
|
1542 |
; })();
|
164 |
window.setTimeout(createBoxesFromConfig, 1);
|
165 |
})();
|
166 |
|
167 |
+
},{"boxzilla":5}],2:[function(require,module,exports){
|
168 |
+
/*!
|
169 |
+
* EventEmitter v4.2.11 - git.io/ee
|
170 |
+
* Unlicense - http://unlicense.org/
|
171 |
+
* Oliver Caldwell - http://oli.me.uk/
|
172 |
+
* @preserve
|
173 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
+
;(function () {
|
176 |
+
'use strict';
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
+
/**
|
179 |
+
* Class for managing events.
|
180 |
+
* Can be extended to provide event functionality in other classes.
|
181 |
+
*
|
182 |
+
* @class EventEmitter Manages event registering and emitting.
|
183 |
+
*/
|
184 |
+
function EventEmitter() {}
|
|
|
|
|
185 |
|
186 |
+
// Shortcuts to improve speed and size
|
187 |
+
var proto = EventEmitter.prototype;
|
188 |
+
var exports = this;
|
189 |
+
var originalGlobalValue = exports.EventEmitter;
|
|
|
|
|
|
|
|
|
190 |
|
191 |
+
/**
|
192 |
+
* Finds the index of the listener for the event in its storage array.
|
193 |
+
*
|
194 |
+
* @param {Function[]} listeners Array of listeners to search through.
|
195 |
+
* @param {Function} listener Method to look for.
|
196 |
+
* @return {Number} Index of the specified listener, -1 if not found
|
197 |
+
* @api private
|
198 |
+
*/
|
199 |
+
function indexOfListener(listeners, listener) {
|
200 |
+
var i = listeners.length;
|
201 |
+
while (i--) {
|
202 |
+
if (listeners[i].listener === listener) {
|
203 |
+
return i;
|
204 |
+
}
|
205 |
}
|
|
|
|
|
|
|
|
|
206 |
|
207 |
+
return -1;
|
|
|
|
|
208 |
}
|
209 |
|
210 |
+
/**
|
211 |
+
* Alias a method while keeping the context correct, to allow for overwriting of target method.
|
212 |
+
*
|
213 |
+
* @param {String} name The name of the target method.
|
214 |
+
* @return {Function} The aliased method
|
215 |
+
* @api private
|
216 |
+
*/
|
217 |
+
function alias(name) {
|
218 |
+
return function aliasClosure() {
|
219 |
+
return this[name].apply(this, arguments);
|
220 |
+
};
|
221 |
+
}
|
222 |
|
223 |
+
/**
|
224 |
+
* Returns the listener array for the specified event.
|
225 |
+
* Will initialise the event object and listener arrays if required.
|
226 |
+
* Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.
|
227 |
+
* Each property in the object response is an array of listener functions.
|
228 |
+
*
|
229 |
+
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
230 |
+
* @return {Function[]|Object} All listener functions for the event.
|
231 |
+
*/
|
232 |
+
proto.getListeners = function getListeners(evt) {
|
233 |
+
var events = this._getEvents();
|
234 |
+
var response;
|
235 |
+
var key;
|
236 |
|
237 |
+
// Return a concatenated array of all matching events if
|
238 |
+
// the selector is a regular expression.
|
239 |
+
if (evt instanceof RegExp) {
|
240 |
+
response = {};
|
241 |
+
for (key in events) {
|
242 |
+
if (events.hasOwnProperty(key) && evt.test(key)) {
|
243 |
+
response[key] = events[key];
|
244 |
+
}
|
245 |
}
|
|
|
246 |
}
|
247 |
+
else {
|
248 |
+
response = events[evt] || (events[evt] = []);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
}
|
250 |
|
251 |
+
return response;
|
252 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
+
/**
|
255 |
+
* Takes a list of listener objects and flattens it into a list of listener functions.
|
256 |
+
*
|
257 |
+
* @param {Object[]} listeners Raw listener objects.
|
258 |
+
* @return {Function[]} Just the listener functions.
|
259 |
+
*/
|
260 |
+
proto.flattenListeners = function flattenListeners(listeners) {
|
261 |
+
var flatListeners = [];
|
262 |
+
var i;
|
263 |
|
264 |
+
for (i = 0; i < listeners.length; i += 1) {
|
265 |
+
flatListeners.push(listeners[i].listener);
|
|
|
|
|
266 |
}
|
267 |
|
268 |
+
return flatListeners;
|
269 |
+
};
|
|
|
270 |
|
271 |
+
/**
|
272 |
+
* Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.
|
273 |
+
*
|
274 |
+
* @param {String|RegExp} evt Name of the event to return the listeners from.
|
275 |
+
* @return {Object} All listener functions for an event in an object.
|
276 |
+
*/
|
277 |
+
proto.getListenersAsObject = function getListenersAsObject(evt) {
|
278 |
+
var listeners = this.getListeners(evt);
|
279 |
+
var response;
|
280 |
|
281 |
+
if (listeners instanceof Array) {
|
282 |
+
response = {};
|
283 |
+
response[evt] = listeners;
|
284 |
+
}
|
|
|
|
|
285 |
|
286 |
+
return response || listeners;
|
287 |
+
};
|
|
|
|
|
|
|
288 |
|
289 |
+
/**
|
290 |
+
* Adds a listener function to the specified event.
|
291 |
+
* The listener will not be added if it is a duplicate.
|
292 |
+
* If the listener returns true then it will be removed after it is called.
|
293 |
+
* If you pass a regular expression as the event name then the listener will be added to all events that match it.
|
294 |
+
*
|
295 |
+
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
296 |
+
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
297 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
298 |
+
*/
|
299 |
+
proto.addListener = function addListener(evt, listener) {
|
300 |
+
var listeners = this.getListenersAsObject(evt);
|
301 |
+
var listenerIsWrapped = typeof listener === 'object';
|
302 |
+
var key;
|
303 |
|
304 |
+
for (key in listeners) {
|
305 |
+
if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
|
306 |
+
listeners[key].push(listenerIsWrapped ? listener : {
|
307 |
+
listener: listener,
|
308 |
+
once: false
|
309 |
+
});
|
310 |
+
}
|
311 |
}
|
312 |
|
313 |
+
return this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
};
|
315 |
|
316 |
+
/**
|
317 |
+
* Alias of addListener
|
318 |
+
*/
|
319 |
+
proto.on = alias('addListener');
|
|
|
|
|
|
|
|
|
320 |
|
321 |
+
/**
|
322 |
+
* Semi-alias of addListener. It will add a listener that will be
|
323 |
+
* automatically removed after its first execution.
|
324 |
+
*
|
325 |
+
* @param {String|RegExp} evt Name of the event to attach the listener to.
|
326 |
+
* @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
|
327 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
328 |
+
*/
|
329 |
+
proto.addOnceListener = function addOnceListener(evt, listener) {
|
330 |
+
return this.addListener(evt, {
|
331 |
+
listener: listener,
|
332 |
+
once: true
|
333 |
+
});
|
334 |
+
};
|
335 |
|
336 |
+
/**
|
337 |
+
* Alias of addOnceListener.
|
338 |
+
*/
|
339 |
+
proto.once = alias('addOnceListener');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
|
341 |
+
/**
|
342 |
+
* Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.
|
343 |
+
* You need to tell it what event names should be matched by a regex.
|
344 |
+
*
|
345 |
+
* @param {String} evt Name of the event to create.
|
346 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
347 |
+
*/
|
348 |
+
proto.defineEvent = function defineEvent(evt) {
|
349 |
+
this.getListeners(evt);
|
350 |
+
return this;
|
351 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
|
353 |
+
/**
|
354 |
+
* Uses defineEvent to define multiple events.
|
355 |
+
*
|
356 |
+
* @param {String[]} evts An array of event names to define.
|
357 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
358 |
+
*/
|
359 |
+
proto.defineEvents = function defineEvents(evts) {
|
360 |
+
for (var i = 0; i < evts.length; i += 1) {
|
361 |
+
this.defineEvent(evts[i]);
|
362 |
+
}
|
363 |
+
return this;
|
364 |
+
};
|
365 |
|
366 |
+
/**
|
367 |
+
* Removes a listener function from the specified event.
|
368 |
+
* When passed a regular expression as the event name, it will remove the listener from all events that match it.
|
369 |
+
*
|
370 |
+
* @param {String|RegExp} evt Name of the event to remove the listener from.
|
371 |
+
* @param {Function} listener Method to remove from the event.
|
372 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
373 |
+
*/
|
374 |
+
proto.removeListener = function removeListener(evt, listener) {
|
375 |
+
var listeners = this.getListenersAsObject(evt);
|
376 |
+
var index;
|
377 |
+
var key;
|
378 |
|
379 |
+
for (key in listeners) {
|
380 |
+
if (listeners.hasOwnProperty(key)) {
|
381 |
+
index = indexOfListener(listeners[key], listener);
|
382 |
|
383 |
+
if (index !== -1) {
|
384 |
+
listeners[key].splice(index, 1);
|
385 |
+
}
|
386 |
+
}
|
387 |
+
}
|
388 |
|
389 |
+
return this;
|
390 |
+
};
|
391 |
|
392 |
+
/**
|
393 |
+
* Alias of removeListener
|
394 |
+
*/
|
395 |
+
proto.off = alias('removeListener');
|
396 |
|
397 |
+
/**
|
398 |
+
* Adds listeners in bulk using the manipulateListeners method.
|
399 |
+
* If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
|
400 |
+
* You can also pass it a regular expression to add the array of listeners to all events that match it.
|
401 |
+
* Yeah, this function does quite a bit. That's probably a bad thing.
|
402 |
+
*
|
403 |
+
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
|
404 |
+
* @param {Function[]} [listeners] An optional array of listener functions to add.
|
405 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
406 |
+
*/
|
407 |
+
proto.addListeners = function addListeners(evt, listeners) {
|
408 |
+
// Pass through to manipulateListeners
|
409 |
+
return this.manipulateListeners(false, evt, listeners);
|
410 |
+
};
|
411 |
|
412 |
+
/**
|
413 |
+
* Removes listeners in bulk using the manipulateListeners method.
|
414 |
+
* If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
415 |
+
* You can also pass it an event name and an array of listeners to be removed.
|
416 |
+
* You can also pass it a regular expression to remove the listeners from all events that match it.
|
417 |
+
*
|
418 |
+
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
|
419 |
+
* @param {Function[]} [listeners] An optional array of listener functions to remove.
|
420 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
421 |
+
*/
|
422 |
+
proto.removeListeners = function removeListeners(evt, listeners) {
|
423 |
+
// Pass through to manipulateListeners
|
424 |
+
return this.manipulateListeners(true, evt, listeners);
|
425 |
+
};
|
426 |
|
427 |
+
/**
|
428 |
+
* Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.
|
429 |
+
* The first argument will determine if the listeners are removed (true) or added (false).
|
430 |
+
* If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
|
431 |
+
* You can also pass it an event name and an array of listeners to be added/removed.
|
432 |
+
* You can also pass it a regular expression to manipulate the listeners of all events that match it.
|
433 |
+
*
|
434 |
+
* @param {Boolean} remove True if you want to remove listeners, false if you want to add.
|
435 |
+
* @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
|
436 |
+
* @param {Function[]} [listeners] An optional array of listener functions to add/remove.
|
437 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
438 |
+
*/
|
439 |
+
proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
|
440 |
+
var i;
|
441 |
+
var value;
|
442 |
+
var single = remove ? this.removeListener : this.addListener;
|
443 |
+
var multiple = remove ? this.removeListeners : this.addListeners;
|
444 |
|
445 |
+
// If evt is an object then pass each of its properties to this method
|
446 |
+
if (typeof evt === 'object' && !(evt instanceof RegExp)) {
|
447 |
+
for (i in evt) {
|
448 |
+
if (evt.hasOwnProperty(i) && (value = evt[i])) {
|
449 |
+
// Pass the single listener straight through to the singular method
|
450 |
+
if (typeof value === 'function') {
|
451 |
+
single.call(this, i, value);
|
452 |
+
}
|
453 |
+
else {
|
454 |
+
// Otherwise pass back to the multiple function
|
455 |
+
multiple.call(this, i, value);
|
456 |
+
}
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}
|
460 |
+
else {
|
461 |
+
// So evt must be a string
|
462 |
+
// And listeners must be an array of listeners
|
463 |
+
// Loop over it and pass each one to the multiple method
|
464 |
+
i = listeners.length;
|
465 |
+
while (i--) {
|
466 |
+
single.call(this, evt, listeners[i]);
|
467 |
+
}
|
468 |
+
}
|
469 |
|
470 |
+
return this;
|
471 |
+
};
|
|
|
|
|
472 |
|
473 |
+
/**
|
474 |
+
* Removes all listeners from a specified event.
|
475 |
+
* If you do not specify an event then all listeners will be removed.
|
476 |
+
* That means every event will be emptied.
|
477 |
+
* You can also pass a regex to remove all events that match it.
|
478 |
+
*
|
479 |
+
* @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
|
480 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
481 |
+
*/
|
482 |
+
proto.removeEvent = function removeEvent(evt) {
|
483 |
+
var type = typeof evt;
|
484 |
+
var events = this._getEvents();
|
485 |
+
var key;
|
486 |
|
487 |
+
// Remove different things depending on the state of evt
|
488 |
+
if (type === 'string') {
|
489 |
+
// Remove all listeners for the specified event
|
490 |
+
delete events[evt];
|
491 |
+
}
|
492 |
+
else if (evt instanceof RegExp) {
|
493 |
+
// Remove all events matching the regex.
|
494 |
+
for (key in events) {
|
495 |
+
if (events.hasOwnProperty(key) && evt.test(key)) {
|
496 |
+
delete events[key];
|
497 |
+
}
|
498 |
+
}
|
499 |
+
}
|
500 |
+
else {
|
501 |
+
// Remove all listeners in all events
|
502 |
+
delete this._events;
|
503 |
+
}
|
504 |
|
505 |
+
return this;
|
506 |
+
};
|
|
|
|
|
507 |
|
508 |
+
/**
|
509 |
+
* Alias of removeEvent.
|
510 |
+
*
|
511 |
+
* Added to mirror the node API.
|
512 |
+
*/
|
513 |
+
proto.removeAllListeners = alias('removeEvent');
|
514 |
|
515 |
+
/**
|
516 |
+
* Emits an event of your choice.
|
517 |
+
* When emitted, every listener attached to that event will be executed.
|
518 |
+
* If you pass the optional argument array then those arguments will be passed to every listener upon execution.
|
519 |
+
* Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
|
520 |
+
* So they will not arrive within the array on the other side, they will be separate.
|
521 |
+
* You can also pass a regular expression to emit to all events that match it.
|
522 |
+
*
|
523 |
+
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
524 |
+
* @param {Array} [args] Optional array of arguments to be passed to each listener.
|
525 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
526 |
+
*/
|
527 |
+
proto.emitEvent = function emitEvent(evt, args) {
|
528 |
+
var listenersMap = this.getListenersAsObject(evt);
|
529 |
+
var listeners;
|
530 |
+
var listener;
|
531 |
+
var i;
|
532 |
+
var key;
|
533 |
+
var response;
|
534 |
|
535 |
+
for (key in listenersMap) {
|
536 |
+
if (listenersMap.hasOwnProperty(key)) {
|
537 |
+
listeners = listenersMap[key].slice(0);
|
538 |
+
i = listeners.length;
|
|
|
|
|
|
|
539 |
|
540 |
+
while (i--) {
|
541 |
+
// If the listener returns true then it shall be removed from the event
|
542 |
+
// The function is executed either with a basic call or an apply if there is an args array
|
543 |
+
listener = listeners[i];
|
544 |
|
545 |
+
if (listener.once === true) {
|
546 |
+
this.removeListener(evt, listener.listener);
|
547 |
+
}
|
548 |
|
549 |
+
response = listener.listener.apply(this, args || []);
|
|
|
|
|
|
|
|
|
550 |
|
551 |
+
if (response === this._getOnceReturnValue()) {
|
552 |
+
this.removeListener(evt, listener.listener);
|
553 |
+
}
|
554 |
+
}
|
555 |
+
}
|
556 |
+
}
|
557 |
|
558 |
+
return this;
|
559 |
+
};
|
|
|
|
|
|
|
560 |
|
561 |
+
/**
|
562 |
+
* Alias of emitEvent
|
563 |
+
*/
|
564 |
+
proto.trigger = alias('emitEvent');
|
|
|
|
|
565 |
|
566 |
+
/**
|
567 |
+
* Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.
|
568 |
+
* As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
|
569 |
+
*
|
570 |
+
* @param {String|RegExp} evt Name of the event to emit and execute listeners for.
|
571 |
+
* @param {...*} Optional additional arguments to be passed to each listener.
|
572 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
573 |
+
*/
|
574 |
+
proto.emit = function emit(evt) {
|
575 |
+
var args = Array.prototype.slice.call(arguments, 1);
|
576 |
+
return this.emitEvent(evt, args);
|
577 |
+
};
|
578 |
|
579 |
+
/**
|
580 |
+
* Sets the current value to check against when executing listeners. If a
|
581 |
+
* listeners return value matches the one set here then it will be removed
|
582 |
+
* after execution. This value defaults to true.
|
583 |
+
*
|
584 |
+
* @param {*} value The new value to check for when executing listeners.
|
585 |
+
* @return {Object} Current instance of EventEmitter for chaining.
|
586 |
+
*/
|
587 |
+
proto.setOnceReturnValue = function setOnceReturnValue(value) {
|
588 |
+
this._onceReturnValue = value;
|
589 |
+
return this;
|
590 |
+
};
|
591 |
|
592 |
+
/**
|
593 |
+
* Fetches the current value to check against when executing listeners. If
|
594 |
+
* the listeners return value matches this one then it should be removed
|
595 |
+
* automatically. It will return true by default.
|
596 |
+
*
|
597 |
+
* @return {*|Boolean} The current value to check for or the default, true.
|
598 |
+
* @api private
|
599 |
+
*/
|
600 |
+
proto._getOnceReturnValue = function _getOnceReturnValue() {
|
601 |
+
if (this.hasOwnProperty('_onceReturnValue')) {
|
602 |
+
return this._onceReturnValue;
|
603 |
+
}
|
604 |
+
else {
|
605 |
+
return true;
|
606 |
+
}
|
607 |
+
};
|
608 |
|
609 |
+
/**
|
610 |
+
* Fetches the events object and creates one if required.
|
611 |
+
*
|
612 |
+
* @return {Object} The events storage object.
|
613 |
+
* @api private
|
614 |
+
*/
|
615 |
+
proto._getEvents = function _getEvents() {
|
616 |
+
return this._events || (this._events = {});
|
617 |
+
};
|
618 |
|
619 |
+
/**
|
620 |
+
* Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
|
621 |
+
*
|
622 |
+
* @return {Function} Non conflicting EventEmitter class.
|
623 |
+
*/
|
624 |
+
EventEmitter.noConflict = function noConflict() {
|
625 |
+
exports.EventEmitter = originalGlobalValue;
|
626 |
+
return EventEmitter;
|
627 |
+
};
|
628 |
|
629 |
+
// Expose the class either via AMD, CommonJS or the global object
|
630 |
+
if (typeof define === 'function' && define.amd) {
|
631 |
+
define(function () {
|
632 |
+
return EventEmitter;
|
633 |
+
});
|
634 |
+
}
|
635 |
+
else if (typeof module === 'object' && module.exports){
|
636 |
+
module.exports = EventEmitter;
|
637 |
+
}
|
638 |
+
else {
|
639 |
+
exports.EventEmitter = EventEmitter;
|
640 |
+
}
|
641 |
+
}.call(this));
|
642 |
|
643 |
+
},{}],3:[function(require,module,exports){
|
644 |
+
'use strict';
|
645 |
|
646 |
+
var duration = 320;
|
647 |
+
|
648 |
+
function css(element, styles) {
|
649 |
+
for (var property in styles) {
|
650 |
+
element.style[property] = styles[property];
|
651 |
+
}
|
652 |
+
}
|
653 |
+
|
654 |
+
function initObjectProperties(properties, value) {
|
655 |
+
var newObject = {};
|
656 |
+
for (var i = 0; i < properties.length; i++) {
|
657 |
+
newObject[properties[i]] = value;
|
658 |
+
}
|
659 |
+
return newObject;
|
660 |
+
}
|
661 |
+
|
662 |
+
function copyObjectProperties(properties, object) {
|
663 |
+
var newObject = {};
|
664 |
+
for (var i = 0; i < properties.length; i++) {
|
665 |
+
newObject[properties[i]] = object[properties[i]];
|
666 |
+
}
|
667 |
+
return newObject;
|
668 |
+
}
|
669 |
+
|
670 |
+
/**
|
671 |
+
* Checks if the given element is currently being animated.
|
672 |
+
*
|
673 |
+
* @param element
|
674 |
+
* @returns {boolean}
|
675 |
+
*/
|
676 |
+
function animated(element) {
|
677 |
+
return !!element.getAttribute('data-animated');
|
678 |
+
}
|
679 |
+
|
680 |
+
/**
|
681 |
+
* Toggles the element using the given animation.
|
682 |
+
*
|
683 |
+
* @param element
|
684 |
+
* @param animation Either "fade" or "slide"
|
685 |
+
*/
|
686 |
+
function toggle(element, animation, callbackFn) {
|
687 |
+
var nowVisible = element.style.display != 'none' || element.offsetLeft > 0;
|
688 |
|
689 |
+
// create clone for reference
|
690 |
+
var clone = element.cloneNode(true);
|
691 |
+
var cleanup = function cleanup() {
|
692 |
+
element.removeAttribute('data-animated');
|
693 |
+
element.setAttribute('style', clone.getAttribute('style'));
|
694 |
+
element.style.display = nowVisible ? 'none' : '';
|
695 |
+
if (callbackFn) {
|
696 |
+
callbackFn();
|
697 |
+
}
|
698 |
+
};
|
699 |
|
700 |
+
// store attribute so everyone knows we're animating this element
|
701 |
+
element.setAttribute('data-animated', "true");
|
|
|
|
|
|
|
702 |
|
703 |
+
// toggle element visiblity right away if we're making something visible
|
704 |
+
if (!nowVisible) {
|
705 |
+
element.style.display = '';
|
706 |
}
|
|
|
|
|
707 |
|
708 |
+
var hiddenStyles, visibleStyles;
|
|
|
709 |
|
710 |
+
// animate properties
|
711 |
+
if (animation === 'slide') {
|
712 |
+
hiddenStyles = initObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 0);
|
713 |
+
visibleStyles = {};
|
714 |
|
715 |
+
if (!nowVisible) {
|
716 |
+
var computedStyles = window.getComputedStyle(element);
|
717 |
+
visibleStyles = copyObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], computedStyles);
|
|
|
718 |
|
719 |
+
// in some browsers, getComputedStyle returns "auto" value. this falls back to getBoundingClientRect() in those browsers since we need an actual height.
|
720 |
+
if (!isFinite(visibleStyles.height)) {
|
721 |
+
var clientRect = element.getBoundingClientRect();
|
722 |
+
visibleStyles.height = clientRect.height;
|
723 |
+
}
|
724 |
+
css(element, hiddenStyles);
|
725 |
+
}
|
726 |
|
727 |
+
// don't show a scrollbar during animation
|
728 |
+
element.style.overflowY = 'hidden';
|
729 |
+
animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);
|
730 |
+
} else {
|
731 |
+
hiddenStyles = { opacity: 0 };
|
732 |
+
visibleStyles = { opacity: 1 };
|
733 |
+
if (!nowVisible) {
|
734 |
+
css(element, hiddenStyles);
|
735 |
+
}
|
|
|
|
|
736 |
|
737 |
+
animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);
|
738 |
+
}
|
739 |
+
}
|
740 |
|
741 |
+
function animate(element, targetStyles, fn) {
|
742 |
+
var last = +new Date();
|
743 |
+
var initialStyles = window.getComputedStyle(element);
|
744 |
+
var currentStyles = {};
|
745 |
+
var propSteps = {};
|
746 |
|
747 |
+
for (var property in targetStyles) {
|
748 |
+
// make sure we have an object filled with floats
|
749 |
+
targetStyles[property] = parseFloat(targetStyles[property]);
|
|
|
|
|
|
|
750 |
|
751 |
+
// calculate step size & current value
|
752 |
+
var to = targetStyles[property];
|
753 |
+
var current = parseFloat(initialStyles[property]);
|
754 |
|
755 |
+
// is there something to do?
|
756 |
+
if (current == to) {
|
757 |
+
delete targetStyles[property];
|
758 |
+
continue;
|
759 |
+
}
|
760 |
|
761 |
+
propSteps[property] = (to - current) / duration; // points per second
|
762 |
+
currentStyles[property] = current;
|
763 |
+
}
|
764 |
|
765 |
+
var tick = function tick() {
|
766 |
+
var now = +new Date();
|
767 |
+
var timeSinceLastTick = now - last;
|
768 |
+
var done = true;
|
769 |
|
770 |
+
var step, to, increment, newValue;
|
771 |
+
for (var property in targetStyles) {
|
772 |
+
step = propSteps[property];
|
773 |
+
to = targetStyles[property];
|
774 |
+
increment = step * timeSinceLastTick;
|
775 |
+
newValue = currentStyles[property] + increment;
|
776 |
|
777 |
+
if (step > 0 && newValue >= to || step < 0 && newValue <= to) {
|
778 |
+
newValue = to;
|
779 |
+
} else {
|
780 |
+
done = false;
|
781 |
+
}
|
782 |
|
783 |
+
// store new value
|
784 |
+
currentStyles[property] = newValue;
|
|
|
785 |
|
786 |
+
var suffix = property !== "opacity" ? "px" : "";
|
787 |
+
element.style[property] = newValue + suffix;
|
788 |
+
}
|
789 |
|
790 |
+
last = +new Date();
|
|
|
|
|
|
|
|
|
791 |
|
792 |
+
// keep going until we're done for all props
|
793 |
+
if (!done) {
|
794 |
+
window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);
|
795 |
+
} else {
|
796 |
+
// call callback
|
797 |
+
fn && fn();
|
798 |
+
}
|
799 |
+
};
|
800 |
|
801 |
+
tick();
|
802 |
+
}
|
|
|
803 |
|
804 |
+
module.exports = {
|
805 |
+
'toggle': toggle,
|
806 |
+
'animate': animate,
|
807 |
+
'animated': animated
|
|
|
808 |
};
|
809 |
|
810 |
+
},{}],4:[function(require,module,exports){
|
811 |
+
'use strict';
|
|
|
|
|
|
|
812 |
|
813 |
+
var defaults = {
|
814 |
+
'animation': 'fade',
|
815 |
+
'rehide': false,
|
816 |
+
'content': '',
|
817 |
+
'cookie': null,
|
818 |
+
'icon': '×',
|
819 |
+
'screenWidthCondition': null,
|
820 |
+
'position': 'center',
|
821 |
+
'testMode': false,
|
822 |
+
'trigger': false,
|
823 |
+
'closable': true
|
824 |
+
},
|
825 |
+
Boxzilla,
|
826 |
+
Animator = require('./animator.js');
|
827 |
|
828 |
/**
|
829 |
+
* Merge 2 objects, values of the latter overwriting the former.
|
830 |
*
|
831 |
+
* @param obj1
|
832 |
+
* @param obj2
|
833 |
+
* @returns {*}
|
834 |
*/
|
835 |
+
function merge(obj1, obj2) {
|
836 |
+
var obj3 = {};
|
837 |
+
for (var attrname in obj1) {
|
838 |
+
obj3[attrname] = obj1[attrname];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
839 |
}
|
840 |
+
for (var attrname in obj2) {
|
841 |
+
obj3[attrname] = obj2[attrname];
|
842 |
+
}
|
843 |
+
return obj3;
|
844 |
+
}
|
845 |
|
846 |
+
/**
|
847 |
+
* Get the real height of entire document.
|
848 |
+
* @returns {number}
|
849 |
+
*/
|
850 |
+
function getDocumentHeight() {
|
851 |
+
var body = document.body,
|
852 |
+
html = document.documentElement;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
853 |
|
854 |
+
var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
|
|
|
|
|
|
|
|
|
855 |
|
856 |
+
return height;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
857 |
}
|
858 |
|
859 |
+
// Box Object
|
860 |
+
var Box = function Box(id, config) {
|
861 |
+
this.id = id;
|
|
|
|
|
|
|
862 |
|
863 |
+
// store config values
|
864 |
+
this.config = merge(defaults, config);
|
865 |
|
866 |
+
// store ref to overlay
|
867 |
+
this.overlay = document.getElementById('boxzilla-overlay');
|
|
|
|
|
868 |
|
869 |
+
// state
|
870 |
+
this.visible = false;
|
871 |
+
this.dismissed = false;
|
872 |
+
this.triggered = false;
|
873 |
+
this.triggerHeight = this.calculateTriggerHeight();
|
874 |
+
this.cookieSet = this.isCookieSet();
|
875 |
+
this.element = null;
|
876 |
+
this.contentElement = null;
|
877 |
+
this.closeIcon = null;
|
878 |
|
879 |
+
// create dom elements for this box
|
880 |
+
this.dom();
|
|
|
|
|
|
|
881 |
|
882 |
+
// further initialise the box
|
883 |
+
this.events();
|
884 |
+
};
|
|
|
|
|
|
|
885 |
|
886 |
+
// initialise the box
|
887 |
+
Box.prototype.events = function () {
|
888 |
+
var box = this;
|
|
|
889 |
|
890 |
+
// attach event to "close" icon inside box
|
891 |
+
if (this.closeIcon) {
|
892 |
+
this.closeIcon.addEventListener('click', this.dismiss.bind(this));
|
893 |
+
}
|
894 |
|
895 |
+
this.element.addEventListener('click', function (e) {
|
896 |
+
if (e.target.tagName === 'A') {
|
897 |
+
Boxzilla.trigger('box.interactions.link', [box, e.target]);
|
898 |
+
}
|
899 |
+
}, false);
|
|
|
900 |
|
901 |
+
this.element.addEventListener('submit', function (e) {
|
902 |
+
box.setCookie();
|
903 |
+
Boxzilla.trigger('box.interactions.form', [box, e.target]);
|
904 |
+
}, false);
|
905 |
+
};
|
906 |
|
907 |
+
// generate dom elements for this box
|
908 |
+
Box.prototype.dom = function () {
|
909 |
+
var wrapper = document.createElement('div');
|
910 |
+
wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';
|
911 |
|
912 |
+
var box = document.createElement('div');
|
913 |
+
box.setAttribute('id', 'boxzilla-' + this.id);
|
914 |
+
box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;
|
915 |
+
box.style.display = 'none';
|
916 |
+
wrapper.appendChild(box);
|
917 |
|
918 |
+
var content = document.createElement('div');
|
919 |
+
content.className = 'boxzilla-content';
|
920 |
+
content.innerHTML = this.config.content;
|
921 |
+
box.appendChild(content);
|
|
|
922 |
|
923 |
+
if (this.config.closable && this.config.icon) {
|
924 |
+
var closeIcon = document.createElement('span');
|
925 |
+
closeIcon.className = "boxzilla-close-icon";
|
926 |
+
closeIcon.innerHTML = this.config.icon;
|
927 |
+
box.appendChild(closeIcon);
|
928 |
+
this.closeIcon = closeIcon;
|
929 |
+
}
|
930 |
|
931 |
+
document.body.appendChild(wrapper);
|
932 |
+
this.contentElement = content;
|
933 |
+
this.element = box;
|
934 |
+
};
|
|
|
|
|
935 |
|
936 |
+
// set (calculate) custom box styling depending on box options
|
937 |
+
Box.prototype.setCustomBoxStyling = function () {
|
|
|
938 |
|
939 |
+
// reset element to its initial state
|
940 |
+
var origDisplay = this.element.style.display;
|
941 |
+
this.element.style.display = '';
|
942 |
+
this.element.style.overflowY = 'auto';
|
943 |
+
this.element.style.maxHeight = 'none';
|
944 |
|
945 |
+
// get new dimensions
|
946 |
+
var windowHeight = window.innerHeight;
|
947 |
+
var boxHeight = this.element.clientHeight;
|
|
|
|
|
|
|
948 |
|
949 |
+
// add scrollbar to box and limit height
|
950 |
+
if (boxHeight > windowHeight) {
|
951 |
+
this.element.style.maxHeight = windowHeight + "px";
|
952 |
+
this.element.style.overflowY = 'scroll';
|
953 |
+
}
|
954 |
|
955 |
+
// set new top margin for boxes which are centered
|
956 |
+
if (this.config.position === 'center') {
|
957 |
+
var newTopMargin = (windowHeight - boxHeight) / 2;
|
958 |
+
newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;
|
959 |
+
this.element.style.marginTop = newTopMargin + "px";
|
960 |
+
}
|
961 |
|
962 |
+
this.element.style.display = origDisplay;
|
963 |
+
};
|
964 |
|
965 |
+
// toggle visibility of the box
|
966 |
+
Box.prototype.toggle = function (show) {
|
967 |
|
968 |
+
// revert visibility if no explicit argument is given
|
969 |
+
if (typeof show === "undefined") {
|
970 |
+
show = !this.visible;
|
971 |
+
}
|
|
|
972 |
|
973 |
+
// is box already at desired visibility?
|
974 |
+
if (show === this.visible) {
|
975 |
+
return false;
|
976 |
+
}
|
977 |
|
978 |
+
// is box being animated?
|
979 |
+
if (Animator.animated(this.element)) {
|
980 |
+
return false;
|
981 |
+
}
|
982 |
|
983 |
+
// if box should be hidden but is not closable, bail.
|
984 |
+
if (!show && !this.config.closable) {
|
985 |
+
return false;
|
986 |
+
}
|
987 |
+
|
988 |
+
// set new visibility status
|
989 |
+
this.visible = show;
|
990 |
|
991 |
+
// calculate new styling rules
|
992 |
+
this.setCustomBoxStyling();
|
993 |
|
994 |
+
// trigger event
|
995 |
+
Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]);
|
|
|
|
|
|
|
|
|
996 |
|
997 |
+
// show or hide box using selected animation
|
998 |
+
if (this.config.position === 'center') {
|
999 |
+
this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');
|
1000 |
+
Animator.toggle(this.overlay, "fade");
|
1001 |
+
}
|
|
|
|
|
|
|
1002 |
|
1003 |
+
Animator.toggle(this.element, this.config.animation, function () {
|
1004 |
+
if (this.visible) {
|
1005 |
+
return;
|
1006 |
}
|
1007 |
+
this.contentElement.innerHTML = this.contentElement.innerHTML;
|
1008 |
+
}.bind(this));
|
1009 |
|
1010 |
+
return true;
|
1011 |
+
};
|
|
|
1012 |
|
1013 |
+
// show the box
|
1014 |
+
Box.prototype.show = function () {
|
1015 |
+
return this.toggle(true);
|
1016 |
+
};
|
|
|
1017 |
|
1018 |
+
// hide the box
|
1019 |
+
Box.prototype.hide = function () {
|
1020 |
+
return this.toggle(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1021 |
};
|
1022 |
|
1023 |
+
// calculate trigger height
|
1024 |
+
Box.prototype.calculateTriggerHeight = function () {
|
1025 |
+
var triggerHeight = 0;
|
1026 |
|
1027 |
+
if (this.config.trigger) {
|
1028 |
+
if (this.config.trigger.method === 'element') {
|
1029 |
+
var triggerElement = document.body.querySelector(this.config.trigger.value);
|
1030 |
+
if (triggerElement) {
|
1031 |
+
var offset = triggerElement.getBoundingClientRect();
|
1032 |
+
triggerHeight = offset.top;
|
1033 |
+
}
|
1034 |
+
} else if (this.config.trigger.method === 'percentage') {
|
1035 |
+
triggerHeight = this.config.trigger.value / 100 * getDocumentHeight();
|
1036 |
}
|
1037 |
+
}
|
1038 |
|
1039 |
+
return triggerHeight;
|
1040 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1041 |
|
1042 |
+
Box.prototype.fits = function () {
|
1043 |
+
if (!this.config.screenWidthCondition || !this.config.screenWidthCondition.value) {
|
1044 |
+
return true;
|
1045 |
+
}
|
|
|
1046 |
|
1047 |
+
switch (this.config.screenWidthCondition.condition) {
|
1048 |
+
case "larger":
|
1049 |
+
return window.innerWidth > this.config.screenWidthCondition.value;
|
1050 |
+
case "smaller":
|
1051 |
+
return window.innerWidth < this.config.screenWidthCondition.value;
|
1052 |
+
}
|
|
|
|
|
|
|
|
|
|
|
1053 |
|
1054 |
+
// meh.. condition should be "smaller" or "larger", just return true.
|
1055 |
+
return true;
|
1056 |
+
};
|
|
|
|
|
|
|
|
|
1057 |
|
1058 |
+
Box.prototype.onResize = function () {
|
1059 |
+
this.triggerHeight = this.calculateTriggerHeight();
|
1060 |
+
this.setCustomBoxStyling();
|
1061 |
};
|
1062 |
|
1063 |
+
// is this box enabled?
|
1064 |
+
Box.prototype.mayAutoShow = function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1065 |
|
1066 |
+
if (this.dismissed) {
|
1067 |
+
return false;
|
1068 |
+
}
|
|
|
|
|
|
|
|
|
1069 |
|
1070 |
+
// check if box fits on given minimum screen width
|
1071 |
+
if (!this.fits()) {
|
1072 |
+
return false;
|
1073 |
+
}
|
1074 |
|
1075 |
+
// if trigger empty or error in calculating triggerHeight, return false
|
1076 |
+
if (!this.config.trigger) {
|
1077 |
+
return false;
|
1078 |
+
}
|
|
|
|
|
|
|
1079 |
|
1080 |
+
// rely on cookie value (show if not set, don't show if set)
|
1081 |
+
return !this.cookieSet;
|
1082 |
};
|
1083 |
|
1084 |
+
Box.prototype.mayRehide = function () {
|
1085 |
+
return this.config.rehide && this.triggered;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1086 |
};
|
1087 |
|
1088 |
+
Box.prototype.isCookieSet = function () {
|
1089 |
+
// always show on test mode or when no auto-trigger is configured
|
1090 |
+
if (this.config.testMode || !this.config.trigger) {
|
1091 |
+
return false;
|
1092 |
+
}
|
|
|
|
|
|
|
|
|
1093 |
|
1094 |
+
// if either cookie is null or trigger & dismiss are both falsey, don't bother checking.
|
1095 |
+
if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {
|
1096 |
+
return false;
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
var cookieSet = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + 'boxzilla_box_' + this.id + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1") === "true";
|
1100 |
+
return cookieSet;
|
|
|
1101 |
};
|
1102 |
|
1103 |
+
// set cookie that disables automatically showing the box
|
1104 |
+
Box.prototype.setCookie = function (hours) {
|
1105 |
+
var expiryDate = new Date();
|
1106 |
+
expiryDate.setHours(expiryDate.getHours() + hours);
|
1107 |
+
document.cookie = 'boxzilla_box_' + this.id + '=true; expires=' + expiryDate.toUTCString() + '; path=/';
|
|
|
|
|
|
|
1108 |
};
|
1109 |
|
1110 |
+
Box.prototype.trigger = function () {
|
1111 |
+
var shown = this.show();
|
1112 |
+
if (!shown) {
|
1113 |
+
return;
|
1114 |
+
}
|
1115 |
|
1116 |
+
this.triggered = true;
|
1117 |
+
if (this.config.cookie && this.config.cookie.triggered) {
|
1118 |
+
this.setCookie(this.config.cookie.triggered);
|
1119 |
+
}
|
1120 |
+
};
|
1121 |
|
1122 |
+
/**
|
1123 |
+
* Dismisses the box and optionally sets a cookie.
|
1124 |
+
*
|
1125 |
+
* @param e The event that triggered this dismissal.
|
1126 |
+
* @returns {boolean}
|
1127 |
+
*/
|
1128 |
+
Box.prototype.dismiss = function (e) {
|
1129 |
+
// prevent default action
|
1130 |
+
e && e.preventDefault();
|
1131 |
|
1132 |
+
// only dismiss box if it's currently open.
|
1133 |
+
if (!this.visible) {
|
1134 |
+
return false;
|
1135 |
+
}
|
1136 |
|
1137 |
+
// hide box element
|
1138 |
+
this.hide();
|
1139 |
|
1140 |
+
// set cookie
|
1141 |
+
if (this.config.cookie && this.config.cookie.dismissed) {
|
1142 |
+
this.setCookie(this.config.cookie.dismissed);
|
1143 |
+
}
|
1144 |
|
1145 |
+
this.dismissed = true;
|
1146 |
+
Boxzilla.trigger('box.dismiss', [this]);
|
1147 |
+
return true;
|
1148 |
};
|
1149 |
|
1150 |
+
module.exports = function (_Boxzilla) {
|
1151 |
+
Boxzilla = _Boxzilla;
|
1152 |
+
return Box;
|
1153 |
};
|
1154 |
|
1155 |
+
},{"./animator.js":3}],5:[function(require,module,exports){
|
1156 |
+
'use strict';
|
|
|
|
|
|
|
1157 |
|
1158 |
+
var EventEmitter = require('wolfy87-eventemitter'),
|
1159 |
+
Boxzilla = Object.create(EventEmitter.prototype),
|
1160 |
+
Box = require('./box.js')(Boxzilla),
|
1161 |
+
Timer = require('./timer.js'),
|
1162 |
+
boxes = [],
|
1163 |
+
overlay,
|
1164 |
+
scrollElement = window,
|
1165 |
+
exitIntentDelayTimer,
|
1166 |
+
exitIntentTriggered,
|
1167 |
+
siteTimer,
|
1168 |
+
pageTimer,
|
1169 |
+
pageViews;
|
1170 |
|
1171 |
+
function throttle(fn, threshhold, scope) {
|
1172 |
+
threshhold || (threshhold = 250);
|
1173 |
+
var last, deferTimer;
|
1174 |
+
return function () {
|
1175 |
+
var context = scope || this;
|
1176 |
|
1177 |
+
var now = +new Date(),
|
1178 |
+
args = arguments;
|
1179 |
+
if (last && now < last + threshhold) {
|
1180 |
+
// hold on to it
|
1181 |
+
clearTimeout(deferTimer);
|
1182 |
+
deferTimer = setTimeout(function () {
|
1183 |
+
last = now;
|
1184 |
+
fn.apply(context, args);
|
1185 |
+
}, threshhold);
|
1186 |
+
} else {
|
1187 |
+
last = now;
|
1188 |
+
fn.apply(context, args);
|
1189 |
+
}
|
1190 |
+
};
|
1191 |
+
}
|
1192 |
|
1193 |
+
// "keyup" listener
|
1194 |
+
function onKeyUp(e) {
|
1195 |
+
if (e.keyCode == 27) {
|
1196 |
+
Boxzilla.dismiss();
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
|
1200 |
+
// check "pageviews" criteria for each box
|
1201 |
+
function checkPageViewsCriteria() {
|
|
|
|
|
|
|
|
|
|
|
1202 |
|
1203 |
+
// don't bother if another box is currently open
|
1204 |
+
if (isAnyBoxVisible()) {
|
1205 |
+
return;
|
1206 |
+
}
|
1207 |
|
1208 |
+
boxes.forEach(function (box) {
|
1209 |
+
if (!box.mayAutoShow()) {
|
1210 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1211 |
}
|
1212 |
|
1213 |
+
if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {
|
1214 |
+
box.trigger();
|
1215 |
+
}
|
1216 |
+
});
|
1217 |
+
}
|
1218 |
|
1219 |
+
// check time trigger criteria for each box
|
1220 |
+
function checkTimeCriteria() {
|
1221 |
+
// don't bother if another box is currently open
|
1222 |
+
if (isAnyBoxVisible()) {
|
1223 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
1224 |
}
|
1225 |
|
1226 |
+
boxes.forEach(function (box) {
|
1227 |
+
if (!box.mayAutoShow()) {
|
1228 |
+
return;
|
1229 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1230 |
|
1231 |
+
// check "time on site" trigger
|
1232 |
+
if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {
|
1233 |
+
box.trigger();
|
|
|
|
|
|
|
|
|
|
|
|
|
1234 |
}
|
1235 |
+
|
1236 |
+
// check "time on page" trigger
|
1237 |
+
if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {
|
1238 |
+
box.trigger();
|
1239 |
}
|
1240 |
+
});
|
1241 |
+
}
|
1242 |
|
1243 |
+
// check triggerHeight criteria for all boxes
|
1244 |
+
function checkHeightCriteria() {
|
1245 |
|
1246 |
+
var scrollY = scrollElement.hasOwnProperty('pageYOffset') ? scrollElement.pageYOffset : scrollElement.scrollTop;
|
1247 |
+
scrollY = scrollY + window.innerHeight * 0.9;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1248 |
|
1249 |
+
boxes.forEach(function (box) {
|
1250 |
+
if (!box.mayAutoShow() || box.triggerHeight <= 0) {
|
1251 |
+
return;
|
1252 |
}
|
1253 |
|
1254 |
+
if (scrollY > box.triggerHeight) {
|
1255 |
+
// don't bother if another box is currently open
|
1256 |
+
if (isAnyBoxVisible()) {
|
1257 |
+
return;
|
1258 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1259 |
|
1260 |
+
// trigger box
|
1261 |
+
box.trigger();
|
1262 |
+
} else if (box.mayRehide()) {
|
1263 |
+
box.hide();
|
1264 |
}
|
1265 |
+
});
|
1266 |
+
}
|
1267 |
|
1268 |
+
// recalculate heights and variables based on height
|
1269 |
+
function recalculateHeights() {
|
1270 |
+
boxes.forEach(function (box) {
|
1271 |
+
box.onResize();
|
1272 |
+
});
|
1273 |
+
}
|
1274 |
|
1275 |
+
function onOverlayClick(e) {
|
1276 |
+
var x = e.offsetX;
|
1277 |
+
var y = e.offsetY;
|
1278 |
+
|
1279 |
+
// calculate if click was less than 40px outside box to avoid closing it by accident
|
1280 |
+
boxes.forEach(function (box) {
|
1281 |
+
var rect = box.element.getBoundingClientRect();
|
1282 |
+
var margin = 40;
|
1283 |
+
|
1284 |
+
// if click was not anywhere near box, dismiss it.
|
1285 |
+
if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {
|
1286 |
+
box.dismiss();
|
1287 |
+
}
|
1288 |
+
});
|
1289 |
+
}
|
1290 |
|
1291 |
+
function triggerExitIntent() {
|
1292 |
+
// do nothing if already triggered OR another box is visible.
|
1293 |
+
if (exitIntentTriggered || isAnyBoxVisible()) {
|
1294 |
+
return;
|
1295 |
+
}
|
1296 |
+
|
1297 |
+
boxes.forEach(function (box) {
|
1298 |
+
if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {
|
1299 |
+
box.trigger();
|
1300 |
}
|
1301 |
+
});
|
1302 |
|
1303 |
+
exitIntentTriggered = true;
|
1304 |
+
}
|
1305 |
|
1306 |
+
function onMouseLeave(e) {
|
1307 |
+
var delay = 400;
|
|
|
|
|
1308 |
|
1309 |
+
// did mouse leave at top of window?
|
1310 |
+
if (e.clientY <= 0) {
|
1311 |
+
exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);
|
1312 |
+
}
|
1313 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1314 |
|
1315 |
+
function isAnyBoxVisible() {
|
|
|
|
|
|
|
1316 |
|
1317 |
+
for (var i = 0; i < boxes.length; i++) {
|
1318 |
+
var box = boxes[i];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1319 |
|
1320 |
+
if (box.visible) {
|
1321 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1322 |
}
|
1323 |
+
}
|
|
|
1324 |
|
1325 |
+
return false;
|
1326 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1327 |
|
1328 |
+
function onMouseEnter() {
|
1329 |
+
if (exitIntentDelayTimer) {
|
1330 |
+
window.clearInterval(exitIntentDelayTimer);
|
1331 |
+
exitIntentDelayTimer = null;
|
1332 |
+
}
|
1333 |
+
}
|
1334 |
|
1335 |
+
function onElementClick(e) {
|
1336 |
+
// find <a> element in up to 3 parent elements
|
1337 |
+
var el = e.target || e.srcElement;
|
1338 |
+
var depth = 3;
|
1339 |
+
for (var i = 0; i <= depth; i++) {
|
1340 |
+
if (!el || el.tagName === 'A') {
|
1341 |
+
break;
|
1342 |
}
|
1343 |
|
1344 |
+
el = el.parentElement;
|
1345 |
+
}
|
1346 |
|
1347 |
+
if (!el || el.tagName !== 'A' || !el.getAttribute('href')) {
|
1348 |
+
return;
|
1349 |
+
}
|
|
|
1350 |
|
1351 |
+
if (el.getAttribute('href').toLowerCase().indexOf('#boxzilla-') === 0) {
|
1352 |
+
var boxId = el.getAttribute('href').toLowerCase().substring("#boxzilla-".length);
|
1353 |
+
Boxzilla.toggle(boxId);
|
1354 |
+
}
|
1355 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1356 |
|
1357 |
+
var timers = {
|
1358 |
+
start: function start() {
|
1359 |
+
try {
|
1360 |
+
var sessionTime = sessionStorage.getItem('boxzilla_timer');
|
1361 |
+
if (sessionTime) siteTimer.time = sessionTime;
|
1362 |
+
} catch (e) {}
|
1363 |
+
siteTimer.start();
|
1364 |
+
pageTimer.start();
|
1365 |
+
},
|
1366 |
+
stop: function stop() {
|
1367 |
+
sessionStorage.setItem('boxzilla_timer', siteTimer.time);
|
1368 |
+
siteTimer.stop();
|
1369 |
+
pageTimer.stop();
|
1370 |
+
}
|
1371 |
+
};
|
1372 |
|
1373 |
+
// initialise & add event listeners
|
1374 |
+
Boxzilla.init = function () {
|
1375 |
+
document.body.addEventListener('click', onElementClick, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1376 |
|
1377 |
+
try {
|
1378 |
+
pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;
|
1379 |
+
} catch (e) {
|
1380 |
+
pageViews = 0;
|
1381 |
+
}
|
1382 |
+
|
1383 |
+
siteTimer = new Timer(0);
|
1384 |
+
pageTimer = new Timer(0);
|
1385 |
+
|
1386 |
+
// insert styles into DOM
|
1387 |
+
var styles = require('./styles.js');
|
1388 |
+
var styleElement = document.createElement('style');
|
1389 |
+
styleElement.setAttribute("type", "text/css");
|
1390 |
+
styleElement.innerHTML = styles;
|
1391 |
+
document.head.appendChild(styleElement);
|
1392 |
+
|
1393 |
+
// add overlay element to dom
|
1394 |
+
overlay = document.createElement('div');
|
1395 |
+
overlay.style.display = 'none';
|
1396 |
+
overlay.id = 'boxzilla-overlay';
|
1397 |
+
document.body.appendChild(overlay);
|
1398 |
+
|
1399 |
+
// event binds
|
1400 |
+
scrollElement.addEventListener('touchstart', throttle(checkHeightCriteria), true);
|
1401 |
+
scrollElement.addEventListener('scroll', throttle(checkHeightCriteria), true);
|
1402 |
+
window.addEventListener('resize', throttle(recalculateHeights));
|
1403 |
+
window.addEventListener('load', recalculateHeights);
|
1404 |
+
overlay.addEventListener('click', onOverlayClick);
|
1405 |
+
window.setInterval(checkTimeCriteria, 1000);
|
1406 |
+
window.setTimeout(checkPageViewsCriteria, 1000);
|
1407 |
+
document.documentElement.addEventListener('mouseleave', onMouseLeave);
|
1408 |
+
document.documentElement.addEventListener('mouseenter', onMouseEnter);
|
1409 |
+
document.addEventListener('keyup', onKeyUp);
|
1410 |
+
|
1411 |
+
timers.start();
|
1412 |
+
window.addEventListener('focus', timers.start);
|
1413 |
+
window.addEventListener('beforeunload', function () {
|
1414 |
+
timers.stop();
|
1415 |
+
sessionStorage.setItem('boxzilla_pageviews', ++pageViews);
|
1416 |
+
});
|
1417 |
+
window.addEventListener('blur', timers.stop);
|
1418 |
|
1419 |
+
Boxzilla.trigger('ready');
|
1420 |
+
};
|
1421 |
|
1422 |
+
/**
|
1423 |
+
* Create a new Box
|
1424 |
+
*
|
1425 |
+
* @param string id
|
1426 |
+
* @param object opts
|
1427 |
+
*
|
1428 |
+
* @returns Box
|
1429 |
+
*/
|
1430 |
+
Boxzilla.create = function (id, opts) {
|
|
|
|
|
|
|
|
|
1431 |
|
1432 |
+
// preserve backwards compat for minimumScreenWidth option
|
1433 |
+
if (typeof opts.minimumScreenWidth !== "undefined") {
|
1434 |
+
opts.screenWidthCondition = {
|
1435 |
+
condition: "larger",
|
1436 |
+
value: opts.minimumScreenWidth
|
1437 |
+
};
|
1438 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1439 |
|
1440 |
+
var box = new Box(id, opts);
|
1441 |
+
boxes.push(box);
|
1442 |
+
return box;
|
1443 |
+
};
|
1444 |
|
1445 |
+
Boxzilla.get = function (id) {
|
1446 |
+
for (var i = 0; i < boxes.length; i++) {
|
1447 |
+
var box = boxes[i];
|
1448 |
+
if (box.id == id) {
|
1449 |
+
return box;
|
1450 |
+
}
|
1451 |
+
}
|
1452 |
|
1453 |
+
throw new Error("No box exists with ID " + id);
|
1454 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1455 |
|
1456 |
+
// dismiss a single box (or all by omitting id param)
|
1457 |
+
Boxzilla.dismiss = function (id) {
|
1458 |
+
// if no id given, dismiss all current open boxes
|
1459 |
+
if (typeof id === "undefined") {
|
1460 |
+
boxes.forEach(function (box) {
|
1461 |
+
box.dismiss();
|
1462 |
+
});
|
1463 |
+
} else {
|
1464 |
+
Boxzilla.get(id).dismiss();
|
1465 |
+
}
|
1466 |
+
};
|
1467 |
|
1468 |
+
Boxzilla.hide = function (id) {
|
1469 |
+
if (typeof id === "undefined") {
|
1470 |
+
boxes.forEach(function (box) {
|
1471 |
+
box.hide();
|
1472 |
+
});
|
1473 |
+
} else {
|
1474 |
+
Boxzilla.get(id).hide();
|
1475 |
+
}
|
1476 |
+
};
|
1477 |
|
1478 |
+
Boxzilla.show = function (id) {
|
1479 |
+
if (typeof id === "undefined") {
|
1480 |
+
boxes.forEach(function (box) {
|
1481 |
+
box.show();
|
1482 |
+
});
|
1483 |
+
} else {
|
1484 |
+
Boxzilla.get(id).show();
|
1485 |
+
}
|
1486 |
+
};
|
1487 |
|
1488 |
+
Boxzilla.toggle = function (id) {
|
1489 |
+
if (typeof id === "undefined") {
|
1490 |
+
boxes.forEach(function (box) {
|
1491 |
+
box.toggle();
|
1492 |
+
});
|
1493 |
+
} else {
|
1494 |
+
Boxzilla.get(id).toggle();
|
1495 |
+
}
|
1496 |
+
};
|
1497 |
|
1498 |
+
// expose each individual box.
|
1499 |
+
Boxzilla.boxes = boxes;
|
|
|
|
|
|
|
|
|
1500 |
|
1501 |
+
// expose boxzilla object
|
1502 |
+
window.Boxzilla = Boxzilla;
|
1503 |
|
1504 |
+
if (typeof module !== 'undefined' && module.exports) {
|
1505 |
+
module.exports = Boxzilla;
|
1506 |
+
}
|
|
|
1507 |
|
1508 |
+
},{"./box.js":4,"./styles.js":6,"./timer.js":7,"wolfy87-eventemitter":2}],6:[function(require,module,exports){
|
1509 |
+
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1510 |
|
1511 |
+
var styles = "#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}";
|
1512 |
+
module.exports = styles;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1513 |
|
1514 |
+
},{}],7:[function(require,module,exports){
|
1515 |
+
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1516 |
|
1517 |
+
var Timer = function Timer(start) {
|
1518 |
+
this.time = start;
|
1519 |
+
this.interval = 0;
|
1520 |
+
};
|
|
|
|
|
|
|
|
|
|
|
1521 |
|
1522 |
+
Timer.prototype.tick = function () {
|
1523 |
+
this.time++;
|
1524 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
1525 |
|
1526 |
+
Timer.prototype.start = function () {
|
1527 |
+
if (!this.interval) {
|
1528 |
+
this.interval = window.setInterval(this.tick.bind(this), 1000);
|
|
|
|
|
|
|
|
|
|
|
1529 |
}
|
1530 |
+
};
|
1531 |
+
|
1532 |
+
Timer.prototype.stop = function () {
|
1533 |
+
if (this.interval) {
|
1534 |
+
window.clearInterval(this.interval);
|
1535 |
+
this.interval = 0;
|
1536 |
}
|
1537 |
+
};
|
1538 |
+
|
1539 |
+
module.exports = Timer;
|
1540 |
|
1541 |
},{}]},{},[1]);
|
1542 |
; })();
|
assets/js/script.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
!function(){var t=void 0,e=void 0;!function i(e,n,o){function r(a,l){if(!n[a]){if(!e[a]){var c="function"==typeof t&&t;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 h=n[a]={exports:{}};e[a][0].call(h.exports,function(t){var i=e[a][1][t];return r(i?i:t)},h,h.exports,i,e,n,o)}return n[a].exports}for(var s="function"==typeof t&&t,a=0;a<o.length;a++)r(o[a]);return r}({1:[function(t,e,i){"use strict";var n="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,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 i(){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."),a.init();for(var i=0;i<l.boxes.length;i++){var n=l.boxes[i];if(n.testMode=t&&l.testMode,"https:"===window.location.protocol&&window.location.host){var s="http://"+window.location.host,c=s.replace("http://","https://");n.content=n.content.replace(s,c)}var d=a.create(n.id,n),h=d.element.querySelectorAll("script");r(h),d.element.className=d.element.className+" boxzilla-"+n.post.slug,e(d.element,n.css),d.element.firstChild.firstChild.className+=" first-child",d.element.firstChild.lastChild.className+=" last-child",d.fits()&&o(d)&&window.addEventListener("load",d.show.bind(d))}l.inited=!0,a.trigger("done")}}function o(t){if(!window.location.hash||0===window.location.hash.length)return!1;var e=window.location.hash.substring(1),i=/^[a-zA-Z\-\_0-9]+$/;return!!i.test(e)&&(e===t.element.id||!!t.element.querySelector("#"+e))}function r(t){var e=function i(){var e=document.createElement("script");this.src&&(e.src=this.src),e.appendChild(document.createTextNode(this.text)),this.parentNode.removeChild(this),document.body.appendChild(e),t.length&&e.addEventListener("load",i.bind(t.shift()))};t=Array.from(t),t.length&&window.setTimeout(e.bind(t.shift()),1)}function s(){if("object"===n(window.mc4wp_forms_config)&&window.mc4wp_forms_config.submitted_form){var t="#"+window.mc4wp_forms_config.submitted_form.element_id,e=a.boxes;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];if(o.element.querySelector(t))return void o.show()}}}var a=t("boxzilla"),l=window.boxzilla_options;window.Boxzilla=a,window.addEventListener("load",s),window.setTimeout(i,1)}()},{boxzilla:4}],2:[function(t,e,i){"use strict";function n(t,e){for(var i in e)t.style[i]=e[i]}function o(t,e){for(var i={},n=0;n<t.length;n++)i[t[n]]=e;return i}function r(t,e){for(var i={},n=0;n<t.length;n++)i[t[n]]=e[t[n]];return i}function s(t){return!!t.getAttribute("data-animated")}function a(t,e,i){var s="none"!=t.style.display||t.offsetLeft>0,a=t.cloneNode(!0),c=function(){t.removeAttribute("data-animated"),t.setAttribute("style",a.getAttribute("style")),t.style.display=s?"none":"",i&&i()};t.setAttribute("data-animated","true"),s||(t.style.display="");var d,h;if("slide"===e){if(d=o(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],0),h={},!s){var f=window.getComputedStyle(t);if(h=r(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],f),!isFinite(h.height)){var u=t.getBoundingClientRect();h.height=u.height}n(t,d)}t.style.overflowY="hidden",l(t,s?d:h,c)}else d={opacity:0},h={opacity:1},s||n(t,d),l(t,s?d:h,c)}function l(t,e,i){var n=+new Date,o=window.getComputedStyle(t),r={},s={};for(var a in e){e[a]=parseFloat(e[a]);var l=e[a],d=parseFloat(o[a]);d!=l?(s[a]=(l-d)/c,r[a]=d):delete e[a]}var h=function f(){var o,a,l,c,d=+new Date,h=d-n,u=!0;for(var g in e){o=s[g],a=e[g],l=o*h,c=r[g]+l,o>0&&c>=a||o<0&&c<=a?c=a:u=!1,r[g]=c;var m="opacity"!==g?"px":"";t.style[g]=c+m}n=+new Date,u?i&&i():window.requestAnimationFrame&&requestAnimationFrame(f)||setTimeout(f,32)};h()}var c=320;e.exports={toggle:a,animate:l,animated:s}},{}],3:[function(t,e,i){"use strict";function n(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i}function o(){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:"×",screenWidthCondition:null,position:"center",testMode:!1,trigger:!1,closable:!0},a=t("./animator.js"),l=function(t,e){this.id=t,this.config=n(s,e),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.dismissed=!1,this.triggered=!1,this.triggerHeight=this.calculateTriggerHeight(),this.cookieSet=this.isCookieSet(),this.element=null,this.contentElement=null,this.closeIcon=null,this.dom(),this.events()};l.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)},l.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");if(i.className="boxzilla-content",i.innerHTML=this.config.content,e.appendChild(i),this.config.closable&&this.config.icon){var n=document.createElement("span");n.className="boxzilla-close-icon",n.innerHTML=this.config.icon,e.appendChild(n),this.closeIcon=n}document.body.appendChild(t),this.contentElement=i,this.element=e},l.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 n=(e-i)/2;n=n>=0?n:0,this.element.style.marginTop=n+"px"}this.element.style.display=t},l.prototype.toggle=function(t){return"undefined"==typeof t&&(t=!this.visible),t!==this.visible&&(!a.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"),a.toggle(this.overlay,"fade")),a.toggle(this.element,this.config.animation,function(){this.visible||(this.contentElement.innerHTML=this.contentElement.innerHTML)}.bind(this)),!0)))},l.prototype.show=function(){return this.toggle(!0)},l.prototype.hide=function(){return this.toggle(!1)},l.prototype.calculateTriggerHeight=function(){var t=0;if(this.config.trigger)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*o());return t},l.prototype.fits=function(){if(!this.config.screenWidthCondition||!this.config.screenWidthCondition.value)return!0;switch(this.config.screenWidthCondition.condition){case"larger":return window.innerWidth>this.config.screenWidthCondition.value;case"smaller":return window.innerWidth<this.config.screenWidthCondition.value}return!0},l.prototype.onResize=function(){this.triggerHeight=this.calculateTriggerHeight(),this.setCustomBoxStyling()},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||!this.config.trigger)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},l.prototype.setCookie=function(t){var e=new Date;e.setHours(e.getHours()+t),document.cookie="boxzilla_box_"+this.id+"=true; expires="+e.toUTCString()+"; path=/"},l.prototype.trigger=function(){var t=this.show();t&&(this.triggered=!0,this.config.cookie&&this.config.cookie.triggered&&this.setCookie(this.config.cookie.triggered))},l.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,l}},{"./animator.js":2}],4:[function(t,e,i){"use strict";function n(t,e,i){e||(e=250);var n,o;return function(){var r=i||this,s=+new Date,a=arguments;n&&s<n+e?(clearTimeout(o),o=setTimeout(function(){n=s,t.apply(r,a)},e)):(n=s,t.apply(r,a))}}function o(t){27==t.keyCode&&E.dismiss()}function r(){f()||_.forEach(function(t){t.mayAutoShow()&&"pageviews"===t.config.trigger.method&&w>=t.config.trigger.value&&t.trigger()})}function s(){f()||_.forEach(function(t){t.mayAutoShow()&&("time_on_site"===t.config.trigger.method&&b.time>=t.config.trigger.value&&t.trigger(),"time_on_page"===t.config.trigger.method&&y.time>=t.config.trigger.value&&t.trigger())})}function a(){var t=C.hasOwnProperty("pageYOffset")?C.pageYOffset:C.scrollTop;t+=.9*window.innerHeight,_.forEach(function(e){if(e.mayAutoShow()&&!(e.triggerHeight<=0))if(t>e.triggerHeight){if(f())return;e.trigger()}else e.mayRehide()&&e.hide()})}function l(){_.forEach(function(t){t.onResize()})}function c(t){var e=t.offsetX,i=t.offsetY;_.forEach(function(t){var n=t.element.getBoundingClientRect(),o=40;(e<n.left-o||e>n.right+o||i<n.top-o||i>n.bottom+o)&&t.dismiss()})}function d(){v||f()||(_.forEach(function(t){t.mayAutoShow()&&"exit_intent"===t.config.trigger.method&&t.trigger()}),v=!0)}function h(t){var e=400;t.clientY<=0&&(p=window.setTimeout(d,e))}function f(){for(var t=0;t<_.length;t++){var e=_[t];if(e.visible)return!0}return!1}function u(){p&&(window.clearInterval(p),p=null)}function g(t){for(var e=t.target||t.srcElement,i=3,n=0;n<=i&&(e&&"A"!==e.tagName);n++)e=e.parentElement;if(e&&"A"===e.tagName&&e.getAttribute("href")&&0===e.getAttribute("href").toLowerCase().indexOf("#boxzilla-")){var o=e.getAttribute("href").toLowerCase().substring("#boxzilla-".length);E.toggle(o)}}var m,p,v,b,y,w,x=t("wolfy87-eventemitter"),E=Object.create(x.prototype),z=t("./box.js")(E),L=t("./timer.js"),_=[],C=window,k={start:function(){try{var t=sessionStorage.getItem("boxzilla_timer");t&&(b.time=t)}catch(e){}b.start(),y.start()},stop:function(){sessionStorage.setItem("boxzilla_timer",b.time),b.stop(),y.stop()}};E.init=function(){document.body.addEventListener("click",g,!1);try{w=sessionStorage.getItem("boxzilla_pageviews")||0}catch(e){w=0}b=new L(0),y=new L(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),C.addEventListener("touchstart",n(a),!0),C.addEventListener("scroll",n(a),!0),window.addEventListener("resize",n(l)),window.addEventListener("load",l),m.addEventListener("click",c),window.setInterval(s,1e3),window.setTimeout(r,1e3),document.documentElement.addEventListener("mouseleave",h),document.documentElement.addEventListener("mouseenter",u),document.addEventListener("keyup",o),k.start(),window.addEventListener("focus",k.start),window.addEventListener("beforeunload",function(){k.stop(),sessionStorage.setItem("boxzilla_pageviews",++w)}),window.addEventListener("blur",k.stop),E.trigger("ready")},E.create=function(t,e){"undefined"!=typeof e.minimumScreenWidth&&(e.screenWidthCondition={condition:"larger",value:e.minimumScreenWidth});var i=new z(t,e);return _.push(i),i},E.get=function(t){for(var e=0;e<_.length;e++){var i=_[e];if(i.id==t)return i}throw new Error("No box exists with ID "+t)},E.dismiss=function(t){"undefined"==typeof t?_.forEach(function(t){t.dismiss()}):E.get(t).dismiss()},E.hide=function(t){"undefined"==typeof t?_.forEach(function(t){t.hide()}):E.get(t).hide()},E.show=function(t){"undefined"==typeof t?_.forEach(function(t){t.show()}):E.get(t).show()},E.toggle=function(t){"undefined"==typeof t?_.forEach(function(t){t.toggle()}):E.get(t).toggle()},E.boxes=_,window.Boxzilla=E,"undefined"!=typeof e&&e.exports&&(e.exports=E)},{"./box.js":3,"./styles.js":5,"./timer.js":6,"wolfy87-eventemitter":7}],5:[function(t,e,i){"use strict";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}";e.exports=n},{}],6:[function(t,e,i){"use strict";var n=function(t){this.time=t,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(){this.interval&&(window.clearInterval(this.interval),this.interval=0)},e.exports=n},{}],7:[function(t,i,n){(function(){"use strict";function t(){}function n(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function o(t){return function(){return this[t].apply(this,arguments)}}var r=t.prototype,s=this,a=s.EventEmitter;r.getListeners=function(t){var e,i,n=this._getEvents();if(t instanceof RegExp){e={};for(i in n)n.hasOwnProperty(i)&&t.test(i)&&(e[i]=n[i])}else e=n[t]||(n[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,o=this.getListenersAsObject(t),r="object"==typeof e;for(i in o)o.hasOwnProperty(i)&&n(o[i],e)===-1&&o[i].push(r?e:{listener:e,once:!1});return this},r.on=o("addListener"),r.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},r.once=o("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,o,r=this.getListenersAsObject(t);for(o in r)r.hasOwnProperty(o)&&(i=n(r[o],e),i!==-1&&r[o].splice(i,1));return this},r.off=o("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 n,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(n=i.length;n--;)r.call(this,e,i[n]);else for(n in e)e.hasOwnProperty(n)&&(o=e[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},r.removeEvent=function(t){var e,i=typeof t,n=this._getEvents();if("string"===i)delete n[t];else if(t instanceof RegExp)for(e in n)n.hasOwnProperty(e)&&t.test(e)&&delete n[e];else delete this._events;return this},r.removeAllListeners=o("removeEvent"),r.emitEvent=function(t,e){var i,n,o,r,s,a=this.getListenersAsObject(t);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(t,n.listener),s=n.listener.apply(this,e||[]),s===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},r.trigger=o("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=a,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 |
//# sourceMappingURL=script.min.js.map
|
1 |
+
!function(){var t=void 0,e=void 0;!function e(i,n,o){function r(l,a){if(!n[l]){if(!i[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 h=n[l]={exports:{}};i[l][0].call(h.exports,function(t){var e=i[l][1][t];return r(e||t)},h,h.exports,e,i,n,o)}return n[l].exports}for(var s="function"==typeof t&&t,l=0;l<o.length;l++)r(o[l]);return r}({1:[function(t,e,i){"use strict";var n="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,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")}var i=t("boxzilla"),o=window.boxzilla_options;window.Boxzilla=i,window.addEventListener("load",function(){if("object"===n(window.mc4wp_forms_config)&&window.mc4wp_forms_config.submitted_form){var t="#"+window.mc4wp_forms_config.submitted_form.element_id,e=i.boxes;for(var o in e)if(e.hasOwnProperty(o)){var r=e[o];if(r.element.querySelector(t))return void r.show()}}}),window.setTimeout(function(){var t=document.body.className.indexOf("logged-in")>-1;if(!o.inited){t&&o.testMode&&console.log("Boxzilla: Test mode is enabled. Please disable test mode if you're done testing."),i.init();for(var n=0;n<o.boxes.length;n++){var r=o.boxes[n];if(r.testMode=t&&o.testMode,"https:"===window.location.protocol&&window.location.host){var s="http://"+window.location.host,l=s.replace("http://","https://");r.content=r.content.replace(s,l)}var a=i.create(r.id,r);!function(t){(t=Array.from(t)).length&&window.setTimeout(function e(){var i=document.createElement("script");this.src&&(i.src=this.src),i.appendChild(document.createTextNode(this.text)),this.parentNode.removeChild(this),document.body.appendChild(i),t.length&&i.addEventListener("load",e.bind(t.shift()))}.bind(t.shift()),1)}(a.element.querySelectorAll("script")),a.element.className=a.element.className+" boxzilla-"+r.post.slug,e(a.element,r.css),a.element.firstChild.firstChild.className+=" first-child",a.element.firstChild.lastChild.className+=" last-child",a.fits()&&function(t){if(!window.location.hash||0===window.location.hash.length)return!1;var e=window.location.hash.substring(1);return!!/^[a-zA-Z\-\_0-9]+$/.test(e)&&(e===t.element.id||!!t.element.querySelector("#"+e))}(a)&&window.addEventListener("load",a.show.bind(a))}o.inited=!0,i.trigger("done")}},1)}()},{boxzilla:5}],2:[function(t,i,n){(function(){"use strict";function t(){}function n(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function o(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,n=this._getEvents();if(t instanceof RegExp){e={};for(i in n)n.hasOwnProperty(i)&&t.test(i)&&(e[i]=n[i])}else e=n[t]||(n[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={})[t]=i),e||i},r.addListener=function(t,e){var i,o=this.getListenersAsObject(t),r="object"==typeof e;for(i in o)o.hasOwnProperty(i)&&-1===n(o[i],e)&&o[i].push(r?e:{listener:e,once:!1});return this},r.on=o("addListener"),r.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},r.once=o("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,o,r=this.getListenersAsObject(t);for(o in r)r.hasOwnProperty(o)&&-1!==(i=n(r[o],e))&&r[o].splice(i,1);return this},r.off=o("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 n,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(n=i.length;n--;)r.call(this,e,i[n]);else for(n in e)e.hasOwnProperty(n)&&(o=e[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},r.removeEvent=function(t){var e,i=typeof t,n=this._getEvents();if("string"===i)delete n[t];else if(t instanceof RegExp)for(e in n)n.hasOwnProperty(e)&&t.test(e)&&delete n[e];else delete this._events;return this},r.removeAllListeners=o("removeEvent"),r.emitEvent=function(t,e){var i,n,o,r,s=this.getListenersAsObject(t);for(r in s)if(s.hasOwnProperty(r))for(o=(i=s[r].slice(0)).length;o--;)!0===(n=i[o]).once&&this.removeListener(t,n.listener),n.listener.apply(this,e||[])===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},r.trigger=o("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)},{}],3:[function(t,e,i){"use strict";function n(t,e){for(var i in e)t.style[i]=e[i]}function o(t,e,i){var n=+new Date,o=window.getComputedStyle(t),s={},l={};for(var a in e){e[a]=parseFloat(e[a]);var c=e[a],d=parseFloat(o[a]);d!=c?(l[a]=(c-d)/r,s[a]=d):delete e[a]}!function o(){var r,a,c,d,h=+new Date-n,f=!0;for(var u in e){r=l[u],a=e[u],c=r*h,d=s[u]+c,r>0&&d>=a||r<0&&d<=a?d=a:f=!1,s[u]=d;var g="opacity"!==u?"px":"";t.style[u]=d+g}n=+new Date,f?i&&i():window.requestAnimationFrame&&requestAnimationFrame(o)||setTimeout(o,32)}()}var r=320;e.exports={toggle:function(t,e,i){var r="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=r?"none":"",i&&i()};t.setAttribute("data-animated","true"),r||(t.style.display="");var a,c;if("slide"===e){if(a=function(t,e){for(var i={},n=0;n<t.length;n++)i[t[n]]=e;return i}(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],0),c={},!r){if(c=function(t,e){for(var i={},n=0;n<t.length;n++)i[t[n]]=e[t[n]];return i}(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],window.getComputedStyle(t)),!isFinite(c.height)){var d=t.getBoundingClientRect();c.height=d.height}n(t,a)}t.style.overflowY="hidden",o(t,r?a:c,l)}else a={opacity:0},c={opacity:1},r||n(t,a),o(t,r?a:c,l)},animate:o,animated:function(t){return!!t.getAttribute("data-animated")}}},{}],4:[function(t,e,i){"use strict";var n,o={animation:"fade",rehide:!1,content:"",cookie:null,icon:"×",screenWidthCondition:null,position:"center",testMode:!1,trigger:!1,closable:!0},r=t("./animator.js"),s=function(t,e){this.id=t,this.config=function(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i}(o,e),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.dismissed=!1,this.triggered=!1,this.triggerHeight=this.calculateTriggerHeight(),this.cookieSet=this.isCookieSet(),this.element=null,this.contentElement=null,this.closeIcon=null,this.dom(),this.events()};s.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&&n.trigger("box.interactions.link",[t,e.target])},!1),this.element.addEventListener("submit",function(e){t.setCookie(),n.trigger("box.interactions.form",[t,e.target])},!1)},s.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");if(i.className="boxzilla-content",i.innerHTML=this.config.content,e.appendChild(i),this.config.closable&&this.config.icon){var n=document.createElement("span");n.className="boxzilla-close-icon",n.innerHTML=this.config.icon,e.appendChild(n),this.closeIcon=n}document.body.appendChild(t),this.contentElement=i,this.element=e},s.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 n=(e-i)/2;n=n>=0?n:0,this.element.style.marginTop=n+"px"}this.element.style.display=t},s.prototype.toggle=function(t){return void 0===t&&(t=!this.visible),t!==this.visible&&(!r.animated(this.element)&&(!(!t&&!this.config.closable)&&(this.visible=t,this.setCustomBoxStyling(),n.trigger("box."+(t?"show":"hide"),[this]),"center"===this.config.position&&(this.overlay.classList.toggle("boxzilla-"+this.id+"-overlay"),r.toggle(this.overlay,"fade")),r.toggle(this.element,this.config.animation,function(){this.visible||(this.contentElement.innerHTML=this.contentElement.innerHTML)}.bind(this)),!0)))},s.prototype.show=function(){return this.toggle(!0)},s.prototype.hide=function(){return this.toggle(!1)},s.prototype.calculateTriggerHeight=function(){var t=0;if(this.config.trigger)if("element"===this.config.trigger.method){var e=document.body.querySelector(this.config.trigger.value);if(e){t=e.getBoundingClientRect().top}}else"percentage"===this.config.trigger.method&&(t=this.config.trigger.value/100*function(){var t=document.body,e=document.documentElement;return Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight)}());return t},s.prototype.fits=function(){if(!this.config.screenWidthCondition||!this.config.screenWidthCondition.value)return!0;switch(this.config.screenWidthCondition.condition){case"larger":return window.innerWidth>this.config.screenWidthCondition.value;case"smaller":return window.innerWidth<this.config.screenWidthCondition.value}return!0},s.prototype.onResize=function(){this.triggerHeight=this.calculateTriggerHeight(),this.setCustomBoxStyling()},s.prototype.mayAutoShow=function(){return!this.dismissed&&(!!this.fits()&&(!!this.config.trigger&&!this.cookieSet))},s.prototype.mayRehide=function(){return this.config.rehide&&this.triggered},s.prototype.isCookieSet=function(){if(this.config.testMode||!this.config.trigger)return!1;if(!this.config.cookie||!this.config.cookie.triggered&&!this.config.cookie.dismissed)return!1;return"true"===document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*boxzilla_box_"+this.id+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1")},s.prototype.setCookie=function(t){var e=new Date;e.setHours(e.getHours()+t),document.cookie="boxzilla_box_"+this.id+"=true; expires="+e.toUTCString()+"; path=/"},s.prototype.trigger=function(){this.show()&&(this.triggered=!0,this.config.cookie&&this.config.cookie.triggered&&this.setCookie(this.config.cookie.triggered))},s.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,n.trigger("box.dismiss",[this]),!0)},e.exports=function(t){return n=t,s}},{"./animator.js":3}],5:[function(t,e,i){"use strict";function n(t,e,i){e||(e=250);var n,o;return function(){var r=i||this,s=+new Date,l=arguments;n&&s<n+e?(clearTimeout(o),o=setTimeout(function(){n=s,t.apply(r,l)},e)):(n=s,t.apply(r,l))}}function o(t){27==t.keyCode&&E.dismiss()}function r(){f()||_.forEach(function(t){t.mayAutoShow()&&"pageviews"===t.config.trigger.method&&w>=t.config.trigger.value&&t.trigger()})}function s(){f()||_.forEach(function(t){t.mayAutoShow()&&("time_on_site"===t.config.trigger.method&&b.time>=t.config.trigger.value&&t.trigger(),"time_on_page"===t.config.trigger.method&&y.time>=t.config.trigger.value&&t.trigger())})}function l(){var t=C.hasOwnProperty("pageYOffset")?C.pageYOffset:C.scrollTop;t+=.9*window.innerHeight,_.forEach(function(e){if(e.mayAutoShow()&&!(e.triggerHeight<=0))if(t>e.triggerHeight){if(f())return;e.trigger()}else e.mayRehide()&&e.hide()})}function a(){_.forEach(function(t){t.onResize()})}function c(t){var e=t.offsetX,i=t.offsetY;_.forEach(function(t){var n=t.element.getBoundingClientRect();(e<n.left-40||e>n.right+40||i<n.top-40||i>n.bottom+40)&&t.dismiss()})}function d(){v||f()||(_.forEach(function(t){t.mayAutoShow()&&"exit_intent"===t.config.trigger.method&&t.trigger()}),v=!0)}function h(t){t.clientY<=0&&(p=window.setTimeout(d,400))}function f(){for(var t=0;t<_.length;t++){if(_[t].visible)return!0}return!1}function u(){p&&(window.clearInterval(p),p=null)}function g(t){for(var e=t.target||t.srcElement,i=0;i<=3&&(e&&"A"!==e.tagName);i++)e=e.parentElement;if(e&&"A"===e.tagName&&e.getAttribute("href")&&0===e.getAttribute("href").toLowerCase().indexOf("#boxzilla-")){var n=e.getAttribute("href").toLowerCase().substring("#boxzilla-".length);E.toggle(n)}}var m,p,v,b,y,w,x=t("wolfy87-eventemitter"),E=Object.create(x.prototype),z=t("./box.js")(E),L=t("./timer.js"),_=[],C=window,k=function(){try{var t=sessionStorage.getItem("boxzilla_timer");t&&(b.time=t)}catch(t){}b.start(),y.start()},S=function(){sessionStorage.setItem("boxzilla_timer",b.time),b.stop(),y.stop()};E.init=function(){document.body.addEventListener("click",g,!0);try{w=sessionStorage.getItem("boxzilla_pageviews")||0}catch(t){w=0}b=new L(0),y=new L(0);var e=t("./styles.js"),i=document.createElement("style");i.setAttribute("type","text/css"),i.innerHTML=e,document.head.appendChild(i),(m=document.createElement("div")).style.display="none",m.id="boxzilla-overlay",document.body.appendChild(m),C.addEventListener("touchstart",n(l),!0),C.addEventListener("scroll",n(l),!0),window.addEventListener("resize",n(a)),window.addEventListener("load",a),m.addEventListener("click",c),window.setInterval(s,1e3),window.setTimeout(r,1e3),document.documentElement.addEventListener("mouseleave",h),document.documentElement.addEventListener("mouseenter",u),document.addEventListener("keyup",o),k(),window.addEventListener("focus",k),window.addEventListener("beforeunload",function(){S(),sessionStorage.setItem("boxzilla_pageviews",++w)}),window.addEventListener("blur",S),E.trigger("ready")},E.create=function(t,e){void 0!==e.minimumScreenWidth&&(e.screenWidthCondition={condition:"larger",value:e.minimumScreenWidth});var i=new z(t,e);return _.push(i),i},E.get=function(t){for(var e=0;e<_.length;e++){var i=_[e];if(i.id==t)return i}throw new Error("No box exists with ID "+t)},E.dismiss=function(t){void 0===t?_.forEach(function(t){t.dismiss()}):E.get(t).dismiss()},E.hide=function(t){void 0===t?_.forEach(function(t){t.hide()}):E.get(t).hide()},E.show=function(t){void 0===t?_.forEach(function(t){t.show()}):E.get(t).show()},E.toggle=function(t){void 0===t?_.forEach(function(t){t.toggle()}):E.get(t).toggle()},E.boxes=_,window.Boxzilla=E,void 0!==e&&e.exports&&(e.exports=E)},{"./box.js":4,"./styles.js":6,"./timer.js":7,"wolfy87-eventemitter":2}],6:[function(t,e,i){"use strict";e.exports="#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}"},{}],7:[function(t,e,i){"use strict";var n=function(t){this.time=t,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(){this.interval&&(window.clearInterval(this.interval),this.interval=0)},e.exports=n},{}]},{},[1])}();
|
2 |
//# sourceMappingURL=script.min.js.map
|
assets/js/script.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["script.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","_typeof","Symbol","iterator","obj","constructor","prototype","css","element","styles","background_color","style","background","color","border_color","borderColor","border_width","borderWidth","parseInt","border_style","borderStyle","width","maxWidth","createBoxesFromConfig","isLoggedIn","document","body","className","indexOf","options","inited","testMode","console","log","Boxzilla","init","boxes","boxOpts","window","location","protocol","host","replace","content","box","create","id","scripts","querySelectorAll","handleScriptElements","post","slug","firstChild","lastChild","fits","locationHashRefersBox","addEventListener","show","bind","trigger","hash","elementId","substring","regex","test","querySelector","handle","script","createElement","this","src","appendChild","createTextNode","text","parentNode","removeChild","shift","Array","from","setTimeout","openMailChimpForWordPressBox","mc4wp_forms_config","submitted_form","selector","element_id","boxId","hasOwnProperty","boxzilla_options","boxzilla","2","property","initObjectProperties","properties","value","newObject","copyObjectProperties","object","animated","getAttribute","toggle","animation","callbackFn","nowVisible","display","offsetLeft","clone","cloneNode","cleanup","removeAttribute","setAttribute","hiddenStyles","visibleStyles","computedStyles","getComputedStyle","isFinite","height","clientRect","getBoundingClientRect","overflowY","animate","opacity","targetStyles","fn","last","Date","initialStyles","currentStyles","propSteps","parseFloat","to","current","duration","tick","step","increment","newValue","now","timeSinceLastTick","done","suffix","requestAnimationFrame","3","merge","obj1","obj2","obj3","attrname","getDocumentHeight","html","documentElement","Math","max","scrollHeight","offsetHeight","clientHeight","defaults","rehide","cookie","icon","screenWidthCondition","position","closable","Animator","Box","config","overlay","getElementById","visible","dismissed","triggered","triggerHeight","calculateTriggerHeight","cookieSet","isCookieSet","contentElement","closeIcon","dom","events","dismiss","target","tagName","setCookie","wrapper","innerHTML","setCustomBoxStyling","origDisplay","maxHeight","windowHeight","innerHeight","boxHeight","newTopMargin","marginTop","classList","hide","method","triggerElement","offset","top","condition","innerWidth","onResize","mayAutoShow","mayRehide","RegExp","hours","expiryDate","setHours","getHours","toUTCString","shown","preventDefault","_Boxzilla","./animator.js","4","throttle","threshhold","scope","deferTimer","context","args","arguments","clearTimeout","apply","onKeyUp","keyCode","checkPageViewsCriteria","isAnyBoxVisible","forEach","pageViews","checkTimeCriteria","siteTimer","time","pageTimer","checkHeightCriteria","scrollY","scrollElement","pageYOffset","scrollTop","recalculateHeights","onOverlayClick","x","offsetX","y","offsetY","rect","margin","left","right","bottom","triggerExitIntent","exitIntentTriggered","onMouseLeave","delay","clientY","exitIntentDelayTimer","onMouseEnter","clearInterval","onElementClick","el","srcElement","depth","parentElement","toLowerCase","EventEmitter","Object","Timer","timers","start","sessionTime","sessionStorage","getItem","stop","setItem","styleElement","head","setInterval","opts","minimumScreenWidth","push","get","./box.js","./styles.js","./timer.js","wolfy87-eventemitter","5","6","interval","7","indexOfListener","listeners","listener","alias","name","proto","originalGlobalValue","getListeners","evt","response","key","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","listenerIsWrapped","once","on","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","type","_events","removeAllListeners","emitEvent","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAgEC,EAASD,QAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATV,IAAqBA,CAAQ,KAAIS,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGG,EAAE,MAAOA,GAAEH,GAAE,EAAI,IAAII,GAAE,GAAIC,OAAM,uBAAuBL,EAAE,IAAK,MAAMI,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEV,EAAEG,IAAIQ,WAAYZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,GAAI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O,EACjBxB,MAWXgO,EAAMmC,oBAAsB,WACxB,OAAInQ,KAAKiB,eAAe,qBACbjB,KAAKsQ,kBAapBtC,EAAMM,WAAa,WACf,MAAOtO,MAAK8P,UAAY9P,KAAK8P,aAQjC5D,EAAaqE,WAAa,WAEtB,MADAhV,GAAQ2Q,aAAe+B,EAChB/B,GAIW,kBAAXzR,IAAyBA,EAAO+V,IACvC/V,EAAO,WACH,MAAOyR,KAGY,gBAAXvQ,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAU2Q,EAGjB3Q,EAAQ2Q,aAAeA,IAE7B1Q,KAAKwE,gBAEI","file":"script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n(function () {\n 'use strict';\n\n var Boxzilla = require('boxzilla');\n var options = window.boxzilla_options;\n\n // expose Boxzilla object to window\n window.Boxzilla = Boxzilla;\n\n // helper function for setting CSS styles\n function css(element, styles) {\n if (styles.background_color) {\n element.style.background = styles.background_color;\n }\n\n if (styles.color) {\n element.style.color = styles.color;\n }\n\n if (styles.border_color) {\n element.style.borderColor = styles.border_color;\n }\n\n if (styles.border_width) {\n element.style.borderWidth = parseInt(styles.border_width) + \"px\";\n }\n\n if (styles.border_style) {\n element.style.borderStyle = styles.border_style;\n }\n\n if (styles.width) {\n element.style.maxWidth = parseInt(styles.width) + \"px\";\n }\n }\n\n function createBoxesFromConfig() {\n var isLoggedIn = document.body.className.indexOf('logged-in') > -1;\n\n // failsafe against including script twice.\n if (options.inited) {\n return;\n }\n\n // print message when test mode is enabled\n if (isLoggedIn && options.testMode) {\n console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\\'re done testing.');\n }\n\n // init boxzilla\n Boxzilla.init();\n\n // create boxes from options\n for (var i = 0; i < options.boxes.length; i++) {\n // get opts\n var boxOpts = options.boxes[i];\n boxOpts.testMode = isLoggedIn && options.testMode;\n\n // fix http:// links in box content....\n if (window.location.protocol === \"https:\" && window.location.host) {\n var o = \"http://\" + window.location.host;\n var n = o.replace('http://', 'https://');\n boxOpts.content = boxOpts.content.replace(o, n);\n }\n\n // create box\n var box = Boxzilla.create(boxOpts.id, boxOpts);\n\n // remove <script> from box content and append them to the document body\n var scripts = box.element.querySelectorAll('script');\n handleScriptElements(scripts);\n\n // add box slug to box element as classname\n box.element.className = box.element.className + ' boxzilla-' + boxOpts.post.slug;\n\n // add custom css to box\n css(box.element, boxOpts.css);\n\n box.element.firstChild.firstChild.className += \" first-child\";\n box.element.firstChild.lastChild.className += \" last-child\";\n\n // maybe show box right away\n if (box.fits() && locationHashRefersBox(box)) {\n window.addEventListener('load', box.show.bind(box));\n }\n }\n\n // set flag to prevent initialising twice\n options.inited = true;\n\n // trigger \"done\" event.\n Boxzilla.trigger('done');\n }\n\n function locationHashRefersBox(box) {\n if (!window.location.hash || 0 === window.location.hash.length) {\n return false;\n }\n\n var elementId = window.location.hash.substring(1);\n\n // only attempt on strings looking like an ID \n var regex = /^[a-zA-Z\\-\\_0-9]+$/;\n if (!regex.test(elementId)) {\n return false;\n }\n\n if (elementId === box.element.id) {\n return true;\n } else if (box.element.querySelector('#' + elementId)) {\n return true;\n }\n\n return false;\n }\n\n function handleScriptElements(scripts) {\n var handle = function handle() {\n var script = document.createElement('script');\n\n if (this.src) {\n script.src = this.src;\n }\n script.appendChild(document.createTextNode(this.text));\n this.parentNode.removeChild(this);\n document.body.appendChild(script);\n\n if (scripts.length) {\n script.addEventListener('load', handle.bind(scripts.shift()));\n }\n };\n\n scripts = Array.from(scripts);\n if (scripts.length) {\n window.setTimeout(handle.bind(scripts.shift()), 1);\n }\n }\n\n function openMailChimpForWordPressBox() {\n if (_typeof(window.mc4wp_forms_config) !== \"object\" || !window.mc4wp_forms_config.submitted_form) {\n return;\n }\n\n var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;\n var boxes = Boxzilla.boxes;\n for (var boxId in boxes) {\n if (!boxes.hasOwnProperty(boxId)) {\n continue;\n }\n var box = boxes[boxId];\n if (box.element.querySelector(selector)) {\n box.show();\n return;\n }\n }\n }\n\n window.addEventListener('load', openMailChimpForWordPressBox);\n window.setTimeout(createBoxesFromConfig, 1);\n})();\n\n},{\"boxzilla\":4}],2:[function(require,module,exports){\n'use strict';\n\nvar duration = 320;\n\nfunction css(element, styles) {\n for (var property in styles) {\n element.style[property] = styles[property];\n }\n}\n\nfunction initObjectProperties(properties, value) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = value;\n }\n return newObject;\n}\n\nfunction copyObjectProperties(properties, object) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = object[properties[i]];\n }\n return newObject;\n}\n\n/**\n * Checks if the given element is currently being animated.\n *\n * @param element\n * @returns {boolean}\n */\nfunction animated(element) {\n return !!element.getAttribute('data-animated');\n}\n\n/**\n * Toggles the element using the given animation.\n *\n * @param element\n * @param animation Either \"fade\" or \"slide\"\n */\nfunction toggle(element, animation, callbackFn) {\n var nowVisible = element.style.display != 'none' || element.offsetLeft > 0;\n\n // create clone for reference\n var clone = element.cloneNode(true);\n var cleanup = function cleanup() {\n element.removeAttribute('data-animated');\n element.setAttribute('style', clone.getAttribute('style'));\n element.style.display = nowVisible ? 'none' : '';\n if (callbackFn) {\n callbackFn();\n }\n };\n\n // store attribute so everyone knows we're animating this element\n element.setAttribute('data-animated', \"true\");\n\n // toggle element visiblity right away if we're making something visible\n if (!nowVisible) {\n element.style.display = '';\n }\n\n var hiddenStyles, visibleStyles;\n\n // animate properties\n if (animation === 'slide') {\n hiddenStyles = initObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], 0);\n visibleStyles = {};\n\n if (!nowVisible) {\n var computedStyles = window.getComputedStyle(element);\n visibleStyles = copyObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], computedStyles);\n\n // in some browsers, getComputedStyle returns \"auto\" value. this falls back to getBoundingClientRect() in those browsers since we need an actual height.\n if (!isFinite(visibleStyles.height)) {\n var clientRect = element.getBoundingClientRect();\n visibleStyles.height = clientRect.height;\n }\n css(element, hiddenStyles);\n }\n\n // don't show a scrollbar during animation\n element.style.overflowY = 'hidden';\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n } else {\n hiddenStyles = { opacity: 0 };\n visibleStyles = { opacity: 1 };\n if (!nowVisible) {\n css(element, hiddenStyles);\n }\n\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n }\n}\n\nfunction animate(element, targetStyles, fn) {\n var last = +new Date();\n var initialStyles = window.getComputedStyle(element);\n var currentStyles = {};\n var propSteps = {};\n\n for (var property in targetStyles) {\n // make sure we have an object filled with floats\n targetStyles[property] = parseFloat(targetStyles[property]);\n\n // calculate step size & current value\n var to = targetStyles[property];\n var current = parseFloat(initialStyles[property]);\n\n // is there something to do?\n if (current == to) {\n delete targetStyles[property];\n continue;\n }\n\n propSteps[property] = (to - current) / duration; // points per second\n currentStyles[property] = current;\n }\n\n var tick = function tick() {\n var now = +new Date();\n var timeSinceLastTick = now - last;\n var done = true;\n\n var step, to, increment, newValue;\n for (var property in targetStyles) {\n step = propSteps[property];\n to = targetStyles[property];\n increment = step * timeSinceLastTick;\n newValue = currentStyles[property] + increment;\n\n if (step > 0 && newValue >= to || step < 0 && newValue <= to) {\n newValue = to;\n } else {\n done = false;\n }\n\n // store new value\n currentStyles[property] = newValue;\n\n var suffix = property !== \"opacity\" ? \"px\" : \"\";\n element.style[property] = newValue + suffix;\n }\n\n last = +new Date();\n\n // keep going until we're done for all props\n if (!done) {\n window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);\n } else {\n // call callback\n fn && fn();\n }\n };\n\n tick();\n}\n\nmodule.exports = {\n 'toggle': toggle,\n 'animate': animate,\n 'animated': animated\n};\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar defaults = {\n 'animation': 'fade',\n 'rehide': false,\n 'content': '',\n 'cookie': null,\n 'icon': '×',\n 'screenWidthCondition': null,\n 'position': 'center',\n 'testMode': false,\n 'trigger': false,\n 'closable': true\n},\n Boxzilla,\n Animator = require('./animator.js');\n\n/**\n* Merge 2 objects, values of the latter overwriting the former.\n*\n* @param obj1\n* @param obj2\n* @returns {*}\n*/\nfunction merge(obj1, obj2) {\n var obj3 = {};\n for (var attrname in obj1) {\n obj3[attrname] = obj1[attrname];\n }\n for (var attrname in obj2) {\n obj3[attrname] = obj2[attrname];\n }\n return obj3;\n}\n\n/**\n* Get the real height of entire document.\n* @returns {number}\n*/\nfunction getDocumentHeight() {\n var body = document.body,\n html = document.documentElement;\n\n var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n\n return height;\n}\n\n// Box Object\nvar Box = function Box(id, config) {\n this.id = id;\n\n // store config values\n this.config = merge(defaults, config);\n\n // store ref to overlay\n this.overlay = document.getElementById('boxzilla-overlay');\n\n // state\n this.visible = false;\n this.dismissed = false;\n this.triggered = false;\n this.triggerHeight = this.calculateTriggerHeight();\n this.cookieSet = this.isCookieSet();\n this.element = null;\n this.contentElement = null;\n this.closeIcon = null;\n\n // create dom elements for this box\n this.dom();\n\n // further initialise the box\n this.events();\n};\n\n// initialise the box\nBox.prototype.events = function () {\n var box = this;\n\n // attach event to \"close\" icon inside box\n if (this.closeIcon) {\n this.closeIcon.addEventListener('click', this.dismiss.bind(this));\n }\n\n this.element.addEventListener('click', function (e) {\n if (e.target.tagName === 'A') {\n Boxzilla.trigger('box.interactions.link', [box, e.target]);\n }\n }, false);\n\n this.element.addEventListener('submit', function (e) {\n box.setCookie();\n Boxzilla.trigger('box.interactions.form', [box, e.target]);\n }, false);\n};\n\n// generate dom elements for this box\nBox.prototype.dom = function () {\n var wrapper = document.createElement('div');\n wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';\n\n var box = document.createElement('div');\n box.setAttribute('id', 'boxzilla-' + this.id);\n box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;\n box.style.display = 'none';\n wrapper.appendChild(box);\n\n var content = document.createElement('div');\n content.className = 'boxzilla-content';\n content.innerHTML = this.config.content;\n box.appendChild(content);\n\n if (this.config.closable && this.config.icon) {\n var closeIcon = document.createElement('span');\n closeIcon.className = \"boxzilla-close-icon\";\n closeIcon.innerHTML = this.config.icon;\n box.appendChild(closeIcon);\n this.closeIcon = closeIcon;\n }\n\n document.body.appendChild(wrapper);\n this.contentElement = content;\n this.element = box;\n};\n\n// set (calculate) custom box styling depending on box options\nBox.prototype.setCustomBoxStyling = function () {\n\n // reset element to its initial state\n var origDisplay = this.element.style.display;\n this.element.style.display = '';\n this.element.style.overflowY = 'auto';\n this.element.style.maxHeight = 'none';\n\n // get new dimensions\n var windowHeight = window.innerHeight;\n var boxHeight = this.element.clientHeight;\n\n // add scrollbar to box and limit height\n if (boxHeight > windowHeight) {\n this.element.style.maxHeight = windowHeight + \"px\";\n this.element.style.overflowY = 'scroll';\n }\n\n // set new top margin for boxes which are centered\n if (this.config.position === 'center') {\n var newTopMargin = (windowHeight - boxHeight) / 2;\n newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;\n this.element.style.marginTop = newTopMargin + \"px\";\n }\n\n this.element.style.display = origDisplay;\n};\n\n// toggle visibility of the box\nBox.prototype.toggle = function (show) {\n\n // revert visibility if no explicit argument is given\n if (typeof show === \"undefined\") {\n show = !this.visible;\n }\n\n // is box already at desired visibility?\n if (show === this.visible) {\n return false;\n }\n\n // is box being animated?\n if (Animator.animated(this.element)) {\n return false;\n }\n\n // if box should be hidden but is not closable, bail.\n if (!show && !this.config.closable) {\n return false;\n }\n\n // set new visibility status\n this.visible = show;\n\n // calculate new styling rules\n this.setCustomBoxStyling();\n\n // trigger event\n Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]);\n\n // show or hide box using selected animation\n if (this.config.position === 'center') {\n this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');\n Animator.toggle(this.overlay, \"fade\");\n }\n\n Animator.toggle(this.element, this.config.animation, function () {\n if (this.visible) {\n return;\n }\n this.contentElement.innerHTML = this.contentElement.innerHTML;\n }.bind(this));\n\n return true;\n};\n\n// show the box\nBox.prototype.show = function () {\n return this.toggle(true);\n};\n\n// hide the box\nBox.prototype.hide = function () {\n return this.toggle(false);\n};\n\n// calculate trigger height\nBox.prototype.calculateTriggerHeight = function () {\n var triggerHeight = 0;\n\n if (this.config.trigger) {\n if (this.config.trigger.method === 'element') {\n var triggerElement = document.body.querySelector(this.config.trigger.value);\n if (triggerElement) {\n var offset = triggerElement.getBoundingClientRect();\n triggerHeight = offset.top;\n }\n } else if (this.config.trigger.method === 'percentage') {\n triggerHeight = this.config.trigger.value / 100 * getDocumentHeight();\n }\n }\n\n return triggerHeight;\n};\n\nBox.prototype.fits = function () {\n if (!this.config.screenWidthCondition || !this.config.screenWidthCondition.value) {\n return true;\n }\n\n switch (this.config.screenWidthCondition.condition) {\n case \"larger\":\n return window.innerWidth > this.config.screenWidthCondition.value;\n case \"smaller\":\n return window.innerWidth < this.config.screenWidthCondition.value;\n }\n\n // meh.. condition should be \"smaller\" or \"larger\", just return true.\n return true;\n};\n\nBox.prototype.onResize = function () {\n this.triggerHeight = this.calculateTriggerHeight();\n this.setCustomBoxStyling();\n};\n\n// is this box enabled?\nBox.prototype.mayAutoShow = function () {\n\n if (this.dismissed) {\n return false;\n }\n\n // check if box fits on given minimum screen width\n if (!this.fits()) {\n return false;\n }\n\n // if trigger empty or error in calculating triggerHeight, return false\n if (!this.config.trigger) {\n return false;\n }\n\n // rely on cookie value (show if not set, don't show if set)\n return !this.cookieSet;\n};\n\nBox.prototype.mayRehide = function () {\n return this.config.rehide && this.triggered;\n};\n\nBox.prototype.isCookieSet = function () {\n // always show on test mode or when no auto-trigger is configured\n if (this.config.testMode || !this.config.trigger) {\n return false;\n }\n\n // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.\n if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {\n return false;\n }\n\n var cookieSet = document.cookie.replace(new RegExp(\"(?:(?:^|.*;)\\\\s*\" + 'boxzilla_box_' + this.id + \"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"), \"$1\") === \"true\";\n return cookieSet;\n};\n\n// set cookie that disables automatically showing the box\nBox.prototype.setCookie = function (hours) {\n var expiryDate = new Date();\n expiryDate.setHours(expiryDate.getHours() + hours);\n document.cookie = 'boxzilla_box_' + this.id + '=true; expires=' + expiryDate.toUTCString() + '; path=/';\n};\n\nBox.prototype.trigger = function () {\n var shown = this.show();\n if (!shown) {\n return;\n }\n\n this.triggered = true;\n if (this.config.cookie && this.config.cookie.triggered) {\n this.setCookie(this.config.cookie.triggered);\n }\n};\n\n/**\n* Dismisses the box and optionally sets a cookie.\n*\n* @param e The event that triggered this dismissal.\n* @returns {boolean}\n*/\nBox.prototype.dismiss = function (e) {\n // prevent default action\n e && e.preventDefault();\n\n // only dismiss box if it's currently open.\n if (!this.visible) {\n return false;\n }\n\n // hide box element\n this.hide();\n\n // set cookie\n if (this.config.cookie && this.config.cookie.dismissed) {\n this.setCookie(this.config.cookie.dismissed);\n }\n\n this.dismissed = true;\n Boxzilla.trigger('box.dismiss', [this]);\n return true;\n};\n\nmodule.exports = function (_Boxzilla) {\n Boxzilla = _Boxzilla;\n return Box;\n};\n\n},{\"./animator.js\":2}],4:[function(require,module,exports){\n'use strict';\n\nvar EventEmitter = require('wolfy87-eventemitter'),\n Boxzilla = Object.create(EventEmitter.prototype),\n Box = require('./box.js')(Boxzilla),\n Timer = require('./timer.js'),\n boxes = [],\n overlay,\n scrollElement = window,\n exitIntentDelayTimer,\n exitIntentTriggered,\n siteTimer,\n pageTimer,\n pageViews;\n\nfunction throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n var last, deferTimer;\n return function () {\n var context = scope || this;\n\n var now = +new Date(),\n args = arguments;\n if (last && now < last + threshhold) {\n // hold on to it\n clearTimeout(deferTimer);\n deferTimer = setTimeout(function () {\n last = now;\n fn.apply(context, args);\n }, threshhold);\n } else {\n last = now;\n fn.apply(context, args);\n }\n };\n}\n\n// \"keyup\" listener\nfunction onKeyUp(e) {\n if (e.keyCode == 27) {\n Boxzilla.dismiss();\n }\n}\n\n// check \"pageviews\" criteria for each box\nfunction checkPageViewsCriteria() {\n\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {\n box.trigger();\n }\n });\n}\n\n// check time trigger criteria for each box\nfunction checkTimeCriteria() {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n // check \"time on site\" trigger\n if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n\n // check \"time on page\" trigger\n if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n });\n}\n\n// check triggerHeight criteria for all boxes\nfunction checkHeightCriteria() {\n\n var scrollY = scrollElement.hasOwnProperty('pageYOffset') ? scrollElement.pageYOffset : scrollElement.scrollTop;\n scrollY = scrollY + window.innerHeight * 0.9;\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow() || box.triggerHeight <= 0) {\n return;\n }\n\n if (scrollY > box.triggerHeight) {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n // trigger box\n box.trigger();\n } else if (box.mayRehide()) {\n box.hide();\n }\n });\n}\n\n// recalculate heights and variables based on height\nfunction recalculateHeights() {\n boxes.forEach(function (box) {\n box.onResize();\n });\n}\n\nfunction onOverlayClick(e) {\n var x = e.offsetX;\n var y = e.offsetY;\n\n // calculate if click was less than 40px outside box to avoid closing it by accident\n boxes.forEach(function (box) {\n var rect = box.element.getBoundingClientRect();\n var margin = 40;\n\n // if click was not anywhere near box, dismiss it.\n if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {\n box.dismiss();\n }\n });\n}\n\nfunction triggerExitIntent() {\n // do nothing if already triggered OR another box is visible.\n if (exitIntentTriggered || isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {\n box.trigger();\n }\n });\n\n exitIntentTriggered = true;\n}\n\nfunction onMouseLeave(e) {\n var delay = 400;\n\n // did mouse leave at top of window?\n if (e.clientY <= 0) {\n exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);\n }\n}\n\nfunction isAnyBoxVisible() {\n\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n\n if (box.visible) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction onMouseEnter() {\n if (exitIntentDelayTimer) {\n window.clearInterval(exitIntentDelayTimer);\n exitIntentDelayTimer = null;\n }\n}\n\nfunction onElementClick(e) {\n // find <a> element in up to 3 parent elements\n var el = e.target || e.srcElement;\n var depth = 3;\n for (var i = 0; i <= depth; i++) {\n if (!el || el.tagName === 'A') {\n break;\n }\n\n el = el.parentElement;\n }\n\n if (!el || el.tagName !== 'A' || !el.getAttribute('href')) {\n return;\n }\n\n if (el.getAttribute('href').toLowerCase().indexOf('#boxzilla-') === 0) {\n var boxId = el.getAttribute('href').toLowerCase().substring(\"#boxzilla-\".length);\n Boxzilla.toggle(boxId);\n }\n}\n\nvar timers = {\n start: function start() {\n try {\n var sessionTime = sessionStorage.getItem('boxzilla_timer');\n if (sessionTime) siteTimer.time = sessionTime;\n } catch (e) {}\n siteTimer.start();\n pageTimer.start();\n },\n stop: function stop() {\n sessionStorage.setItem('boxzilla_timer', siteTimer.time);\n siteTimer.stop();\n pageTimer.stop();\n }\n};\n\n// initialise & add event listeners\nBoxzilla.init = function () {\n document.body.addEventListener('click', onElementClick, false);\n\n try {\n pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;\n } catch (e) {\n pageViews = 0;\n }\n\n siteTimer = new Timer(0);\n pageTimer = new Timer(0);\n\n // insert styles into DOM\n var styles = require('./styles.js');\n var styleElement = document.createElement('style');\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = styles;\n document.head.appendChild(styleElement);\n\n // add overlay element to dom\n overlay = document.createElement('div');\n overlay.style.display = 'none';\n overlay.id = 'boxzilla-overlay';\n document.body.appendChild(overlay);\n\n // event binds\n scrollElement.addEventListener('touchstart', throttle(checkHeightCriteria), true);\n scrollElement.addEventListener('scroll', throttle(checkHeightCriteria), true);\n window.addEventListener('resize', throttle(recalculateHeights));\n window.addEventListener('load', recalculateHeights);\n overlay.addEventListener('click', onOverlayClick);\n window.setInterval(checkTimeCriteria, 1000);\n window.setTimeout(checkPageViewsCriteria, 1000);\n document.documentElement.addEventListener('mouseleave', onMouseLeave);\n document.documentElement.addEventListener('mouseenter', onMouseEnter);\n document.addEventListener('keyup', onKeyUp);\n\n timers.start();\n window.addEventListener('focus', timers.start);\n window.addEventListener('beforeunload', function () {\n timers.stop();\n sessionStorage.setItem('boxzilla_pageviews', ++pageViews);\n });\n window.addEventListener('blur', timers.stop);\n\n Boxzilla.trigger('ready');\n};\n\n/**\n * Create a new Box\n *\n * @param string id\n * @param object opts\n *\n * @returns Box\n */\nBoxzilla.create = function (id, opts) {\n\n // preserve backwards compat for minimumScreenWidth option\n if (typeof opts.minimumScreenWidth !== \"undefined\") {\n opts.screenWidthCondition = {\n condition: \"larger\",\n value: opts.minimumScreenWidth\n };\n }\n\n var box = new Box(id, opts);\n boxes.push(box);\n return box;\n};\n\nBoxzilla.get = function (id) {\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n if (box.id == id) {\n return box;\n }\n }\n\n throw new Error(\"No box exists with ID \" + id);\n};\n\n// dismiss a single box (or all by omitting id param)\nBoxzilla.dismiss = function (id) {\n // if no id given, dismiss all current open boxes\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.dismiss();\n });\n } else {\n Boxzilla.get(id).dismiss();\n }\n};\n\nBoxzilla.hide = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.hide();\n });\n } else {\n Boxzilla.get(id).hide();\n }\n};\n\nBoxzilla.show = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.show();\n });\n } else {\n Boxzilla.get(id).show();\n }\n};\n\nBoxzilla.toggle = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.toggle();\n });\n } else {\n Boxzilla.get(id).toggle();\n }\n};\n\n// expose each individual box.\nBoxzilla.boxes = boxes;\n\n// expose boxzilla object\nwindow.Boxzilla = Boxzilla;\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = Boxzilla;\n}\n\n},{\"./box.js\":3,\"./styles.js\":5,\"./timer.js\":6,\"wolfy87-eventemitter\":7}],5:[function(require,module,exports){\n\"use strict\";\n\nvar styles = \"#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}\";\nmodule.exports = styles;\n\n},{}],6:[function(require,module,exports){\n'use strict';\n\nvar Timer = function Timer(start) {\n this.time = start;\n this.interval = 0;\n};\n\nTimer.prototype.tick = function () {\n this.time++;\n};\n\nTimer.prototype.start = function () {\n if (!this.interval) {\n this.interval = window.setInterval(this.tick.bind(this), 1000);\n }\n};\n\nTimer.prototype.stop = function () {\n if (this.interval) {\n window.clearInterval(this.interval);\n this.interval = 0;\n }\n};\n\nmodule.exports = Timer;\n\n},{}],7:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}]},{},[1]);\n; })();"]}
|
1 |
+
{"version":3,"sources":["script.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","_typeof","Symbol","iterator","obj","constructor","prototype","css","element","styles","background_color","style","background","color","border_color","borderColor","border_width","borderWidth","parseInt","border_style","borderStyle","width","maxWidth","Boxzilla","options","window","boxzilla_options","addEventListener","mc4wp_forms_config","submitted_form","selector","element_id","boxes","boxId","hasOwnProperty","box","querySelector","show","setTimeout","isLoggedIn","document","body","className","indexOf","inited","testMode","console","log","init","boxOpts","location","protocol","host","replace","content","create","id","scripts","Array","from","handle","script","createElement","this","src","appendChild","createTextNode","text","parentNode","removeChild","bind","shift","handleScriptElements","querySelectorAll","post","slug","firstChild","lastChild","fits","hash","elementId","substring","test","locationHashRefersBox","trigger","boxzilla","2","EventEmitter","indexOfListener","listeners","listener","alias","name","apply","arguments","proto","originalGlobalValue","getListeners","evt","response","key","events","_getEvents","RegExp","flattenListeners","flatListeners","push","getListenersAsObject","addListener","listenerIsWrapped","once","on","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","remove","value","single","multiple","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd","3","property","animate","targetStyles","fn","last","Date","initialStyles","getComputedStyle","currentStyles","propSteps","parseFloat","to","current","duration","tick","step","increment","newValue","timeSinceLastTick","done","suffix","requestAnimationFrame","toggle","animation","callbackFn","nowVisible","display","offsetLeft","clone","cloneNode","cleanup","removeAttribute","setAttribute","getAttribute","hiddenStyles","visibleStyles","properties","newObject","initObjectProperties","object","copyObjectProperties","isFinite","height","clientRect","getBoundingClientRect","overflowY","opacity","animated","4","defaults","rehide","cookie","icon","screenWidthCondition","position","closable","Animator","Box","config","obj1","obj2","obj3","attrname","merge","overlay","getElementById","visible","dismissed","triggered","triggerHeight","calculateTriggerHeight","cookieSet","isCookieSet","contentElement","closeIcon","dom","dismiss","target","tagName","setCookie","wrapper","innerHTML","setCustomBoxStyling","origDisplay","maxHeight","windowHeight","innerHeight","boxHeight","clientHeight","newTopMargin","marginTop","classList","hide","method","triggerElement","top","html","documentElement","Math","max","scrollHeight","offsetHeight","getDocumentHeight","condition","innerWidth","onResize","mayAutoShow","mayRehide","hours","expiryDate","setHours","getHours","toUTCString","preventDefault","_Boxzilla","./animator.js","5","throttle","threshhold","scope","deferTimer","context","now","clearTimeout","onKeyUp","keyCode","checkPageViewsCriteria","isAnyBoxVisible","forEach","pageViews","checkTimeCriteria","siteTimer","time","pageTimer","checkHeightCriteria","scrollY","scrollElement","pageYOffset","scrollTop","recalculateHeights","onOverlayClick","x","offsetX","y","offsetY","rect","left","right","bottom","triggerExitIntent","exitIntentTriggered","onMouseLeave","clientY","exitIntentDelayTimer","onMouseEnter","clearInterval","onElementClick","el","srcElement","parentElement","toLowerCase","Object","Timer","timers","sessionTime","sessionStorage","getItem","start","setItem","stop","styleElement","head","setInterval","opts","minimumScreenWidth","get","./box.js","./styles.js","./timer.js","wolfy87-eventemitter","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hCAGPuU,GAAG,SAASvV,EAAQoB,EAAOJ,GACjC,aAEA,IAAIoT,EAAQ,SAAeK,GACvBtP,KAAKmN,KAAOmC,EACZtP,KAAKqQ,SAAW,GAGpBpB,EAAM1S,UAAUsJ,KAAO,WACnB7F,KAAKmN,QAGT8B,EAAM1S,UAAU+S,MAAQ,WACftP,KAAKqQ,WACNrQ,KAAKqQ,SAAW3S,OAAOiS,YAAY3P,KAAK6F,KAAKtF,KAAKP,MAAO,OAIjEiP,EAAM1S,UAAUiT,KAAO,WACfxP,KAAKqQ,WACL3S,OAAOgR,cAAc1O,KAAKqQ,UAC1BrQ,KAAKqQ,SAAW,IAIxBpU,EAAOJ,QAAUoT,YAEN,IApgDX","file":"script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n(function () {\n 'use strict';\n\n var Boxzilla = require('boxzilla');\n var options = window.boxzilla_options;\n\n // expose Boxzilla object to window\n window.Boxzilla = Boxzilla;\n\n // helper function for setting CSS styles\n function css(element, styles) {\n if (styles.background_color) {\n element.style.background = styles.background_color;\n }\n\n if (styles.color) {\n element.style.color = styles.color;\n }\n\n if (styles.border_color) {\n element.style.borderColor = styles.border_color;\n }\n\n if (styles.border_width) {\n element.style.borderWidth = parseInt(styles.border_width) + \"px\";\n }\n\n if (styles.border_style) {\n element.style.borderStyle = styles.border_style;\n }\n\n if (styles.width) {\n element.style.maxWidth = parseInt(styles.width) + \"px\";\n }\n }\n\n function createBoxesFromConfig() {\n var isLoggedIn = document.body.className.indexOf('logged-in') > -1;\n\n // failsafe against including script twice.\n if (options.inited) {\n return;\n }\n\n // print message when test mode is enabled\n if (isLoggedIn && options.testMode) {\n console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\\'re done testing.');\n }\n\n // init boxzilla\n Boxzilla.init();\n\n // create boxes from options\n for (var i = 0; i < options.boxes.length; i++) {\n // get opts\n var boxOpts = options.boxes[i];\n boxOpts.testMode = isLoggedIn && options.testMode;\n\n // fix http:// links in box content....\n if (window.location.protocol === \"https:\" && window.location.host) {\n var o = \"http://\" + window.location.host;\n var n = o.replace('http://', 'https://');\n boxOpts.content = boxOpts.content.replace(o, n);\n }\n\n // create box\n var box = Boxzilla.create(boxOpts.id, boxOpts);\n\n // remove <script> from box content and append them to the document body\n var scripts = box.element.querySelectorAll('script');\n handleScriptElements(scripts);\n\n // add box slug to box element as classname\n box.element.className = box.element.className + ' boxzilla-' + boxOpts.post.slug;\n\n // add custom css to box\n css(box.element, boxOpts.css);\n\n box.element.firstChild.firstChild.className += \" first-child\";\n box.element.firstChild.lastChild.className += \" last-child\";\n\n // maybe show box right away\n if (box.fits() && locationHashRefersBox(box)) {\n window.addEventListener('load', box.show.bind(box));\n }\n }\n\n // set flag to prevent initialising twice\n options.inited = true;\n\n // trigger \"done\" event.\n Boxzilla.trigger('done');\n }\n\n function locationHashRefersBox(box) {\n if (!window.location.hash || 0 === window.location.hash.length) {\n return false;\n }\n\n var elementId = window.location.hash.substring(1);\n\n // only attempt on strings looking like an ID \n var regex = /^[a-zA-Z\\-\\_0-9]+$/;\n if (!regex.test(elementId)) {\n return false;\n }\n\n if (elementId === box.element.id) {\n return true;\n } else if (box.element.querySelector('#' + elementId)) {\n return true;\n }\n\n return false;\n }\n\n function handleScriptElements(scripts) {\n var handle = function handle() {\n var script = document.createElement('script');\n\n if (this.src) {\n script.src = this.src;\n }\n script.appendChild(document.createTextNode(this.text));\n this.parentNode.removeChild(this);\n document.body.appendChild(script);\n\n if (scripts.length) {\n script.addEventListener('load', handle.bind(scripts.shift()));\n }\n };\n\n scripts = Array.from(scripts);\n if (scripts.length) {\n window.setTimeout(handle.bind(scripts.shift()), 1);\n }\n }\n\n function openMailChimpForWordPressBox() {\n if (_typeof(window.mc4wp_forms_config) !== \"object\" || !window.mc4wp_forms_config.submitted_form) {\n return;\n }\n\n var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;\n var boxes = Boxzilla.boxes;\n for (var boxId in boxes) {\n if (!boxes.hasOwnProperty(boxId)) {\n continue;\n }\n var box = boxes[boxId];\n if (box.element.querySelector(selector)) {\n box.show();\n return;\n }\n }\n }\n\n window.addEventListener('load', openMailChimpForWordPressBox);\n window.setTimeout(createBoxesFromConfig, 1);\n})();\n\n},{\"boxzilla\":5}],2:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar duration = 320;\n\nfunction css(element, styles) {\n for (var property in styles) {\n element.style[property] = styles[property];\n }\n}\n\nfunction initObjectProperties(properties, value) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = value;\n }\n return newObject;\n}\n\nfunction copyObjectProperties(properties, object) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = object[properties[i]];\n }\n return newObject;\n}\n\n/**\n * Checks if the given element is currently being animated.\n *\n * @param element\n * @returns {boolean}\n */\nfunction animated(element) {\n return !!element.getAttribute('data-animated');\n}\n\n/**\n * Toggles the element using the given animation.\n *\n * @param element\n * @param animation Either \"fade\" or \"slide\"\n */\nfunction toggle(element, animation, callbackFn) {\n var nowVisible = element.style.display != 'none' || element.offsetLeft > 0;\n\n // create clone for reference\n var clone = element.cloneNode(true);\n var cleanup = function cleanup() {\n element.removeAttribute('data-animated');\n element.setAttribute('style', clone.getAttribute('style'));\n element.style.display = nowVisible ? 'none' : '';\n if (callbackFn) {\n callbackFn();\n }\n };\n\n // store attribute so everyone knows we're animating this element\n element.setAttribute('data-animated', \"true\");\n\n // toggle element visiblity right away if we're making something visible\n if (!nowVisible) {\n element.style.display = '';\n }\n\n var hiddenStyles, visibleStyles;\n\n // animate properties\n if (animation === 'slide') {\n hiddenStyles = initObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], 0);\n visibleStyles = {};\n\n if (!nowVisible) {\n var computedStyles = window.getComputedStyle(element);\n visibleStyles = copyObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], computedStyles);\n\n // in some browsers, getComputedStyle returns \"auto\" value. this falls back to getBoundingClientRect() in those browsers since we need an actual height.\n if (!isFinite(visibleStyles.height)) {\n var clientRect = element.getBoundingClientRect();\n visibleStyles.height = clientRect.height;\n }\n css(element, hiddenStyles);\n }\n\n // don't show a scrollbar during animation\n element.style.overflowY = 'hidden';\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n } else {\n hiddenStyles = { opacity: 0 };\n visibleStyles = { opacity: 1 };\n if (!nowVisible) {\n css(element, hiddenStyles);\n }\n\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n }\n}\n\nfunction animate(element, targetStyles, fn) {\n var last = +new Date();\n var initialStyles = window.getComputedStyle(element);\n var currentStyles = {};\n var propSteps = {};\n\n for (var property in targetStyles) {\n // make sure we have an object filled with floats\n targetStyles[property] = parseFloat(targetStyles[property]);\n\n // calculate step size & current value\n var to = targetStyles[property];\n var current = parseFloat(initialStyles[property]);\n\n // is there something to do?\n if (current == to) {\n delete targetStyles[property];\n continue;\n }\n\n propSteps[property] = (to - current) / duration; // points per second\n currentStyles[property] = current;\n }\n\n var tick = function tick() {\n var now = +new Date();\n var timeSinceLastTick = now - last;\n var done = true;\n\n var step, to, increment, newValue;\n for (var property in targetStyles) {\n step = propSteps[property];\n to = targetStyles[property];\n increment = step * timeSinceLastTick;\n newValue = currentStyles[property] + increment;\n\n if (step > 0 && newValue >= to || step < 0 && newValue <= to) {\n newValue = to;\n } else {\n done = false;\n }\n\n // store new value\n currentStyles[property] = newValue;\n\n var suffix = property !== \"opacity\" ? \"px\" : \"\";\n element.style[property] = newValue + suffix;\n }\n\n last = +new Date();\n\n // keep going until we're done for all props\n if (!done) {\n window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);\n } else {\n // call callback\n fn && fn();\n }\n };\n\n tick();\n}\n\nmodule.exports = {\n 'toggle': toggle,\n 'animate': animate,\n 'animated': animated\n};\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar defaults = {\n 'animation': 'fade',\n 'rehide': false,\n 'content': '',\n 'cookie': null,\n 'icon': '×',\n 'screenWidthCondition': null,\n 'position': 'center',\n 'testMode': false,\n 'trigger': false,\n 'closable': true\n},\n Boxzilla,\n Animator = require('./animator.js');\n\n/**\n* Merge 2 objects, values of the latter overwriting the former.\n*\n* @param obj1\n* @param obj2\n* @returns {*}\n*/\nfunction merge(obj1, obj2) {\n var obj3 = {};\n for (var attrname in obj1) {\n obj3[attrname] = obj1[attrname];\n }\n for (var attrname in obj2) {\n obj3[attrname] = obj2[attrname];\n }\n return obj3;\n}\n\n/**\n* Get the real height of entire document.\n* @returns {number}\n*/\nfunction getDocumentHeight() {\n var body = document.body,\n html = document.documentElement;\n\n var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n\n return height;\n}\n\n// Box Object\nvar Box = function Box(id, config) {\n this.id = id;\n\n // store config values\n this.config = merge(defaults, config);\n\n // store ref to overlay\n this.overlay = document.getElementById('boxzilla-overlay');\n\n // state\n this.visible = false;\n this.dismissed = false;\n this.triggered = false;\n this.triggerHeight = this.calculateTriggerHeight();\n this.cookieSet = this.isCookieSet();\n this.element = null;\n this.contentElement = null;\n this.closeIcon = null;\n\n // create dom elements for this box\n this.dom();\n\n // further initialise the box\n this.events();\n};\n\n// initialise the box\nBox.prototype.events = function () {\n var box = this;\n\n // attach event to \"close\" icon inside box\n if (this.closeIcon) {\n this.closeIcon.addEventListener('click', this.dismiss.bind(this));\n }\n\n this.element.addEventListener('click', function (e) {\n if (e.target.tagName === 'A') {\n Boxzilla.trigger('box.interactions.link', [box, e.target]);\n }\n }, false);\n\n this.element.addEventListener('submit', function (e) {\n box.setCookie();\n Boxzilla.trigger('box.interactions.form', [box, e.target]);\n }, false);\n};\n\n// generate dom elements for this box\nBox.prototype.dom = function () {\n var wrapper = document.createElement('div');\n wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';\n\n var box = document.createElement('div');\n box.setAttribute('id', 'boxzilla-' + this.id);\n box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;\n box.style.display = 'none';\n wrapper.appendChild(box);\n\n var content = document.createElement('div');\n content.className = 'boxzilla-content';\n content.innerHTML = this.config.content;\n box.appendChild(content);\n\n if (this.config.closable && this.config.icon) {\n var closeIcon = document.createElement('span');\n closeIcon.className = \"boxzilla-close-icon\";\n closeIcon.innerHTML = this.config.icon;\n box.appendChild(closeIcon);\n this.closeIcon = closeIcon;\n }\n\n document.body.appendChild(wrapper);\n this.contentElement = content;\n this.element = box;\n};\n\n// set (calculate) custom box styling depending on box options\nBox.prototype.setCustomBoxStyling = function () {\n\n // reset element to its initial state\n var origDisplay = this.element.style.display;\n this.element.style.display = '';\n this.element.style.overflowY = 'auto';\n this.element.style.maxHeight = 'none';\n\n // get new dimensions\n var windowHeight = window.innerHeight;\n var boxHeight = this.element.clientHeight;\n\n // add scrollbar to box and limit height\n if (boxHeight > windowHeight) {\n this.element.style.maxHeight = windowHeight + \"px\";\n this.element.style.overflowY = 'scroll';\n }\n\n // set new top margin for boxes which are centered\n if (this.config.position === 'center') {\n var newTopMargin = (windowHeight - boxHeight) / 2;\n newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;\n this.element.style.marginTop = newTopMargin + \"px\";\n }\n\n this.element.style.display = origDisplay;\n};\n\n// toggle visibility of the box\nBox.prototype.toggle = function (show) {\n\n // revert visibility if no explicit argument is given\n if (typeof show === \"undefined\") {\n show = !this.visible;\n }\n\n // is box already at desired visibility?\n if (show === this.visible) {\n return false;\n }\n\n // is box being animated?\n if (Animator.animated(this.element)) {\n return false;\n }\n\n // if box should be hidden but is not closable, bail.\n if (!show && !this.config.closable) {\n return false;\n }\n\n // set new visibility status\n this.visible = show;\n\n // calculate new styling rules\n this.setCustomBoxStyling();\n\n // trigger event\n Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]);\n\n // show or hide box using selected animation\n if (this.config.position === 'center') {\n this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');\n Animator.toggle(this.overlay, \"fade\");\n }\n\n Animator.toggle(this.element, this.config.animation, function () {\n if (this.visible) {\n return;\n }\n this.contentElement.innerHTML = this.contentElement.innerHTML;\n }.bind(this));\n\n return true;\n};\n\n// show the box\nBox.prototype.show = function () {\n return this.toggle(true);\n};\n\n// hide the box\nBox.prototype.hide = function () {\n return this.toggle(false);\n};\n\n// calculate trigger height\nBox.prototype.calculateTriggerHeight = function () {\n var triggerHeight = 0;\n\n if (this.config.trigger) {\n if (this.config.trigger.method === 'element') {\n var triggerElement = document.body.querySelector(this.config.trigger.value);\n if (triggerElement) {\n var offset = triggerElement.getBoundingClientRect();\n triggerHeight = offset.top;\n }\n } else if (this.config.trigger.method === 'percentage') {\n triggerHeight = this.config.trigger.value / 100 * getDocumentHeight();\n }\n }\n\n return triggerHeight;\n};\n\nBox.prototype.fits = function () {\n if (!this.config.screenWidthCondition || !this.config.screenWidthCondition.value) {\n return true;\n }\n\n switch (this.config.screenWidthCondition.condition) {\n case \"larger\":\n return window.innerWidth > this.config.screenWidthCondition.value;\n case \"smaller\":\n return window.innerWidth < this.config.screenWidthCondition.value;\n }\n\n // meh.. condition should be \"smaller\" or \"larger\", just return true.\n return true;\n};\n\nBox.prototype.onResize = function () {\n this.triggerHeight = this.calculateTriggerHeight();\n this.setCustomBoxStyling();\n};\n\n// is this box enabled?\nBox.prototype.mayAutoShow = function () {\n\n if (this.dismissed) {\n return false;\n }\n\n // check if box fits on given minimum screen width\n if (!this.fits()) {\n return false;\n }\n\n // if trigger empty or error in calculating triggerHeight, return false\n if (!this.config.trigger) {\n return false;\n }\n\n // rely on cookie value (show if not set, don't show if set)\n return !this.cookieSet;\n};\n\nBox.prototype.mayRehide = function () {\n return this.config.rehide && this.triggered;\n};\n\nBox.prototype.isCookieSet = function () {\n // always show on test mode or when no auto-trigger is configured\n if (this.config.testMode || !this.config.trigger) {\n return false;\n }\n\n // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.\n if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {\n return false;\n }\n\n var cookieSet = document.cookie.replace(new RegExp(\"(?:(?:^|.*;)\\\\s*\" + 'boxzilla_box_' + this.id + \"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"), \"$1\") === \"true\";\n return cookieSet;\n};\n\n// set cookie that disables automatically showing the box\nBox.prototype.setCookie = function (hours) {\n var expiryDate = new Date();\n expiryDate.setHours(expiryDate.getHours() + hours);\n document.cookie = 'boxzilla_box_' + this.id + '=true; expires=' + expiryDate.toUTCString() + '; path=/';\n};\n\nBox.prototype.trigger = function () {\n var shown = this.show();\n if (!shown) {\n return;\n }\n\n this.triggered = true;\n if (this.config.cookie && this.config.cookie.triggered) {\n this.setCookie(this.config.cookie.triggered);\n }\n};\n\n/**\n* Dismisses the box and optionally sets a cookie.\n*\n* @param e The event that triggered this dismissal.\n* @returns {boolean}\n*/\nBox.prototype.dismiss = function (e) {\n // prevent default action\n e && e.preventDefault();\n\n // only dismiss box if it's currently open.\n if (!this.visible) {\n return false;\n }\n\n // hide box element\n this.hide();\n\n // set cookie\n if (this.config.cookie && this.config.cookie.dismissed) {\n this.setCookie(this.config.cookie.dismissed);\n }\n\n this.dismissed = true;\n Boxzilla.trigger('box.dismiss', [this]);\n return true;\n};\n\nmodule.exports = function (_Boxzilla) {\n Boxzilla = _Boxzilla;\n return Box;\n};\n\n},{\"./animator.js\":3}],5:[function(require,module,exports){\n'use strict';\n\nvar EventEmitter = require('wolfy87-eventemitter'),\n Boxzilla = Object.create(EventEmitter.prototype),\n Box = require('./box.js')(Boxzilla),\n Timer = require('./timer.js'),\n boxes = [],\n overlay,\n scrollElement = window,\n exitIntentDelayTimer,\n exitIntentTriggered,\n siteTimer,\n pageTimer,\n pageViews;\n\nfunction throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n var last, deferTimer;\n return function () {\n var context = scope || this;\n\n var now = +new Date(),\n args = arguments;\n if (last && now < last + threshhold) {\n // hold on to it\n clearTimeout(deferTimer);\n deferTimer = setTimeout(function () {\n last = now;\n fn.apply(context, args);\n }, threshhold);\n } else {\n last = now;\n fn.apply(context, args);\n }\n };\n}\n\n// \"keyup\" listener\nfunction onKeyUp(e) {\n if (e.keyCode == 27) {\n Boxzilla.dismiss();\n }\n}\n\n// check \"pageviews\" criteria for each box\nfunction checkPageViewsCriteria() {\n\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {\n box.trigger();\n }\n });\n}\n\n// check time trigger criteria for each box\nfunction checkTimeCriteria() {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n // check \"time on site\" trigger\n if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n\n // check \"time on page\" trigger\n if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n });\n}\n\n// check triggerHeight criteria for all boxes\nfunction checkHeightCriteria() {\n\n var scrollY = scrollElement.hasOwnProperty('pageYOffset') ? scrollElement.pageYOffset : scrollElement.scrollTop;\n scrollY = scrollY + window.innerHeight * 0.9;\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow() || box.triggerHeight <= 0) {\n return;\n }\n\n if (scrollY > box.triggerHeight) {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n // trigger box\n box.trigger();\n } else if (box.mayRehide()) {\n box.hide();\n }\n });\n}\n\n// recalculate heights and variables based on height\nfunction recalculateHeights() {\n boxes.forEach(function (box) {\n box.onResize();\n });\n}\n\nfunction onOverlayClick(e) {\n var x = e.offsetX;\n var y = e.offsetY;\n\n // calculate if click was less than 40px outside box to avoid closing it by accident\n boxes.forEach(function (box) {\n var rect = box.element.getBoundingClientRect();\n var margin = 40;\n\n // if click was not anywhere near box, dismiss it.\n if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {\n box.dismiss();\n }\n });\n}\n\nfunction triggerExitIntent() {\n // do nothing if already triggered OR another box is visible.\n if (exitIntentTriggered || isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {\n box.trigger();\n }\n });\n\n exitIntentTriggered = true;\n}\n\nfunction onMouseLeave(e) {\n var delay = 400;\n\n // did mouse leave at top of window?\n if (e.clientY <= 0) {\n exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);\n }\n}\n\nfunction isAnyBoxVisible() {\n\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n\n if (box.visible) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction onMouseEnter() {\n if (exitIntentDelayTimer) {\n window.clearInterval(exitIntentDelayTimer);\n exitIntentDelayTimer = null;\n }\n}\n\nfunction onElementClick(e) {\n // find <a> element in up to 3 parent elements\n var el = e.target || e.srcElement;\n var depth = 3;\n for (var i = 0; i <= depth; i++) {\n if (!el || el.tagName === 'A') {\n break;\n }\n\n el = el.parentElement;\n }\n\n if (!el || el.tagName !== 'A' || !el.getAttribute('href')) {\n return;\n }\n\n if (el.getAttribute('href').toLowerCase().indexOf('#boxzilla-') === 0) {\n var boxId = el.getAttribute('href').toLowerCase().substring(\"#boxzilla-\".length);\n Boxzilla.toggle(boxId);\n }\n}\n\nvar timers = {\n start: function start() {\n try {\n var sessionTime = sessionStorage.getItem('boxzilla_timer');\n if (sessionTime) siteTimer.time = sessionTime;\n } catch (e) {}\n siteTimer.start();\n pageTimer.start();\n },\n stop: function stop() {\n sessionStorage.setItem('boxzilla_timer', siteTimer.time);\n siteTimer.stop();\n pageTimer.stop();\n }\n};\n\n// initialise & add event listeners\nBoxzilla.init = function () {\n document.body.addEventListener('click', onElementClick, true);\n\n try {\n pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;\n } catch (e) {\n pageViews = 0;\n }\n\n siteTimer = new Timer(0);\n pageTimer = new Timer(0);\n\n // insert styles into DOM\n var styles = require('./styles.js');\n var styleElement = document.createElement('style');\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = styles;\n document.head.appendChild(styleElement);\n\n // add overlay element to dom\n overlay = document.createElement('div');\n overlay.style.display = 'none';\n overlay.id = 'boxzilla-overlay';\n document.body.appendChild(overlay);\n\n // event binds\n scrollElement.addEventListener('touchstart', throttle(checkHeightCriteria), true);\n scrollElement.addEventListener('scroll', throttle(checkHeightCriteria), true);\n window.addEventListener('resize', throttle(recalculateHeights));\n window.addEventListener('load', recalculateHeights);\n overlay.addEventListener('click', onOverlayClick);\n window.setInterval(checkTimeCriteria, 1000);\n window.setTimeout(checkPageViewsCriteria, 1000);\n document.documentElement.addEventListener('mouseleave', onMouseLeave);\n document.documentElement.addEventListener('mouseenter', onMouseEnter);\n document.addEventListener('keyup', onKeyUp);\n\n timers.start();\n window.addEventListener('focus', timers.start);\n window.addEventListener('beforeunload', function () {\n timers.stop();\n sessionStorage.setItem('boxzilla_pageviews', ++pageViews);\n });\n window.addEventListener('blur', timers.stop);\n\n Boxzilla.trigger('ready');\n};\n\n/**\n * Create a new Box\n *\n * @param string id\n * @param object opts\n *\n * @returns Box\n */\nBoxzilla.create = function (id, opts) {\n\n // preserve backwards compat for minimumScreenWidth option\n if (typeof opts.minimumScreenWidth !== \"undefined\") {\n opts.screenWidthCondition = {\n condition: \"larger\",\n value: opts.minimumScreenWidth\n };\n }\n\n var box = new Box(id, opts);\n boxes.push(box);\n return box;\n};\n\nBoxzilla.get = function (id) {\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n if (box.id == id) {\n return box;\n }\n }\n\n throw new Error(\"No box exists with ID \" + id);\n};\n\n// dismiss a single box (or all by omitting id param)\nBoxzilla.dismiss = function (id) {\n // if no id given, dismiss all current open boxes\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.dismiss();\n });\n } else {\n Boxzilla.get(id).dismiss();\n }\n};\n\nBoxzilla.hide = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.hide();\n });\n } else {\n Boxzilla.get(id).hide();\n }\n};\n\nBoxzilla.show = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.show();\n });\n } else {\n Boxzilla.get(id).show();\n }\n};\n\nBoxzilla.toggle = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.toggle();\n });\n } else {\n Boxzilla.get(id).toggle();\n }\n};\n\n// expose each individual box.\nBoxzilla.boxes = boxes;\n\n// expose boxzilla object\nwindow.Boxzilla = Boxzilla;\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = Boxzilla;\n}\n\n},{\"./box.js\":4,\"./styles.js\":6,\"./timer.js\":7,\"wolfy87-eventemitter\":2}],6:[function(require,module,exports){\n\"use strict\";\n\nvar styles = \"#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}\";\nmodule.exports = styles;\n\n},{}],7:[function(require,module,exports){\n'use strict';\n\nvar Timer = function Timer(start) {\n this.time = start;\n this.interval = 0;\n};\n\nTimer.prototype.tick = function () {\n this.time++;\n};\n\nTimer.prototype.start = function () {\n if (!this.interval) {\n this.interval = window.setInterval(this.tick.bind(this), 1000);\n }\n};\n\nTimer.prototype.stop = function () {\n if (this.interval) {\n window.clearInterval(this.interval);\n this.interval = 0;\n }\n};\n\nmodule.exports = Timer;\n\n},{}]},{},[1]);\n; })();"]}
|
boxzilla.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Boxzilla
|
4 |
-
Version: 3.1.
|
5 |
Plugin URI: https://boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page
|
6 |
Description: Call-To-Action Boxes that display after visitors scroll down far enough. Unobtrusive, but highly conversing!
|
7 |
Author: ibericode
|
@@ -41,7 +41,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
41 |
function _load_boxzilla() {
|
42 |
|
43 |
define( 'BOXZILLA_FILE', __FILE__ );
|
44 |
-
define( 'BOXZILLA_VERSION', '3.1.
|
45 |
|
46 |
require __DIR__ . '/bootstrap.php';
|
47 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Boxzilla
|
4 |
+
Version: 3.1.23
|
5 |
Plugin URI: https://boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page
|
6 |
Description: Call-To-Action Boxes that display after visitors scroll down far enough. Unobtrusive, but highly conversing!
|
7 |
Author: ibericode
|
41 |
function _load_boxzilla() {
|
42 |
|
43 |
define( 'BOXZILLA_FILE', __FILE__ );
|
44 |
+
define( 'BOXZILLA_VERSION', '3.1.23' );
|
45 |
|
46 |
require __DIR__ . '/bootstrap.php';
|
47 |
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Ibericode, DvanKooten, hchouhan, lapzor
|
|
3 |
Donate link: https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=donate-link
|
4 |
Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media, mc4wp, ibericode
|
5 |
Requires at least: 4.1
|
6 |
-
Tested up to: 4.9
|
7 |
-
Stable tag: 3.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Requires PHP: 5.3
|
@@ -150,11 +150,18 @@ Have a look at the [frequently asked questions](https://wordpress.org/plugins/bo
|
|
150 |
== Changelog ==
|
151 |
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
#### 3.1.22 - November 20, 2017
|
154 |
|
155 |
**Fixes**
|
156 |
|
157 |
-
- Showing box by location hash wasn't working.
|
158 |
|
159 |
**Improvements**
|
160 |
|
3 |
Donate link: https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=donate-link
|
4 |
Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media, mc4wp, ibericode
|
5 |
Requires at least: 4.1
|
6 |
+
Tested up to: 4.9.1
|
7 |
+
Stable tag: 3.1.23
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Requires PHP: 5.3
|
150 |
== Changelog ==
|
151 |
|
152 |
|
153 |
+
#### 3.1.23 - December 13, 2017
|
154 |
+
|
155 |
+
**Fixes**
|
156 |
+
|
157 |
+
- Event listener for hyperlinks referencing `#boxzilla-123`. We recommend using `[boxzilla_link]to generate your links though[/boxzilla_link]`. [Here's how that works](https://kb.boxzillaplugin.com/shortcode-boxzilla-link/).
|
158 |
+
|
159 |
+
|
160 |
#### 3.1.22 - November 20, 2017
|
161 |
|
162 |
**Fixes**
|
163 |
|
164 |
+
- Showing box by location hash after page load wasn't working.
|
165 |
|
166 |
**Improvements**
|
167 |
|
src/admin/class-admin.php
CHANGED
@@ -156,8 +156,9 @@ class Admin {
|
|
156 |
* @param $post_id
|
157 |
*/
|
158 |
public function post_type_column_content( $column, $post_id ) {
|
159 |
-
|
160 |
-
|
|
|
161 |
}
|
162 |
}
|
163 |
|
@@ -293,7 +294,6 @@ class Admin {
|
|
293 |
}
|
294 |
|
295 |
if ( $screen->base === 'edit' && $screen->post_type === 'boxzilla-box' ) {
|
296 |
-
// load stylesheets
|
297 |
wp_enqueue_style( 'boxzilla-admin' );
|
298 |
}
|
299 |
|
@@ -304,14 +304,14 @@ class Admin {
|
|
304 |
// load scripts
|
305 |
wp_enqueue_script( 'boxzilla-admin' );
|
306 |
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
)
|
314 |
);
|
|
|
315 |
|
316 |
// load stylesheets
|
317 |
wp_enqueue_style( 'boxzilla-admin' );
|
@@ -321,7 +321,6 @@ class Admin {
|
|
321 |
}
|
322 |
|
323 |
if ( isset( $_GET['page'] ) && $_GET['page'] === 'boxzilla-settings' ) {
|
324 |
-
// load stylesheets
|
325 |
wp_enqueue_style( 'boxzilla-admin' );
|
326 |
}
|
327 |
|
@@ -615,7 +614,7 @@ class Admin {
|
|
615 |
* @return array
|
616 |
*/
|
617 |
public function add_plugin_settings_link( $links, $slug ) {
|
618 |
-
if ( $slug !== $this->plugin->slug() ) {
|
619 |
return $links;
|
620 |
}
|
621 |
|
@@ -655,7 +654,7 @@ class Admin {
|
|
655 |
|
656 |
// only act on our own post type
|
657 |
$post = get_post( $post_id );
|
658 |
-
if ( $post instanceof WP_Post
|
659 |
return;
|
660 |
}
|
661 |
|
@@ -710,7 +709,7 @@ class Admin {
|
|
710 |
$response = json_decode( $response );
|
711 |
|
712 |
if ( is_array( $response->data ) ) {
|
713 |
-
set_transient( 'boxzilla_remote_extensions', $response->data, HOUR_IN_SECONDS );
|
714 |
|
715 |
return $response->data;
|
716 |
}
|
156 |
* @param $post_id
|
157 |
*/
|
158 |
public function post_type_column_content( $column, $post_id ) {
|
159 |
+
$method_name = 'post_type_column_' . $column . '_content';
|
160 |
+
if ( method_exists( $this, $method_name ) ) {
|
161 |
+
call_user_func( array( $this, $method_name ), $post_id );
|
162 |
}
|
163 |
}
|
164 |
|
294 |
}
|
295 |
|
296 |
if ( $screen->base === 'edit' && $screen->post_type === 'boxzilla-box' ) {
|
|
|
297 |
wp_enqueue_style( 'boxzilla-admin' );
|
298 |
}
|
299 |
|
304 |
// load scripts
|
305 |
wp_enqueue_script( 'boxzilla-admin' );
|
306 |
|
307 |
+
$data = array(
|
308 |
+
'enterCommaSeparatedValues' => __( 'Enter a comma-separated list of values.', 'boxzilla' ),
|
309 |
+
'enterCommaSeparatedPosts' => __( "Enter a comma-separated list of post slugs or post ID's..", 'boxzilla' ),
|
310 |
+
'enterCommaSeparatedPages' => __( "Enter a comma-separated list of page slugs or page ID's..", 'boxzilla' ),
|
311 |
+
'enterCommaSeparatedPostTypes' => __( "Enter a comma-separated list of post types..", 'boxzilla' ),
|
312 |
+
'enterCommaSeparatedRelativeUrls' => __( "Enter a comma-separated list of relative URL's, eg /contact/", 'boxzilla' ),
|
|
|
313 |
);
|
314 |
+
wp_localize_script( 'boxzilla-admin' ,'boxzilla_i18n', $data );
|
315 |
|
316 |
// load stylesheets
|
317 |
wp_enqueue_style( 'boxzilla-admin' );
|
321 |
}
|
322 |
|
323 |
if ( isset( $_GET['page'] ) && $_GET['page'] === 'boxzilla-settings' ) {
|
|
|
324 |
wp_enqueue_style( 'boxzilla-admin' );
|
325 |
}
|
326 |
|
614 |
* @return array
|
615 |
*/
|
616 |
public function add_plugin_settings_link( $links, $slug ) {
|
617 |
+
if ( $slug !== $this->plugin->slug() || ! is_array( $links ) ) {
|
618 |
return $links;
|
619 |
}
|
620 |
|
654 |
|
655 |
// only act on our own post type
|
656 |
$post = get_post( $post_id );
|
657 |
+
if ( ! $post instanceof WP_Post || $post->post_type !== 'boxzilla-box' ) {
|
658 |
return;
|
659 |
}
|
660 |
|
709 |
$response = json_decode( $response );
|
710 |
|
711 |
if ( is_array( $response->data ) ) {
|
712 |
+
set_transient( 'boxzilla_remote_extensions', $response->data, 24 * HOUR_IN_SECONDS );
|
713 |
|
714 |
return $response->data;
|
715 |
}
|
src/default-actions.php
CHANGED
@@ -35,7 +35,7 @@ add_action( 'init', function() use( $boxzilla ){
|
|
35 |
'publish_posts' => 'publish_boxes',
|
36 |
'read_post' => 'read_box',
|
37 |
'read_private_posts' => 'read_private_box',
|
38 |
-
'
|
39 |
),
|
40 |
);
|
41 |
|
@@ -69,4 +69,4 @@ function boxzilla_get_link_html( $args = array(), $content = '' ) {
|
|
69 |
$class_attr = empty( $args['class'] ) ? '' : esc_attr( $args['class'] );
|
70 |
$action = empty( $args['action'] ) || ! in_array( $args['action'], $valid_actions ) ? 'show' : $args['action'];
|
71 |
return sprintf( '<a href="javascript:Boxzilla.%s(%s)" class="%s">', $action, $box_id, $class_attr ) . $content . '</a>';
|
72 |
-
}
|
35 |
'publish_posts' => 'publish_boxes',
|
36 |
'read_post' => 'read_box',
|
37 |
'read_private_posts' => 'read_private_box',
|
38 |
+
'delete_posts' => 'delete_box',
|
39 |
),
|
40 |
);
|
41 |
|
69 |
$class_attr = empty( $args['class'] ) ? '' : esc_attr( $args['class'] );
|
70 |
$action = empty( $args['action'] ) || ! in_array( $args['action'], $valid_actions ) ? 'show' : $args['action'];
|
71 |
return sprintf( '<a href="javascript:Boxzilla.%s(%s)" class="%s">', $action, $box_id, $class_attr ) . $content . '</a>';
|
72 |
+
}
|