Boxzilla - Version 3.0.1

Version Description

Download this release

Release Info

Developer DvanKooten
Plugin Icon 128x128 Boxzilla
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0 to 3.0.1

assets/browserify/admin/_admin.js CHANGED
@@ -69,7 +69,7 @@ function setContextualHelpers() {
69
 
70
  case '':
71
  case 'everywhere':
72
- qualifierInput.value = '';
73
  valueInput.value = '';
74
  betterInput.style.display = 'none';
75
  qualifierInput.style.display = 'none';
@@ -98,6 +98,10 @@ function setContextualHelpers() {
98
  case 'is_post_in_category':
99
  $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {multiple:true, multipleSep: ","});
100
  break;
 
 
 
 
101
  }
102
  }
103
 
69
 
70
  case '':
71
  case 'everywhere':
72
+ qualifierInput.value = '1';
73
  valueInput.value = '';
74
  betterInput.style.display = 'none';
75
  qualifierInput.style.display = 'none';
98
  case 'is_post_in_category':
99
  $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {multiple:true, multipleSep: ","});
100
  break;
101
+
102
+ case 'is_post_with_tag':
103
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {multiple:true, multipleSep: ","});
104
+ break;
105
  }
106
  }
107
 
assets/js/admin-script.js CHANGED
@@ -72,7 +72,7 @@ function setContextualHelpers() {
72
 
73
  case '':
74
  case 'everywhere':
75
- qualifierInput.value = '';
76
  valueInput.value = '';
77
  betterInput.style.display = 'none';
78
  qualifierInput.style.display = 'none';
@@ -101,6 +101,10 @@ function setContextualHelpers() {
101
  case 'is_post_in_category':
102
  $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {multiple:true, multipleSep: ","});
103
  break;
 
 
 
 
104
  }
105
  }
106
 
72
 
73
  case '':
74
  case 'everywhere':
75
+ qualifierInput.value = '1';
76
  valueInput.value = '';
77
  betterInput.style.display = 'none';
78
  qualifierInput.style.display = 'none';
101
  case 'is_post_in_category':
102
  $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {multiple:true, multipleSep: ","});
103
  break;
104
+
105
+ case 'is_post_with_tag':
106
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {multiple:true, multipleSep: ","});
107
+ break;
108
  }
109
  }
110
 
assets/js/admin-script.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){var e=void 0,t=void 0;!function n(t,r,o){function i(s,a){if(!r[s]){if(!t[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:{}};t[s][0].call(p.exports,function(e){var n=t[s][1][e];return i(n?n:e)},p,p.exports,n,t,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){window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(e,t,n){"use strict";function r(){c.find(".boxzilla-trigger-options").toggle(""!==this.value)}function o(){s(this).parents("tr").remove()}function i(){var e="tr"===this.tagName.toLowerCase()?this:s(this).parents("tr").get(0),t=e.querySelector(".boxzilla-rule-condition").value,n=e.querySelector(".boxzilla-rule-value"),r=e.querySelector(".boxzilla-rule-qualifier"),o=n.cloneNode(!0),i=s(o);switch(s(e.querySelectorAll(".boxzilla-helper")).remove(),o.removeAttribute("name"),o.className=o.className+" boxzilla-helper",n.parentNode.insertBefore(o,n.nextSibling),i.change(function(){n.value=this.value}),o.style.display="",n.style.display="none",r.style.display="",t){default:o.placeholder=g.enterCommaSeparatedValues;break;case"":case"everywhere":r.value="",n.value="",o.style.display="none",r.style.display="none";break;case"is_single":case"is_post":o.placeholder=g.enterCommaSeparatedPosts,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":o.placeholder=g.enterCommaSeparatedPages,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":o.placeholder=g.enterCommaSeparatedPostTypes,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":o.placeholder=g.enterCommaSeparatedRelativeUrls;break;case"is_post_in_category":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=category",{multiple:!0,multipleSep:","})}}function l(){var e={key:u.querySelectorAll(".boxzilla-rule-row").length},t=h(e);return s(document.getElementById("boxzilla-box-rules")).after(t),!1}var s=window.jQuery,a=e("./_option.js"),u=document.getElementById("boxzilla-box-options-controls"),c=s(u);if(0!==c.length){var p=e("wolfy87-eventemitter"),d=new p,f=e("./_designer.js")(s,a,d),h=wp.template("rule-row-template"),g=boxzilla_i18n;c.on("click",".boxzilla-add-rule",l),c.on("click",".boxzilla-remove-rule",o),c.on("change",".boxzilla-rule-condition",i),c.find(".boxzilla-auto-show-trigger").on("change",r),s(window).load(function(){"undefined"==typeof window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),s(".boxzilla-rule-row").each(i),t.exports={Designer:f,Option:a,events:d}}},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){var r=function(e,t,n){function r(){"object"==typeof window.tinyMCE&&null!==tinyMCE.get("content")&&(s=e("#content_ifr"),l=s.contents().find("html"),l.css({background:"white"}),a=l.find("#tinymce"),a.addClass("boxzilla boxzilla-"+u),a.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),a.get(0).style.cssText+=";padding: 25px !important;",p=!0,n.trigger("editor.init"))}function o(){return p?(a.css({"border-color":c.borderColor.getColorValue(),"border-width":c.borderWidth.getPxValue(),"border-style":c.borderStyle.getValue(),"background-color":c.backgroundColor.getColorValue(),width:c.width.getPxValue(),color:c.color.getColorValue()}),n.trigger("editor.styles.apply"),!0):!1}function i(){for(var e in c)"theme"!==e.substring(0,5)&&c[e].clear();o(),n.trigger("editor.styles.reset")}var l,s,a,u=document.getElementById("post_ID").value||0,c={},p=!1,d=e("#boxzilla-box-appearance-controls");return c.borderColor=new t("border-color"),c.borderWidth=new t("border-width"),c.borderStyle=new t("border-style"),c.backgroundColor=new t("background-color"),c.width=new t("width"),c.color=new t("color"),d.find("input.boxzilla-color-field").wpColorPicker({change:o,clear:o}),d.find(":input").not(".boxzilla-color-field").change(o),n.on("editor.init",o),{init:r,resetStyles:i,options:c}};t.exports=r},{}],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(){"use strict";function e(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,l=this,s=l.EventEmitter;i.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},i.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,t){var n,o=this.getListenersAsObject(e),i="object"==typeof t;for(n in o)o.hasOwnProperty(n)&&-1===r(o[n],t)&&o[n].push(i?t:{listener:t,once:!1});return this},i.on=o("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=o("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,t){var n,o,i=this.getListenersAsObject(e);for(o in i)i.hasOwnProperty(o)&&(n=r(i[o],t),-1!==n&&i[o].splice(n,1));return this},i.off=o("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.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},i.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},i.removeAllListeners=o("removeEvent"),i.emitEvent=function(e,t){var n,r,o,i,l,s=this.getListenersAsObject(e);for(i in s)if(s.hasOwnProperty(i))for(n=s[i].slice(0),o=n.length;o--;)r=n[o],r.once===!0&&this.removeListener(e,r.listener),l=r.listener.apply(this,t||[]),l===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},i.trigger=o("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return l.EventEmitter=s,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:l.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=admin-script.min.js.map
1
+ !function(){var e=void 0,t=void 0;!function n(t,r,o){function i(s,a){if(!r[s]){if(!t[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:{}};t[s][0].call(p.exports,function(e){var n=t[s][1][e];return i(n?n:e)},p,p.exports,n,t,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){window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(e,t,n){"use strict";function r(){c.find(".boxzilla-trigger-options").toggle(""!==this.value)}function o(){s(this).parents("tr").remove()}function i(){var e="tr"===this.tagName.toLowerCase()?this:s(this).parents("tr").get(0),t=e.querySelector(".boxzilla-rule-condition").value,n=e.querySelector(".boxzilla-rule-value"),r=e.querySelector(".boxzilla-rule-qualifier"),o=n.cloneNode(!0),i=s(o);switch(s(e.querySelectorAll(".boxzilla-helper")).remove(),o.removeAttribute("name"),o.className=o.className+" boxzilla-helper",n.parentNode.insertBefore(o,n.nextSibling),i.change(function(){n.value=this.value}),o.style.display="",n.style.display="none",r.style.display="",t){default:o.placeholder=g.enterCommaSeparatedValues;break;case"":case"everywhere":r.value="1",n.value="",o.style.display="none",r.style.display="none";break;case"is_single":case"is_post":o.placeholder=g.enterCommaSeparatedPosts,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":o.placeholder=g.enterCommaSeparatedPages,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":o.placeholder=g.enterCommaSeparatedPostTypes,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":o.placeholder=g.enterCommaSeparatedRelativeUrls;break;case"is_post_in_category":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=category",{multiple:!0,multipleSep:","});break;case"is_post_with_tag":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_tag",{multiple:!0,multipleSep:","})}}function l(){var e={key:u.querySelectorAll(".boxzilla-rule-row").length},t=h(e);return s(document.getElementById("boxzilla-box-rules")).after(t),!1}var s=window.jQuery,a=e("./_option.js"),u=document.getElementById("boxzilla-box-options-controls"),c=s(u);if(0!==c.length){var p=e("wolfy87-eventemitter"),d=new p,f=e("./_designer.js")(s,a,d),h=wp.template("rule-row-template"),g=boxzilla_i18n;c.on("click",".boxzilla-add-rule",l),c.on("click",".boxzilla-remove-rule",o),c.on("change",".boxzilla-rule-condition",i),c.find(".boxzilla-auto-show-trigger").on("change",r),s(window).load(function(){"undefined"==typeof window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),s(".boxzilla-rule-row").each(i),t.exports={Designer:f,Option:a,events:d}}},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){var r=function(e,t,n){function r(){"object"==typeof window.tinyMCE&&null!==tinyMCE.get("content")&&(s=e("#content_ifr"),l=s.contents().find("html"),l.css({background:"white"}),a=l.find("#tinymce"),a.addClass("boxzilla boxzilla-"+u),a.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),a.get(0).style.cssText+=";padding: 25px !important;",p=!0,n.trigger("editor.init"))}function o(){return p?(a.css({"border-color":c.borderColor.getColorValue(),"border-width":c.borderWidth.getPxValue(),"border-style":c.borderStyle.getValue(),"background-color":c.backgroundColor.getColorValue(),width:c.width.getPxValue(),color:c.color.getColorValue()}),n.trigger("editor.styles.apply"),!0):!1}function i(){for(var e in c)"theme"!==e.substring(0,5)&&c[e].clear();o(),n.trigger("editor.styles.reset")}var l,s,a,u=document.getElementById("post_ID").value||0,c={},p=!1,d=e("#boxzilla-box-appearance-controls");return c.borderColor=new t("border-color"),c.borderWidth=new t("border-width"),c.borderStyle=new t("border-style"),c.backgroundColor=new t("background-color"),c.width=new t("width"),c.color=new t("color"),d.find("input.boxzilla-color-field").wpColorPicker({change:o,clear:o}),d.find(":input").not(".boxzilla-color-field").change(o),n.on("editor.init",o),{init:r,resetStyles:i,options:c}};t.exports=r},{}],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(){"use strict";function e(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,l=this,s=l.EventEmitter;i.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},i.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,t){var n,o=this.getListenersAsObject(e),i="object"==typeof t;for(n in o)o.hasOwnProperty(n)&&-1===r(o[n],t)&&o[n].push(i?t:{listener:t,once:!1});return this},i.on=o("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=o("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,t){var n,o,i=this.getListenersAsObject(e);for(o in i)i.hasOwnProperty(o)&&(n=r(i[o],t),-1!==n&&i[o].splice(n,1));return this},i.off=o("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.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},i.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},i.removeAllListeners=o("removeEvent"),i.emitEvent=function(e,t){var n,r,o,i,l,s=this.getListenersAsObject(e);for(i in s)if(s.hasOwnProperty(i))for(n=s[i].slice(0),o=n.length;o--;)r=n[o],r.once===!0&&this.removeListener(e,r.listener),l=r.listener.apply(this,t||[]),l===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},i.trigger=o("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return l.EventEmitter=s,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:l.EventEmitter=e}).call(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","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","addRuleFields","data","key","optionControls","html","rowTemplate","document","getElementById","after","jQuery","Option","EventEmitter","events","Designer","wp","template","boxzilla_i18n","on","load","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","init","tinyMCE","$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","prototype","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,OAAeC,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,GAAIE,GAAED,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AAU8D,EAGjB9D,EAAQ8D,aAAeA,IAE7B7D,KAAKY,gBAEI","file":"admin-script.min.js","sourcesContent":["(function () { var require = 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){\nwindow.Boxzilla_Admin = require('./admin/_admin.js');\n},{\"./admin/_admin.js\":2}],2:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\nvar Option = require('./_option.js');\nvar optionControls = document.getElementById('boxzilla-box-options-controls');\nvar $optionControls = $(optionControls);\n\n// sanity check, are we on the correct page?\nif( $optionControls.length === 0 ) {\n\treturn;\n}\n\nvar EventEmitter = require('wolfy87-eventemitter');\nvar events = new EventEmitter();\nvar Designer = require('./_designer.js')($, Option, events);\nvar rowTemplate = wp.template('rule-row-template');\nvar 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\tif( typeof(window.tinyMCE) === \"undefined\" ) {\n\t\tdocument.getElementById('notice-notinymce').style.display = '';\n\t}\n});\n\n// call contextual helper method for each row\n$('.boxzilla-rule-row').each(setContextualHelpers);\n\nfunction toggleTriggerOptions() {\n\t$optionControls.find('.boxzilla-trigger-options').toggle( this.value !== '' );\n}\n\nfunction removeRule() {\n\t$(this).parents('tr').remove();\n}\n\nfunction setContextualHelpers() {\n\n\tvar context = ( this.tagName.toLowerCase() === \"tr\" ) ? this : $(this).parents('tr').get(0);\n\tvar condition = context.querySelector('.boxzilla-rule-condition').value;\n\tvar valueInput = context.querySelector('.boxzilla-rule-value');\n\tvar qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n\tvar betterInput = valueInput.cloneNode(true);\n\tvar $betterInput = $(betterInput);\n\n\t// remove previously added helpers\n\t$(context.querySelectorAll('.boxzilla-helper')).remove();\n\n\t// prepare better input\n\tbetterInput.removeAttribute('name');\n\tbetterInput.className = betterInput.className + ' boxzilla-helper';\n\tvalueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n\t$betterInput.change(function() { valueInput.value = this.value; });\n\n\tbetterInput.style.display = '';\n\tvalueInput.style.display = 'none';\n\tqualifierInput.style.display = '';\n\n\t// change placeholder for textual help\n\tswitch(condition) {\n\t\tdefault:\n\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedValues;\n\t\t\tbreak;\n\n\t\tcase '':\n\t\tcase 'everywhere':\n\t\t\tqualifierInput.value = '';\n\t\t\tvalueInput.value = '';\n\t\t\tbetterInput.style.display = 'none';\n\t\t\tqualifierInput.style.display = 'none';\n\t\t\tbreak;\n\n\t\tcase 'is_single':\n\t\tcase 'is_post':\n\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPosts;\n\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", {multiple:true, multipleSep: \",\"});\n\t\t\tbreak;\n\n\t\tcase 'is_page':\n\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPages;\n\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", {multiple:true, multipleSep: \",\"});\n\t\t\tbreak;\n\n\t\tcase 'is_post_type':\n\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", {multiple:true, multipleSep: \",\"});\n\t\t\tbreak;\n\n\t\tcase 'is_url':\n\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n\t\t\tbreak;\n\n\t\tcase 'is_post_in_category':\n\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", {multiple:true, multipleSep: \",\"});\n\t\t\tbreak;\n\t}\n}\n\nfunction addRuleFields() {\n\tvar data = {\n\t\t'key': optionControls.querySelectorAll('.boxzilla-rule-row').length\n\t};\n\tvar html = rowTemplate(data);\n\t$(document.getElementById('boxzilla-box-rules')).after(html);\n\treturn false;\n}\n\nmodule.exports = {\n\t'Designer': Designer,\n\t'Option': Option,\n\t'events': events\n};\n\n},{\"./_designer.js\":3,\"./_option.js\":4,\"wolfy87-eventemitter\":5}],3:[function(require,module,exports){\nvar Designer = function($, Option, events) {\n\n\t// vars\n\tvar boxId = document.getElementById('post_ID').value || 0,\n\t\t$editor, $editorFrame,\n\t\t$innerEditor,\n\t\toptions = {},\n\t\tvisualEditorInitialised = 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\t * Applies the styles from the options to the TinyMCE Editor\n\t *\n\t * @return bool\n\t */\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};\n\nmodule.exports = Designer;\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\n\nvar Option = function( 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},{}],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 })();"],"sourceRoot":"/source/"}
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","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","addRuleFields","data","key","optionControls","html","rowTemplate","document","getElementById","after","jQuery","Option","EventEmitter","events","Designer","wp","template","boxzilla_i18n","on","load","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","init","tinyMCE","$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","prototype","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,OAAeC,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,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGQ,QAAkD,IAAI,GAA1CL,GAAkB,kBAATX,IAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKY,GAAG,SAASnB,EAAQoB,EAAOJ,GACvhBK,OAAOC,eAAiBtB,EAAQ,uBAC7BuB,oBAAoB,IAAIC,GAAG,SAASxB,EAAQoB,EAAO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AAevJ,KAAKgI,qBAAqBT,EAO7C,KAAK/E,IAAO+G,GACR,GAAIA,EAAa5B,eAAenF,GAI5B,IAHAsE,EAAYyC,EAAa/G,GAAKgH,MAAM,GACpC1K,EAAIgI,EAAUzH,OAEPP,KAGHiI,EAAWD,EAAUhI,GAEjBiI,EAASqB,QAAS,GAClBpI,KAAKyI,eAAelB,EAAKR,EAASA,UAGtCS,EAAWT,EAASA,SAASG,MAAMlH,KAAMsJ,OAErC9B,IAAaxH,KAAKyJ,uBAClBzJ,KAAKyI,eAAelB,EAAKR,EAASA,SAMlD,OAAO/G,OAMXoH,EAAMtC,QAAUkC,EAAM,aAUtBI,EAAMsC,KAAO,SAAcnC,GACvB,GAAI+B,GAAOrB,MAAM1B,UAAUiD,MAAMpK,KAAK+H,UAAW,EACjD,OAAOnH,MAAKqJ,UAAU9B,EAAK+B,IAW/BlC,EAAMuC,mBAAqB,SAA4B1J,GAEnD,MADAD,MAAK4J,iBAAmB3J,EACjBD,MAWXoH,EAAMqC,oBAAsB,WACxB,MAAIzJ,MAAK2H,eAAe,oBACb3H,KAAK4J,kBAGL,GAUfxC,EAAMK,WAAa,WACf,MAAOzH,MAAKmJ,UAAYnJ,KAAKmJ,aAQjClG,EAAa4G,WAAa,WAEtB,MADA1K,GAAQ8D,aAAeoE,EAChBpE,GAIW,kBAAX5E,IAAyBA,EAAOyL,IACvCzL,EAAO,WACH,MAAO4E,KAGY,gBAAX1D,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAU8D,EAGjB9D,EAAQ8D,aAAeA,IAE7B7D,KAAKY,gBAEI","file":"admin-script.min.js","sourcesContent":["(function () { var require = 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){\nwindow.Boxzilla_Admin = require('./admin/_admin.js');\n},{\"./admin/_admin.js\":2}],2:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\nvar Option = require('./_option.js');\nvar optionControls = document.getElementById('boxzilla-box-options-controls');\nvar $optionControls = $(optionControls);\n\n// sanity check, are we on the correct page?\nif( $optionControls.length === 0 ) {\n\treturn;\n}\n\nvar EventEmitter = require('wolfy87-eventemitter');\nvar events = new EventEmitter();\nvar Designer = require('./_designer.js')($, Option, events);\nvar rowTemplate = wp.template('rule-row-template');\nvar 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\tif( typeof(window.tinyMCE) === \"undefined\" ) {\n\t\tdocument.getElementById('notice-notinymce').style.display = '';\n\t}\n});\n\n// call contextual helper method for each row\n$('.boxzilla-rule-row').each(setContextualHelpers);\n\nfunction toggleTriggerOptions() {\n\t$optionControls.find('.boxzilla-trigger-options').toggle( this.value !== '' );\n}\n\nfunction removeRule() {\n\t$(this).parents('tr').remove();\n}\n\nfunction setContextualHelpers() {\n\n\tvar context = ( this.tagName.toLowerCase() === \"tr\" ) ? this : $(this).parents('tr').get(0);\n\tvar condition = context.querySelector('.boxzilla-rule-condition').value;\n\tvar valueInput = context.querySelector('.boxzilla-rule-value');\n\tvar qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n\tvar betterInput = valueInput.cloneNode(true);\n\tvar $betterInput = $(betterInput);\n\n\t// remove previously added helpers\n\t$(context.querySelectorAll('.boxzilla-helper')).remove();\n\n\t// prepare better input\n\tbetterInput.removeAttribute('name');\n\tbetterInput.className = betterInput.className + ' boxzilla-helper';\n\tvalueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n\t$betterInput.change(function() { valueInput.value = this.value; });\n\n\tbetterInput.style.display = '';\n\tvalueInput.style.display = 'none';\n\tqualifierInput.style.display = '';\n\n\t// change placeholder for textual help\n\tswitch(condition) {\n\t\tdefault:\n\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedValues;\n\t\t\tbreak;\n\n\t\tcase '':\n\t\tcase 'everywhere':\n\t\t\tqualifierInput.value = '1';\n\t\t\tvalueInput.value = '';\n\t\t\tbetterInput.style.display = 'none';\n\t\t\tqualifierInput.style.display = 'none';\n\t\t\tbreak;\n\n\t\tcase 'is_single':\n\t\tcase 'is_post':\n\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPosts;\n\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", {multiple:true, multipleSep: \",\"});\n\t\t\tbreak;\n\n\t\tcase 'is_page':\n\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPages;\n\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", {multiple:true, multipleSep: \",\"});\n\t\t\tbreak;\n\n\t\tcase 'is_post_type':\n\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", {multiple:true, multipleSep: \",\"});\n\t\t\tbreak;\n\n\t\tcase 'is_url':\n\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n\t\t\tbreak;\n\n\t\tcase 'is_post_in_category':\n\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", {multiple:true, multipleSep: \",\"});\n\t\t\tbreak;\n\n\t\tcase 'is_post_with_tag':\n\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", {multiple:true, multipleSep: \",\"});\n\t\t\tbreak;\n\t}\n}\n\nfunction addRuleFields() {\n\tvar data = {\n\t\t'key': optionControls.querySelectorAll('.boxzilla-rule-row').length\n\t};\n\tvar html = rowTemplate(data);\n\t$(document.getElementById('boxzilla-box-rules')).after(html);\n\treturn false;\n}\n\nmodule.exports = {\n\t'Designer': Designer,\n\t'Option': Option,\n\t'events': events\n};\n\n},{\"./_designer.js\":3,\"./_option.js\":4,\"wolfy87-eventemitter\":5}],3:[function(require,module,exports){\nvar Designer = function($, Option, events) {\n\n\t// vars\n\tvar boxId = document.getElementById('post_ID').value || 0,\n\t\t$editor, $editorFrame,\n\t\t$innerEditor,\n\t\toptions = {},\n\t\tvisualEditorInitialised = 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\t * Applies the styles from the options to the TinyMCE Editor\n\t *\n\t * @return bool\n\t */\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};\n\nmodule.exports = Designer;\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\n\nvar Option = function( 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},{}],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 })();"],"sourceRoot":"/source/"}
assets/js/script.js CHANGED
@@ -141,10 +141,7 @@ Box.prototype.events = function() {
141
  });
142
 
143
  // maybe show box right away
144
- if( this.config.trigger.method === "time_on_page" && this.mayAutoShow() ) {
145
- window.setTimeout(this.trigger.bind(this), this.config.trigger.value * 1000 );
146
- // auto-show the box if box is referenced from URL
147
- } else if( this.fits() && this.locationHashRefersBox() ) {
148
  $(window).load(this.show.bind(this));
149
  }
150
 
@@ -152,7 +149,6 @@ Box.prototype.events = function() {
152
 
153
  // generate dom elements for this box
154
  Box.prototype.dom = function() {
155
-
156
  var wrapper = document.createElement('div');
157
  wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';
158
 
@@ -166,6 +162,17 @@ Box.prototype.dom = function() {
166
  content.innerHTML = this.config.content;
167
  box.appendChild(content);
168
 
 
 
 
 
 
 
 
 
 
 
 
169
  if( this.config.closable && this.config.icon ) {
170
  var icon = document.createElement('span');
171
  icon.className = "boxzilla-close-icon";
@@ -382,11 +389,15 @@ var $ = window.jQuery,
382
  EventEmitter = require('wolfy87-eventemitter'),
383
  Boxzilla = Object.create(EventEmitter.prototype),
384
  Box = require('./Box.js')(Boxzilla),
 
385
  boxes = {},
386
  windowHeight = window.innerHeight,
387
  overlay = document.createElement('div'),
388
  exitIntentDelayTimer,
389
- exitIntentTriggered;
 
 
 
390
 
391
  function each( obj, callback ) {
392
  for( var key in obj ) {
@@ -425,17 +436,33 @@ function onKeyUp(e) {
425
  }
426
  }
427
 
428
- function checkTimeCriteria() {
429
- var start = sessionStorage.getItem('boxzilla_start_time');
430
- var now = Date.now();
431
- var timeOnSite = ( now - start ) / 1000;
 
 
 
 
 
 
 
 
432
 
 
 
433
  each(boxes, function(box) {
434
- if( ! box.mayAutoShow() || box.config.trigger.method !== 'time_on_site' ) {
435
  return;
436
  }
437
 
438
- if( timeOnSite > box.config.trigger.value ) {
 
 
 
 
 
 
439
  box.trigger();
440
  }
441
  });
@@ -497,9 +524,11 @@ function triggerExitIntent() {
497
  }
498
 
499
  function onMouseLeave(e) {
 
 
500
  // did mouse leave at top of window?
501
- if( e.clientY < 0 ) {
502
- exitIntentDelayTimer = window.setTimeout(triggerExitIntent, 1000);
503
  }
504
  }
505
 
@@ -510,8 +539,24 @@ function onMouseEnter() {
510
  }
511
  }
512
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
513
  // initialise & add event listeners
514
  Boxzilla.init = function() {
 
 
515
  // add overlay element to dom
516
  overlay.id = 'boxzilla-overlay';
517
  document.body.appendChild(overlay);
@@ -520,15 +565,20 @@ Boxzilla.init = function() {
520
  $(window).on('scroll', throttle(checkHeightCriteria));
521
  $(window).on('resize', throttle(recalculateHeights));
522
  $(window).on('load', recalculateHeights );
523
- $(document).on('mouseleave', onMouseLeave);
524
- $(document).on('mouseenter', onMouseEnter);
525
- $(document).on('keyup', onKeyUp);
526
  $(overlay).click(onOverlayClick);
527
  window.setInterval(checkTimeCriteria, 1000);
 
528
 
529
- if(! sessionStorage.getItem('boxzilla_start_time')) {
530
- sessionStorage.setItem('boxzilla_start_time', Date.now());
531
- }
 
 
 
 
532
 
533
  Boxzilla.trigger('ready');
534
  };
@@ -585,7 +635,31 @@ if ( typeof module !== 'undefined' && module.exports ) {
585
  } else {
586
  this.Boxzilla = Boxzilla;
587
  }
588
- },{"./Box.js":2,"wolfy87-eventemitter":4}],4:[function(require,module,exports){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
589
  /*!
590
  * EventEmitter v4.2.11 - git.io/ee
591
  * Unlicense - http://unlicense.org/
141
  });
142
 
143
  // maybe show box right away
144
+ if( this.fits() && this.locationHashRefersBox() ) {
 
 
 
145
  $(window).load(this.show.bind(this));
146
  }
147
 
149
 
150
  // generate dom elements for this box
151
  Box.prototype.dom = function() {
 
152
  var wrapper = document.createElement('div');
153
  wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';
154
 
162
  content.innerHTML = this.config.content;
163
  box.appendChild(content);
164
 
165
+ // remove <script> from box content and append them to head
166
+ var scripts = content.querySelectorAll('script');
167
+ if(scripts.length) {
168
+ var script = document.createElement('script');
169
+ for( var i=0; i<scripts.length; i++ ) {
170
+ script.appendChild(document.createTextNode(scripts[i].text));
171
+ scripts[i].parentNode.removeChild(scripts[i]);
172
+ }
173
+ document.head.appendChild(script);
174
+ }
175
+
176
  if( this.config.closable && this.config.icon ) {
177
  var icon = document.createElement('span');
178
  icon.className = "boxzilla-close-icon";
389
  EventEmitter = require('wolfy87-eventemitter'),
390
  Boxzilla = Object.create(EventEmitter.prototype),
391
  Box = require('./Box.js')(Boxzilla),
392
+ Timer = require('./Timer.js'),
393
  boxes = {},
394
  windowHeight = window.innerHeight,
395
  overlay = document.createElement('div'),
396
  exitIntentDelayTimer,
397
+ exitIntentTriggered,
398
+ siteTimer = new Timer(sessionStorage.getItem('boxzilla_timer') || 0),
399
+ pageTimer = new Timer(0),
400
+ pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;
401
 
402
  function each( obj, callback ) {
403
  for( var key in obj ) {
436
  }
437
  }
438
 
439
+ // check "pageviews" criteria for each box
440
+ function checkPageViewsCriteria() {
441
+ each(boxes, function(box) {
442
+ if( ! box.mayAutoShow() ) {
443
+ return;
444
+ }
445
+
446
+ if( box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value ) {
447
+ box.trigger();
448
+ }
449
+ });
450
+ }
451
 
452
+ // check time trigger criteria for each box
453
+ function checkTimeCriteria() {
454
  each(boxes, function(box) {
455
+ if( ! box.mayAutoShow() ) {
456
  return;
457
  }
458
 
459
+ // check "time on site" trigger
460
+ if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {
461
+ box.trigger();
462
+ }
463
+
464
+ // check "time on page" trigger
465
+ if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {
466
  box.trigger();
467
  }
468
  });
524
  }
525
 
526
  function onMouseLeave(e) {
527
+ var delay = 400;
528
+
529
  // did mouse leave at top of window?
530
+ if( e.clientY <= 0 ) {
531
+ exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);
532
  }
533
  }
534
 
539
  }
540
  }
541
 
542
+ var timers = {
543
+ start: function() {
544
+ var sessionTime = sessionStorage.getItem('boxzilla_timer');
545
+ if( sessionTime ) siteTimer.time = sessionTime;
546
+ siteTimer.start();
547
+ pageTimer.start();
548
+ },
549
+ stop: function() {
550
+ sessionStorage.setItem('boxzilla_timer', siteTimer.time);
551
+ siteTimer.stop();
552
+ pageTimer.stop();
553
+ }
554
+ };
555
+
556
  // initialise & add event listeners
557
  Boxzilla.init = function() {
558
+ var html = document.documentElement;
559
+
560
  // add overlay element to dom
561
  overlay.id = 'boxzilla-overlay';
562
  document.body.appendChild(overlay);
565
  $(window).on('scroll', throttle(checkHeightCriteria));
566
  $(window).on('resize', throttle(recalculateHeights));
567
  $(window).on('load', recalculateHeights );
568
+ $(html).on('mouseleave', onMouseLeave);
569
+ $(html).on('mouseenter', onMouseEnter);
570
+ $(html).on('keyup', onKeyUp);
571
  $(overlay).click(onOverlayClick);
572
  window.setInterval(checkTimeCriteria, 1000);
573
+ window.setTimeout(checkPageViewsCriteria, 1000 );
574
 
575
+ timers.start();
576
+ $(window).on('focus', timers.start);
577
+ $(window).on('beforeunload', function() {
578
+ timers.stop();
579
+ sessionStorage.setItem('boxzilla_pageviews', ++pageViews);
580
+ });
581
+ $(window).on('blur', timers.stop);
582
 
583
  Boxzilla.trigger('ready');
584
  };
635
  } else {
636
  this.Boxzilla = Boxzilla;
637
  }
638
+ },{"./Box.js":2,"./Timer.js":4,"wolfy87-eventemitter":5}],4:[function(require,module,exports){
639
+ 'use strict';
640
+
641
+ var Timer = function(start) {
642
+ this.time = start;
643
+ this.interval = 0;
644
+ };
645
+
646
+ Timer.prototype.tick = function() {
647
+ this.time++;
648
+ };
649
+
650
+ Timer.prototype.start = function() {
651
+ if( ! this.interval ) {
652
+ this.interval = window.setInterval(this.tick.bind(this), 1000);
653
+ }
654
+ };
655
+
656
+ Timer.prototype.stop = function() {
657
+ window.clearInterval(this.interval);
658
+ this.interval = 0;
659
+ };
660
+
661
+ module.exports = Timer;
662
+ },{}],5:[function(require,module,exports){
663
  /*!
664
  * EventEmitter v4.2.11 - git.io/ee
665
  * Unlicense - http://unlicense.org/
assets/js/script.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){var e=void 0,t=void 0;!function i(t,n,o){function r(c,l){if(!n[c]){if(!t[c]){var a="function"==typeof e&&e;if(!l&&a)return a(c,!0);if(s)return s(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var u=n[c]={exports:{}};t[c][0].call(u.exports,function(e){var i=t[c][1][e];return r(i?i:e)},u,u.exports,i,t,n,o)}return n[c].exports}for(var s="function"==typeof e&&e,c=0;c<o.length;c++)r(o[c]);return r}({1:[function(e,t,i){"use strict";function n(e,t){t.background_color&&(e.style.background=t.background_color),t.color&&(e.style.color=t.color),t.border_color&&(e.style.borderColor=t.border_color),t.border_width&&(e.style.borderWidth=parseInt(t.border_width)+"px"),t.border_style&&(e.style.borderStyle=t.border_style),t.width&&(e.style.maxWidth=parseInt(t.width)+"px")}var o=e("boxzilla"),r=window.boxzilla_options,s=document.body.className.indexOf("logged-in")>-1;s&&r.testMode&&console.log("Boxzilla: Test mode is enabled. Please disable test mode if you're done testing."),o.init();for(var c=0;c<r.boxes.length;c++){var l=r.boxes[c];l.testMode=s&&r.testMode;var a=o.create(l.id,l);n(a.element,l.css)}window.Boxzilla=o},{boxzilla:3}],2:[function(e,t,i){"use strict";function n(e,t){var i={};for(var n in e)i[n]=e[n];for(var n in t)i[n]=t[n];return i}var o,r=window.jQuery,s={animation:"fade",rehide:!1,content:"",cookieTime:0,icon:"&times",minimumScreenWidth:0,position:"center",testMode:!1,trigger:!1,closable:!0},c=function(e,t){this.id=e,this.config=n(s,t),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.closed=!1,this.triggered=!1,this.triggerHeight=0,this.cookieSet=!1,this.config.trigger&&("percentage"!==this.config.trigger.method&&"element"!==this.config.trigger.method||(this.triggerHeight=this.calculateTriggerHeight()),this.cookieSet=this.isCookieSet()),this.element=this.dom(),this.$element=r(this.element),this.events()};c.prototype.events=function(){var e=this;this.$element.find(".boxzilla-close-icon").click(e.dismiss.bind(this)),this.$element.on("click","a",function(t){o.trigger("box.interactions.link",[e,t.target])}),this.$element.on("submit","form",function(t){e.setCookie(),o.trigger("box.interactions.form",[e,t.target])}),r(document.body).on("click",'a[href="#boxzilla-'+e.id+'"]',function(){return e.toggle(),!1}),"time_on_page"===this.config.trigger.method&&this.mayAutoShow()?window.setTimeout(this.trigger.bind(this),1e3*this.config.trigger.value):this.fits()&&this.locationHashRefersBox()&&r(window).load(this.show.bind(this))},c.prototype.dom=function(){var e=document.createElement("div");e.className="boxzilla-container boxzilla-"+this.config.position+"-container";var t=document.createElement("div");t.className="boxzilla boxzilla-"+this.id+" boxzilla-"+this.config.position,t.style.display="none",e.appendChild(t);var i=document.createElement("div");if(i.className="boxzilla-content",i.innerHTML=this.config.content,t.appendChild(i),this.config.closable&&this.config.icon){var n=document.createElement("span");n.className="boxzilla-close-icon",n.innerHTML=this.config.icon,t.appendChild(n)}return document.body.appendChild(e),t},c.prototype.setCustomBoxStyling=function(){this.element.style.overflowY="auto",this.element.style.maxHeight="none";var e=window.innerHeight,t=this.$element.outerHeight();if(t>e&&(this.element.style.maxHeight=e+"px",this.element.style.overflowY="scroll"),"center"===this.config.position){var i=(e-t)/2;i=i>=0?i:0,this.element.style.marginTop=i+"px"}},c.prototype.toggle=function(e){return"undefined"==typeof e&&(e=!this.visible),this.$element.is(":animated")?!1:e===this.visible?!1:e||this.config.closable?(this.visible=e,this.setCustomBoxStyling(),"center"===this.config.position&&r(this.overlay).fadeToggle("slow"),o.trigger("box."+(e?"show":"hide"),[this]),"fade"===this.config.animation?this.$element.fadeToggle("slow"):this.$element.slideToggle("slow"),!0):!1},c.prototype.show=function(){return this.toggle(!0)},c.prototype.hide=function(){return this.toggle(!1)},c.prototype.calculateTriggerHeight=function(){var e=0;if("element"===this.config.trigger.method){var t=r(this.config.trigger.value).first();e=t.length>0?t.offset().top:0}else"percentage"===this.config.trigger.method&&(e=this.config.trigger.value/100*r(document).height());return e},c.prototype.setCookie=function(){if(this.config.cookieTime){var e=new Date;e.setDate(e.getDate()+this.config.cookieTime),document.cookie="boxzilla_box_"+this.id+"=true; expires="+e.toUTCString()+"; path=/"}},c.prototype.locationHashRefersBox=function(){if(!window.location.hash||0===window.location.hash.length)return!1;var e=window.location.hash.substring(1);return e===this.element.id?!0:!!this.element.querySelector("#"+e)},c.prototype.fits=function(){return this.config.minimumScreenWidth<=0?!0:window.innerWidth>this.config.minimumScreenWidth},c.prototype.mayAutoShow=function(){return this.closed?!1:this.fits()&&this.config.trigger?!this.cookieSet:!1},c.prototype.mayRehide=function(){return this.config.rehide&&this.triggered},c.prototype.isCookieSet=function(){if(this.config.testMode)return!1;if(!this.config.cookieTime)return!1;var e="true"===document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*boxzilla_box_"+this.id+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1");return e},c.prototype.trigger=function(){var e=this.show();e&&(this.triggered=!0)},c.prototype.dismiss=function(){this.hide(),this.setCookie(),this.closed=!0,o.trigger("box.dismiss",[this])},t.exports=function(e){return o=e,c}},{}],3:[function(e,t,i){"use strict";function n(e,t){for(var i in e)e.hasOwnProperty(i)&&t(e[i])}function o(e,t,i){t||(t=250);var n,o;return function(){var r=i||this,s=+new Date,c=arguments;n&&n+t>s?(clearTimeout(o),o=setTimeout(function(){n=s,e.apply(r,c)},t)):(n=s,e.apply(r,c))}}function r(e){27==e.keyCode&&v.dismiss()}function s(){var e=sessionStorage.getItem("boxzilla_start_time"),t=Date.now(),i=(t-e)/1e3;n(w,function(e){e.mayAutoShow()&&"time_on_site"===e.config.trigger.method&&i>e.config.trigger.value&&e.trigger()})}function c(){var e=window.scrollY,t=e+.9*b;n(w,function(e){!e.mayAutoShow()||e.triggerHeight<=0||(t>e.triggerHeight?e.trigger():e.mayRehide()&&e.hide())})}function l(){b=window.innerHeight,n(w,function(e){e.setCustomBoxStyling()})}function a(e){var t=e.offsetX,i=e.offsetY;n(w,function(e){var n=e.element.getBoundingClientRect(),o=100+.05*window.innerWidth;(t<n.left-o||t>n.right+o||i<n.top-o||i>n.bottom+o)&&e.dismiss()})}function h(){g||(n(w,function(e){e.mayAutoShow()&&"exit_intent"===e.config.trigger.method&&e.trigger()}),g=!0)}function u(e){e.clientY<0&&(d=window.setTimeout(h,1e3))}function f(){d&&(window.clearInterval(d),d=null)}var d,g,m=window.jQuery,p=e("wolfy87-eventemitter"),v=Object.create(p.prototype),y=e("./Box.js")(v),w={},b=window.innerHeight,x=document.createElement("div");v.init=function(){x.id="boxzilla-overlay",document.body.appendChild(x),m(window).on("scroll",o(c)),m(window).on("resize",o(l)),m(window).on("load",l),m(document).on("mouseleave",u),m(document).on("mouseenter",f),m(document).on("keyup",r),m(x).click(a),window.setInterval(s,1e3),sessionStorage.getItem("boxzilla_start_time")||sessionStorage.setItem("boxzilla_start_time",Date.now()),v.trigger("ready")},v.create=function(e,t){return w[e]=new y(e,t),w[e]},v.dismiss=function(e){"undefined"==typeof e?n(w,function(e){e.dismiss()}):"object"==typeof w[e]&&w[e].dismiss()},v.hide=function(e){"undefined"==typeof e?n(w,function(e){e.hide()}):"object"==typeof w[e]&&w[e].hide()},v.show=function(e){"undefined"==typeof e?n(w,function(e){e.show()}):"object"==typeof w[e]&&w[e].show()},v.toggle=function(e){"undefined"==typeof e?n(w,function(e){e.toggle()}):"object"==typeof w[e]&&w[e].toggle()},"undefined"!=typeof t&&t.exports?t.exports=v:this.Boxzilla=v},{"./Box.js":2,"wolfy87-eventemitter":4}],4:[function(e,i,n){(function(){"use strict";function e(){}function n(e,t){for(var i=e.length;i--;)if(e[i].listener===t)return i;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}var r=e.prototype,s=this,c=s.EventEmitter;r.getListeners=function(e){var t,i,n=this._getEvents();if(e instanceof RegExp){t={};for(i in n)n.hasOwnProperty(i)&&e.test(i)&&(t[i]=n[i])}else t=n[e]||(n[e]=[]);return t},r.flattenListeners=function(e){var t,i=[];for(t=0;t<e.length;t+=1)i.push(e[t].listener);return i},r.getListenersAsObject=function(e){var t,i=this.getListeners(e);return i instanceof Array&&(t={},t[e]=i),t||i},r.addListener=function(e,t){var i,o=this.getListenersAsObject(e),r="object"==typeof t;for(i in o)o.hasOwnProperty(i)&&-1===n(o[i],t)&&o[i].push(r?t:{listener:t,once:!1});return this},r.on=o("addListener"),r.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},r.once=o("addOnceListener"),r.defineEvent=function(e){return this.getListeners(e),this},r.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},r.removeListener=function(e,t){var i,o,r=this.getListenersAsObject(e);for(o in r)r.hasOwnProperty(o)&&(i=n(r[o],t),-1!==i&&r[o].splice(i,1));return this},r.off=o("removeListener"),r.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},r.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},r.manipulateListeners=function(e,t,i){var n,o,r=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(n=i.length;n--;)r.call(this,t,i[n]);else for(n in t)t.hasOwnProperty(n)&&(o=t[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},r.removeEvent=function(e){var t,i=typeof e,n=this._getEvents();if("string"===i)delete n[e];else if(e instanceof RegExp)for(t in n)n.hasOwnProperty(t)&&e.test(t)&&delete n[t];else delete this._events;return this},r.removeAllListeners=o("removeEvent"),r.emitEvent=function(e,t){var i,n,o,r,s,c=this.getListenersAsObject(e);for(r in c)if(c.hasOwnProperty(r))for(i=c[r].slice(0),o=i.length;o--;)n=i[o],n.once===!0&&this.removeListener(e,n.listener),s=n.listener.apply(this,t||[]),s===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},r.trigger=o("emitEvent"),r.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},r.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},r._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},r._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return s.EventEmitter=c,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof i&&i.exports?i.exports=e:s.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=script.min.js.map
1
+ !function(){var e=void 0,t=void 0;!function i(t,n,o){function r(c,l){if(!n[c]){if(!t[c]){var a="function"==typeof e&&e;if(!l&&a)return a(c,!0);if(s)return s(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var u=n[c]={exports:{}};t[c][0].call(u.exports,function(e){var i=t[c][1][e];return r(i?i:e)},u,u.exports,i,t,n,o)}return n[c].exports}for(var s="function"==typeof e&&e,c=0;c<o.length;c++)r(o[c]);return r}({1:[function(e,t,i){"use strict";function n(e,t){t.background_color&&(e.style.background=t.background_color),t.color&&(e.style.color=t.color),t.border_color&&(e.style.borderColor=t.border_color),t.border_width&&(e.style.borderWidth=parseInt(t.border_width)+"px"),t.border_style&&(e.style.borderStyle=t.border_style),t.width&&(e.style.maxWidth=parseInt(t.width)+"px")}var o=e("boxzilla"),r=window.boxzilla_options,s=document.body.className.indexOf("logged-in")>-1;s&&r.testMode&&console.log("Boxzilla: Test mode is enabled. Please disable test mode if you're done testing."),o.init();for(var c=0;c<r.boxes.length;c++){var l=r.boxes[c];l.testMode=s&&r.testMode;var a=o.create(l.id,l);n(a.element,l.css)}window.Boxzilla=o},{boxzilla:3}],2:[function(e,t,i){"use strict";function n(e,t){var i={};for(var n in e)i[n]=e[n];for(var n in t)i[n]=t[n];return i}var o,r=window.jQuery,s={animation:"fade",rehide:!1,content:"",cookieTime:0,icon:"&times",minimumScreenWidth:0,position:"center",testMode:!1,trigger:!1,closable:!0},c=function(e,t){this.id=e,this.config=n(s,t),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.closed=!1,this.triggered=!1,this.triggerHeight=0,this.cookieSet=!1,this.config.trigger&&("percentage"!==this.config.trigger.method&&"element"!==this.config.trigger.method||(this.triggerHeight=this.calculateTriggerHeight()),this.cookieSet=this.isCookieSet()),this.element=this.dom(),this.$element=r(this.element),this.events()};c.prototype.events=function(){var e=this;this.$element.find(".boxzilla-close-icon").click(e.dismiss.bind(this)),this.$element.on("click","a",function(t){o.trigger("box.interactions.link",[e,t.target])}),this.$element.on("submit","form",function(t){e.setCookie(),o.trigger("box.interactions.form",[e,t.target])}),r(document.body).on("click",'a[href="#boxzilla-'+e.id+'"]',function(){return e.toggle(),!1}),this.fits()&&this.locationHashRefersBox()&&r(window).load(this.show.bind(this))},c.prototype.dom=function(){var e=document.createElement("div");e.className="boxzilla-container boxzilla-"+this.config.position+"-container";var t=document.createElement("div");t.className="boxzilla boxzilla-"+this.id+" boxzilla-"+this.config.position,t.style.display="none",e.appendChild(t);var i=document.createElement("div");i.className="boxzilla-content",i.innerHTML=this.config.content,t.appendChild(i);var n=i.querySelectorAll("script");if(n.length){for(var o=document.createElement("script"),r=0;r<n.length;r++)o.appendChild(document.createTextNode(n[r].text)),n[r].parentNode.removeChild(n[r]);document.head.appendChild(o)}if(this.config.closable&&this.config.icon){var s=document.createElement("span");s.className="boxzilla-close-icon",s.innerHTML=this.config.icon,t.appendChild(s)}return document.body.appendChild(e),t},c.prototype.setCustomBoxStyling=function(){this.element.style.overflowY="auto",this.element.style.maxHeight="none";var e=window.innerHeight,t=this.$element.outerHeight();if(t>e&&(this.element.style.maxHeight=e+"px",this.element.style.overflowY="scroll"),"center"===this.config.position){var i=(e-t)/2;i=i>=0?i:0,this.element.style.marginTop=i+"px"}},c.prototype.toggle=function(e){return"undefined"==typeof e&&(e=!this.visible),this.$element.is(":animated")?!1:e===this.visible?!1:e||this.config.closable?(this.visible=e,this.setCustomBoxStyling(),"center"===this.config.position&&r(this.overlay).fadeToggle("slow"),o.trigger("box."+(e?"show":"hide"),[this]),"fade"===this.config.animation?this.$element.fadeToggle("slow"):this.$element.slideToggle("slow"),!0):!1},c.prototype.show=function(){return this.toggle(!0)},c.prototype.hide=function(){return this.toggle(!1)},c.prototype.calculateTriggerHeight=function(){var e=0;if("element"===this.config.trigger.method){var t=r(this.config.trigger.value).first();e=t.length>0?t.offset().top:0}else"percentage"===this.config.trigger.method&&(e=this.config.trigger.value/100*r(document).height());return e},c.prototype.setCookie=function(){if(this.config.cookieTime){var e=new Date;e.setDate(e.getDate()+this.config.cookieTime),document.cookie="boxzilla_box_"+this.id+"=true; expires="+e.toUTCString()+"; path=/"}},c.prototype.locationHashRefersBox=function(){if(!window.location.hash||0===window.location.hash.length)return!1;var e=window.location.hash.substring(1);return e===this.element.id?!0:!!this.element.querySelector("#"+e)},c.prototype.fits=function(){return this.config.minimumScreenWidth<=0?!0:window.innerWidth>this.config.minimumScreenWidth},c.prototype.mayAutoShow=function(){return this.closed?!1:this.fits()&&this.config.trigger?!this.cookieSet:!1},c.prototype.mayRehide=function(){return this.config.rehide&&this.triggered},c.prototype.isCookieSet=function(){if(this.config.testMode)return!1;if(!this.config.cookieTime)return!1;var e="true"===document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*boxzilla_box_"+this.id+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1");return e},c.prototype.trigger=function(){var e=this.show();e&&(this.triggered=!0)},c.prototype.dismiss=function(){this.hide(),this.setCookie(),this.closed=!0,o.trigger("box.dismiss",[this])},t.exports=function(e){return o=e,c}},{}],3:[function(e,t,i){"use strict";function n(e,t){for(var i in e)e.hasOwnProperty(i)&&t(e[i])}function o(e,t,i){t||(t=250);var n,o;return function(){var r=i||this,s=+new Date,c=arguments;n&&n+t>s?(clearTimeout(o),o=setTimeout(function(){n=s,e.apply(r,c)},t)):(n=s,e.apply(r,c))}}function r(e){27==e.keyCode&&y.dismiss()}function s(){n(x,function(e){e.mayAutoShow()&&"pageviews"===e.config.trigger.method&&z>=e.config.trigger.value&&e.trigger()})}function c(){n(x,function(e){e.mayAutoShow()&&("time_on_site"===e.config.trigger.method&&L.time>=e.config.trigger.value&&e.trigger(),"time_on_page"===e.config.trigger.method&&k.time>=e.config.trigger.value&&e.trigger())})}function l(){var e=window.scrollY,t=e+.9*_;n(x,function(e){!e.mayAutoShow()||e.triggerHeight<=0||(t>e.triggerHeight?e.trigger():e.mayRehide()&&e.hide())})}function a(){_=window.innerHeight,n(x,function(e){e.setCustomBoxStyling()})}function h(e){var t=e.offsetX,i=e.offsetY;n(x,function(e){var n=e.element.getBoundingClientRect(),o=100+.05*window.innerWidth;(t<n.left-o||t>n.right+o||i<n.top-o||i>n.bottom+o)&&e.dismiss()})}function u(){m||(n(x,function(e){e.mayAutoShow()&&"exit_intent"===e.config.trigger.method&&e.trigger()}),m=!0)}function f(e){var t=400;e.clientY<=0&&(g=window.setTimeout(u,t))}function d(){g&&(window.clearInterval(g),g=null)}var g,m,p=window.jQuery,v=e("wolfy87-eventemitter"),y=Object.create(v.prototype),w=e("./Box.js")(y),b=e("./Timer.js"),x={},_=window.innerHeight,E=document.createElement("div"),L=new b(sessionStorage.getItem("boxzilla_timer")||0),k=new b(0),z=sessionStorage.getItem("boxzilla_pageviews")||0,S={start:function(){var e=sessionStorage.getItem("boxzilla_timer");e&&(L.time=e),L.start(),k.start()},stop:function(){sessionStorage.setItem("boxzilla_timer",L.time),L.stop(),k.stop()}};y.init=function(){var e=document.documentElement;E.id="boxzilla-overlay",document.body.appendChild(E),p(window).on("scroll",o(l)),p(window).on("resize",o(a)),p(window).on("load",a),p(e).on("mouseleave",f),p(e).on("mouseenter",d),p(e).on("keyup",r),p(E).click(h),window.setInterval(c,1e3),window.setTimeout(s,1e3),S.start(),p(window).on("focus",S.start),p(window).on("beforeunload",function(){S.stop(),sessionStorage.setItem("boxzilla_pageviews",++z)}),p(window).on("blur",S.stop),y.trigger("ready")},y.create=function(e,t){return x[e]=new w(e,t),x[e]},y.dismiss=function(e){"undefined"==typeof e?n(x,function(e){e.dismiss()}):"object"==typeof x[e]&&x[e].dismiss()},y.hide=function(e){"undefined"==typeof e?n(x,function(e){e.hide()}):"object"==typeof x[e]&&x[e].hide()},y.show=function(e){"undefined"==typeof e?n(x,function(e){e.show()}):"object"==typeof x[e]&&x[e].show()},y.toggle=function(e){"undefined"==typeof e?n(x,function(e){e.toggle()}):"object"==typeof x[e]&&x[e].toggle()},"undefined"!=typeof t&&t.exports?t.exports=y:this.Boxzilla=y},{"./Box.js":2,"./Timer.js":4,"wolfy87-eventemitter":5}],4:[function(e,t,i){"use strict";var n=function(e){this.time=e,this.interval=0};n.prototype.tick=function(){this.time++},n.prototype.start=function(){this.interval||(this.interval=window.setInterval(this.tick.bind(this),1e3))},n.prototype.stop=function(){window.clearInterval(this.interval),this.interval=0},t.exports=n},{}],5:[function(e,i,n){(function(){"use strict";function e(){}function n(e,t){for(var i=e.length;i--;)if(e[i].listener===t)return i;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}var r=e.prototype,s=this,c=s.EventEmitter;r.getListeners=function(e){var t,i,n=this._getEvents();if(e instanceof RegExp){t={};for(i in n)n.hasOwnProperty(i)&&e.test(i)&&(t[i]=n[i])}else t=n[e]||(n[e]=[]);return t},r.flattenListeners=function(e){var t,i=[];for(t=0;t<e.length;t+=1)i.push(e[t].listener);return i},r.getListenersAsObject=function(e){var t,i=this.getListeners(e);return i instanceof Array&&(t={},t[e]=i),t||i},r.addListener=function(e,t){var i,o=this.getListenersAsObject(e),r="object"==typeof t;for(i in o)o.hasOwnProperty(i)&&-1===n(o[i],t)&&o[i].push(r?t:{listener:t,once:!1});return this},r.on=o("addListener"),r.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},r.once=o("addOnceListener"),r.defineEvent=function(e){return this.getListeners(e),this},r.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},r.removeListener=function(e,t){var i,o,r=this.getListenersAsObject(e);for(o in r)r.hasOwnProperty(o)&&(i=n(r[o],t),-1!==i&&r[o].splice(i,1));return this},r.off=o("removeListener"),r.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},r.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},r.manipulateListeners=function(e,t,i){var n,o,r=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(n=i.length;n--;)r.call(this,t,i[n]);else for(n in t)t.hasOwnProperty(n)&&(o=t[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},r.removeEvent=function(e){var t,i=typeof e,n=this._getEvents();if("string"===i)delete n[e];else if(e instanceof RegExp)for(t in n)n.hasOwnProperty(t)&&e.test(t)&&delete n[t];else delete this._events;return this},r.removeAllListeners=o("removeEvent"),r.emitEvent=function(e,t){var i,n,o,r,s,c=this.getListenersAsObject(e);for(r in c)if(c.hasOwnProperty(r))for(i=c[r].slice(0),o=i.length;o--;)n=i[o],n.once===!0&&this.removeListener(e,n.listener),s=n.listener.apply(this,t||[]),s===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},r.trigger=o("emitEvent"),r.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},r.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},r._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},r._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return s.EventEmitter=c,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof i&&i.exports?i.exports=e:s.EventEmitter=e}).call(this)},{}]},{},[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","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","isLoggedIn","document","body","className","indexOf","testMode","console","log","init","boxes","boxOpts","box","create","id","boxzilla","2","merge","obj1","obj2","obj3","attrname","$","jQuery","defaults","animation","rehide","content","cookieTime","icon","minimumScreenWidth","position","trigger","closable","Box","config","this","overlay","getElementById","visible","closed","triggered","triggerHeight","cookieSet","method","calculateTriggerHeight","isCookieSet","dom","$element","events","prototype","find","click","dismiss","bind","on","target","setCookie","toggle","mayAutoShow","setTimeout","value","fits","locationHashRefersBox","load","show","wrapper","createElement","display","appendChild","innerHTML","setCustomBoxStyling","overflowY","maxHeight","windowHeight","innerHeight","boxHeight","outerHeight","newTopMargin","marginTop","is","fadeToggle","slideToggle","hide","$triggerElement","first","offset","top","height","expiryDate","Date","setDate","getDate","cookie","toUTCString","location","hash","elementId","substring","querySelector","innerWidth","mayRehide","replace","RegExp","shown","_Boxzilla","3","each","obj","callback","key","hasOwnProperty","throttle","fn","threshhold","scope","last","deferTimer","context","now","args","arguments","clearTimeout","apply","onKeyUp","keyCode","checkTimeCriteria","start","sessionStorage","getItem","timeOnSite","checkHeightCriteria","scrollY","scrollHeight","recalculateHeights","onOverlayClick","x","offsetX","y","offsetY","rect","getBoundingClientRect","margin","left","right","bottom","triggerExitIntent","exitIntentTriggered","onMouseLeave","clientY","exitIntentDelayTimer","onMouseEnter","clearInterval","EventEmitter","Object","setInterval","setItem","opts","./Box.js","wolfy87-eventemitter","4","indexOfListener","listeners","listener","alias","name","proto","originalGlobalValue","getListeners","evt","response","_getEvents","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","listenerIsWrapped","once","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,OAAeC,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,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGQ,QAAkD,IAAI,GAA1CL,GAAkB,kBAATX,IAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKY,GAAG,SAASnB,EAAQoB,EAAOJ,GACvhB,YA2BA,SAASK,GAAIC,EAASC,GACdA,EAAOC,mBACPF,EAAQG,MAAMC,WAAaH,EAAOC,kBAGlCD,EAAOI,QACPL,EAAQG,M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,IACvCrP,EAAO,WACH,MAAO+L,KAGY,gBAAX7K,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUiL,EAGjBjL,EAAQiL,aAAeA,IAE7BhL,KAAK2D,gBAEI","file":"script.min.js","sourcesContent":["(function () { var require = 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 Boxzilla = require('boxzilla');\nvar options = window.boxzilla_options;\nvar isLoggedIn = document.body.className.indexOf('logged-in') > -1;\n\n// print message when test mode is enabled\nif( 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\nBoxzilla.init();\n\n// create boxes from options\nfor( 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 // create box\n var box = Boxzilla.create( boxOpts.id, boxOpts);\n \n // add custom css to box\n css(box.element, boxOpts.css);\n}\n\nfunction 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\nwindow.Boxzilla = Boxzilla;\n},{\"boxzilla\":3}],2:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery,\n defaults = {\n 'animation': 'fade',\n 'rehide': false,\n 'content': '',\n 'cookieTime': 0,\n 'icon': '&times',\n 'minimumScreenWidth': 0,\n 'position': 'center',\n 'testMode': false,\n 'trigger': false,\n 'closable': true\n }, Boxzilla;\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) { obj3[attrname] = obj1[attrname]; }\n for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }\n return obj3;\n}\n\n// Box Object\nvar Box = function( id, config ) {\n this.id \t\t= 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 \t= false;\n this.closed \t= false;\n this.triggered \t= false;\n this.triggerHeight = 0;\n this.cookieSet = false;\n\n // if a trigger was given, calculate values once and store\n if( this.config.trigger ) {\n if( this.config.trigger.method === 'percentage' || this.config.trigger.method === 'element' ) {\n this.triggerHeight = this.calculateTriggerHeight();\n }\n\n this.cookieSet = this.isCookieSet();\n }\n\n // create dom element for this box\n this.element = this.dom();\n this.$element = $(this.element);\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 this.$element.find('.boxzilla-close-icon').click(box.dismiss.bind(this));\n\n this.$element.on('click', 'a', function(e) {\n Boxzilla.trigger('box.interactions.link', [ box, e.target ] );\n });\n\n this.$element.on('submit', 'form', function(e) {\n box.setCookie();\n Boxzilla.trigger('box.interactions.form', [ box, e.target ]);\n });\n\n // attach event to all links referring #boxzilla-{box_id}\n $(document.body).on('click', 'a[href=\"#boxzilla-' + box.id + '\"]', function() {\n box.toggle();\n return false;\n });\n\n // maybe show box right away\n if( this.config.trigger.method === \"time_on_page\" && this.mayAutoShow() ) {\n window.setTimeout(this.trigger.bind(this), this.config.trigger.value * 1000 );\n // auto-show the box if box is referenced from URL\n } else if( this.fits() && this.locationHashRefersBox() ) {\n $(window).load(this.show.bind(this));\n }\n\n};\n\n// generate dom elements for this box\nBox.prototype.dom = function() {\n\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.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 icon = document.createElement('span');\n icon.className = \"boxzilla-close-icon\";\n icon.innerHTML = this.config.icon;\n box.appendChild(icon);\n }\n\n document.body.appendChild(wrapper);\n\n return 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 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.outerHeight();\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};\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 // do nothing if element is being animated\n if( this.$element.is(':animated') ) {\n return false;\n }\n\n // is box already at desired visibility?\n if( show === this.visible ) {\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 custom styling for which CSS is \"too stupid\"\n this.setCustomBoxStyling();\n\n // fadein / fadeout the overlay if position is \"center\"\n if( this.config.position === 'center' ) {\n $(this.overlay).fadeToggle('slow');\n }\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.animation === 'fade' ) {\n this.$element.fadeToggle( 'slow' );\n } else {\n this.$element.slideToggle( 'slow' );\n }\n\n // // focus on first input field in box\n // this.$element.find('input').first().focus();\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.method === 'element' ) {\n var $triggerElement = $(this.config.trigger.value).first();\n triggerHeight = ( $triggerElement.length > 0 ) ? $triggerElement.offset().top : 0;\n } else if( this.config.trigger.method === 'percentage' ) {\n triggerHeight = ( this.config.trigger.value / 100 * $(document).height() );\n }\n\n return triggerHeight;\n};\n\n// set cookie that disables automatically showing the box\nBox.prototype.setCookie = function() {\n // do nothing if cookieTime evaluates to false\n if(! this.config.cookieTime) {\n return;\n }\n\n var expiryDate = new Date();\n expiryDate.setDate( expiryDate.getDate() + this.config.cookieTime );\n document.cookie = 'boxzilla_box_'+ this.id + '=true; expires='+ expiryDate.toUTCString() +'; path=/';\n};\n\n// checks whether window.location.hash equals the box element ID or that of any element inside the box\nBox.prototype.locationHashRefersBox = function() {\n\n if( ! window.location.hash || 0 === window.location.hash.length ) {\n return false;\n }\n\n var elementId = window.location.hash.substring(1);\n if( elementId === this.element.id ) {\n return true;\n } else if( this.element.querySelector('#' + elementId) ) {\n return true;\n }\n\n return false;\n};\n\nBox.prototype.fits = function() {\n if( this.config.minimumScreenWidth <= 0 ) {\n return true;\n }\n\n return window.innerWidth > this.config.minimumScreenWidth\n};\n\n// is this box enabled?\nBox.prototype.mayAutoShow = function() {\n\n // don't show if box was closed (dismissed) before\n if( this.closed ) {\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\n if( this.config.testMode ) {\n return false;\n }\n\n // check for cookie\n if( ! this.config.cookieTime ) {\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\nBox.prototype.trigger = function() {\n var shown = this.show();\n if( shown ) {\n this.triggered = true;\n }\n};\n\nBox.prototype.dismiss = function() {\n this.hide();\n this.setCookie();\n this.closed = true;\n Boxzilla.trigger('box.dismiss', [ this ]);\n};\n\nmodule.exports = function(_Boxzilla) {\n Boxzilla = _Boxzilla;\n return Box;\n};\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery,\n EventEmitter = require('wolfy87-eventemitter'),\n Boxzilla = Object.create(EventEmitter.prototype),\n Box = require('./Box.js')(Boxzilla),\n boxes = {},\n windowHeight = window.innerHeight,\n overlay = document.createElement('div'),\n exitIntentDelayTimer,\n exitIntentTriggered;\n\nfunction each( obj, callback ) {\n for( var key in obj ) {\n if(! obj.hasOwnProperty(key)) continue;\n callback(obj[key]);\n }\n}\n\nfunction throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n var last,\n 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\nfunction checkTimeCriteria() {\n var start = sessionStorage.getItem('boxzilla_start_time');\n var now = Date.now();\n var timeOnSite = ( now - start ) / 1000;\n\n each(boxes, function(box) {\n if( ! box.mayAutoShow() || box.config.trigger.method !== 'time_on_site' ) {\n return;\n }\n\n if( timeOnSite > box.config.trigger.value ) {\n box.trigger();\n }\n });\n}\n\n// check triggerHeight criteria for all boxes\nfunction checkHeightCriteria() {\n var scrollY = window.scrollY;\n var scrollHeight = scrollY + ( windowHeight * 0.9 );\n\n each(boxes, function(box) {\n if( ! box.mayAutoShow() || box.triggerHeight <= 0 ) {\n return;\n }\n\n if( scrollHeight > box.triggerHeight ) {\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 windowHeight = window.innerHeight;\n\n each(boxes, function(box) {\n box.setCustomBoxStyling();\n });\n}\n\nfunction onOverlayClick(e) {\n var x = e.offsetX;\n var y = e.offsetY;\n\n // calculate if click was near a box to avoid closing it (click error margin)\n each(boxes, function(box) {\n var rect = box.element.getBoundingClientRect();\n var margin = 100 + ( window.innerWidth * 0.05 );\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 if(exitIntentTriggered) return;\n\n each(boxes, 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 // did mouse leave at top of window?\n if( e.clientY < 0 ) {\n exitIntentDelayTimer = window.setTimeout(triggerExitIntent, 1000);\n }\n}\n\nfunction onMouseEnter() {\n if( exitIntentDelayTimer ) {\n window.clearInterval(exitIntentDelayTimer);\n exitIntentDelayTimer = null;\n }\n}\n\n// initialise & add event listeners\nBoxzilla.init = function() {\n // add overlay element to dom\n overlay.id = 'boxzilla-overlay';\n document.body.appendChild(overlay);\n\n // event binds\n $(window).on('scroll', throttle(checkHeightCriteria));\n $(window).on('resize', throttle(recalculateHeights));\n $(window).on('load', recalculateHeights );\n $(document).on('mouseleave', onMouseLeave);\n $(document).on('mouseenter', onMouseEnter);\n $(document).on('keyup', onKeyUp);\n $(overlay).click(onOverlayClick);\n window.setInterval(checkTimeCriteria, 1000);\n\n if(! sessionStorage.getItem('boxzilla_start_time')) {\n sessionStorage.setItem('boxzilla_start_time', Date.now());\n }\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 boxes[id] = new Box(id, opts);\n return boxes[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 each(boxes, function(box) { box.dismiss(); });\n } else if( typeof( boxes[id] ) === \"object\" ) {\n boxes[id].dismiss();\n }\n};\n\nBoxzilla.hide = function(id) {\n if( typeof(id) === \"undefined\" ) {\n each(boxes, function(box) { box.hide(); });\n } else if( typeof( boxes[id] ) === \"object\" ) {\n boxes[id].hide();\n }\n};\n\nBoxzilla.show = function(id) {\n if( typeof(id) === \"undefined\" ) {\n each(boxes, function(box) { box.show(); });\n } else if( typeof( boxes[id] ) === \"object\" ) {\n boxes[id].show();\n }\n};\n\nBoxzilla.toggle = function(id) {\n if( typeof(id) === \"undefined\" ) {\n each(boxes, function(box) { box.toggle(); });\n } else if( typeof( boxes[id] ) === \"object\" ) {\n boxes[id].toggle();\n }\n};\n\nif ( typeof module !== 'undefined' && module.exports ) {\n module.exports = Boxzilla;\n} else {\n this.Boxzilla = Boxzilla;\n}\n},{\"./Box.js\":2,\"wolfy87-eventemitter\":4}],4:[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 })();"],"sourceRoot":"/source/"}
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","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","isLoggedIn","document","body","className","indexOf","testMode","console","log","init","boxes","boxOpts","box","create","id","boxzilla","2","merge","obj1","obj2","obj3","attrname","$","jQuery","defaults","animation","rehide","content","cookieTime","icon","minimumScreenWidth","position","trigger","closable","Box","config","this","overlay","getElementById","visible","closed","triggered","triggerHeight","cookieSet","method","calculateTriggerHeight","isCookieSet","dom","$element","events","prototype","find","click","dismiss","bind","on","target","setCookie","toggle","fits","locationHashRefersBox","load","show","wrapper","createElement","display","appendChild","innerHTML","scripts","querySelectorAll","script","createTextNode","text","parentNode","removeChild","head","setCustomBoxStyling","overflowY","maxHeight","windowHeight","innerHeight","boxHeight","outerHeight","newTopMargin","marginTop","is","fadeToggle","slideToggle","hide","$triggerElement","value","first","offset","top","height","expiryDate","Date","setDate","getDate","cookie","toUTCString","location","hash","elementId","substring","querySelector","innerWidth","mayAutoShow","mayRehide","replace","RegExp","shown","_Boxzilla","3","each","obj","callback","key","hasOwnProperty","throttle","fn","threshhold","scope","last","deferTimer","context","now","args","arguments","clearTimeout","setTimeout","apply","onKeyUp","keyCode","checkPageViewsCriteria","pageViews","checkTimeCriteria","siteTimer","time","pageTimer","checkHeightCriteria","scrollY","scrollHeight","recalculateHeights","onOverlayClick","x","offsetX","y","offsetY","rect","getBoundingClientRect","margin","left","right","bottom","triggerExitIntent","exitIntentTriggered","onMouseLeave","delay","clientY","exitIntentDelayTimer","onMouseEnter","clearInterval","EventEmitter","Object","Timer","sessionStorage","getItem","timers","start","sessionTime","stop","setItem","html","documentElement","setInterval","opts","./Box.js","./Timer.js","wolfy87-eventemitter","4","interval","tick","5","indexOfListener","listeners","listener","alias","name","proto","originalGlobalValue","getListeners","evt","response","_getEvents","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","type","_events","removeAllListeners","emitEvent","listenersMap","slice","_getOnceReturnValue","emit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require = 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 Boxzilla = require('boxzilla');\nvar options = window.boxzilla_options;\nvar isLoggedIn = document.body.className.indexOf('logged-in') > -1;\n\n// print message when test mode is enabled\nif( 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\nBoxzilla.init();\n\n// create boxes from options\nfor( 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 // create box\n var box = Boxzilla.create( boxOpts.id, boxOpts);\n \n // add custom css to box\n css(box.element, boxOpts.css);\n}\n\nfunction 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\nwindow.Boxzilla = Boxzilla;\n},{\"boxzilla\":3}],2:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery,\n defaults = {\n 'animation': 'fade',\n 'rehide': false,\n 'content': '',\n 'cookieTime': 0,\n 'icon': '&times',\n 'minimumScreenWidth': 0,\n 'position': 'center',\n 'testMode': false,\n 'trigger': false,\n 'closable': true\n }, Boxzilla;\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) { obj3[attrname] = obj1[attrname]; }\n for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }\n return obj3;\n}\n\n// Box Object\nvar Box = function( id, config ) {\n this.id \t\t= 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 \t= false;\n this.closed \t= false;\n this.triggered \t= false;\n this.triggerHeight = 0;\n this.cookieSet = false;\n\n // if a trigger was given, calculate values once and store\n if( this.config.trigger ) {\n if( this.config.trigger.method === 'percentage' || this.config.trigger.method === 'element' ) {\n this.triggerHeight = this.calculateTriggerHeight();\n }\n\n this.cookieSet = this.isCookieSet();\n }\n\n // create dom element for this box\n this.element = this.dom();\n this.$element = $(this.element);\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 this.$element.find('.boxzilla-close-icon').click(box.dismiss.bind(this));\n\n this.$element.on('click', 'a', function(e) {\n Boxzilla.trigger('box.interactions.link', [ box, e.target ] );\n });\n\n this.$element.on('submit', 'form', function(e) {\n box.setCookie();\n Boxzilla.trigger('box.interactions.form', [ box, e.target ]);\n });\n\n // attach event to all links referring #boxzilla-{box_id}\n $(document.body).on('click', 'a[href=\"#boxzilla-' + box.id + '\"]', function() {\n box.toggle();\n return false;\n });\n\n // maybe show box right away\n if( this.fits() && this.locationHashRefersBox() ) {\n $(window).load(this.show.bind(this));\n }\n\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.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 // remove <script> from box content and append them to head\n var scripts = content.querySelectorAll('script');\n if(scripts.length) {\n var script = document.createElement('script');\n for( var i=0; i<scripts.length; i++ ) {\n script.appendChild(document.createTextNode(scripts[i].text));\n scripts[i].parentNode.removeChild(scripts[i]);\n }\n document.head.appendChild(script);\n }\n\n if( this.config.closable && this.config.icon ) {\n var icon = document.createElement('span');\n icon.className = \"boxzilla-close-icon\";\n icon.innerHTML = this.config.icon;\n box.appendChild(icon);\n }\n\n document.body.appendChild(wrapper);\n\n return 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 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.outerHeight();\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};\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 // do nothing if element is being animated\n if( this.$element.is(':animated') ) {\n return false;\n }\n\n // is box already at desired visibility?\n if( show === this.visible ) {\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 custom styling for which CSS is \"too stupid\"\n this.setCustomBoxStyling();\n\n // fadein / fadeout the overlay if position is \"center\"\n if( this.config.position === 'center' ) {\n $(this.overlay).fadeToggle('slow');\n }\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.animation === 'fade' ) {\n this.$element.fadeToggle( 'slow' );\n } else {\n this.$element.slideToggle( 'slow' );\n }\n\n // // focus on first input field in box\n // this.$element.find('input').first().focus();\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.method === 'element' ) {\n var $triggerElement = $(this.config.trigger.value).first();\n triggerHeight = ( $triggerElement.length > 0 ) ? $triggerElement.offset().top : 0;\n } else if( this.config.trigger.method === 'percentage' ) {\n triggerHeight = ( this.config.trigger.value / 100 * $(document).height() );\n }\n\n return triggerHeight;\n};\n\n// set cookie that disables automatically showing the box\nBox.prototype.setCookie = function() {\n // do nothing if cookieTime evaluates to false\n if(! this.config.cookieTime) {\n return;\n }\n\n var expiryDate = new Date();\n expiryDate.setDate( expiryDate.getDate() + this.config.cookieTime );\n document.cookie = 'boxzilla_box_'+ this.id + '=true; expires='+ expiryDate.toUTCString() +'; path=/';\n};\n\n// checks whether window.location.hash equals the box element ID or that of any element inside the box\nBox.prototype.locationHashRefersBox = function() {\n\n if( ! window.location.hash || 0 === window.location.hash.length ) {\n return false;\n }\n\n var elementId = window.location.hash.substring(1);\n if( elementId === this.element.id ) {\n return true;\n } else if( this.element.querySelector('#' + elementId) ) {\n return true;\n }\n\n return false;\n};\n\nBox.prototype.fits = function() {\n if( this.config.minimumScreenWidth <= 0 ) {\n return true;\n }\n\n return window.innerWidth > this.config.minimumScreenWidth\n};\n\n// is this box enabled?\nBox.prototype.mayAutoShow = function() {\n\n // don't show if box was closed (dismissed) before\n if( this.closed ) {\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\n if( this.config.testMode ) {\n return false;\n }\n\n // check for cookie\n if( ! this.config.cookieTime ) {\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\nBox.prototype.trigger = function() {\n var shown = this.show();\n if( shown ) {\n this.triggered = true;\n }\n};\n\nBox.prototype.dismiss = function() {\n this.hide();\n this.setCookie();\n this.closed = true;\n Boxzilla.trigger('box.dismiss', [ this ]);\n};\n\nmodule.exports = function(_Boxzilla) {\n Boxzilla = _Boxzilla;\n return Box;\n};\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery,\n EventEmitter = require('wolfy87-eventemitter'),\n Boxzilla = Object.create(EventEmitter.prototype),\n Box = require('./Box.js')(Boxzilla),\n Timer = require('./Timer.js'),\n boxes = {},\n windowHeight = window.innerHeight,\n overlay = document.createElement('div'),\n exitIntentDelayTimer,\n exitIntentTriggered,\n siteTimer = new Timer(sessionStorage.getItem('boxzilla_timer') || 0),\n pageTimer = new Timer(0),\n pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;\n\nfunction each( obj, callback ) {\n for( var key in obj ) {\n if(! obj.hasOwnProperty(key)) continue;\n callback(obj[key]);\n }\n}\n\nfunction throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n var last,\n 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 each(boxes, 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 each(boxes, 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 var scrollY = window.scrollY;\n var scrollHeight = scrollY + ( windowHeight * 0.9 );\n\n each(boxes, function(box) {\n if( ! box.mayAutoShow() || box.triggerHeight <= 0 ) {\n return;\n }\n\n if( scrollHeight > box.triggerHeight ) {\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 windowHeight = window.innerHeight;\n\n each(boxes, function(box) {\n box.setCustomBoxStyling();\n });\n}\n\nfunction onOverlayClick(e) {\n var x = e.offsetX;\n var y = e.offsetY;\n\n // calculate if click was near a box to avoid closing it (click error margin)\n each(boxes, function(box) {\n var rect = box.element.getBoundingClientRect();\n var margin = 100 + ( window.innerWidth * 0.05 );\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 if(exitIntentTriggered) return;\n\n each(boxes, 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 onMouseEnter() {\n if( exitIntentDelayTimer ) {\n window.clearInterval(exitIntentDelayTimer);\n exitIntentDelayTimer = null;\n }\n}\n\nvar timers = {\n start: function() {\n var sessionTime = sessionStorage.getItem('boxzilla_timer');\n if( sessionTime ) siteTimer.time = sessionTime;\n siteTimer.start();\n pageTimer.start();\n },\n stop: function() {\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 var html = document.documentElement;\n\n // add overlay element to dom\n overlay.id = 'boxzilla-overlay';\n document.body.appendChild(overlay);\n\n // event binds\n $(window).on('scroll', throttle(checkHeightCriteria));\n $(window).on('resize', throttle(recalculateHeights));\n $(window).on('load', recalculateHeights );\n $(html).on('mouseleave', onMouseLeave);\n $(html).on('mouseenter', onMouseEnter);\n $(html).on('keyup', onKeyUp);\n $(overlay).click(onOverlayClick);\n window.setInterval(checkTimeCriteria, 1000);\n window.setTimeout(checkPageViewsCriteria, 1000 );\n\n timers.start();\n $(window).on('focus', timers.start);\n $(window).on('beforeunload', function() {\n timers.stop();\n sessionStorage.setItem('boxzilla_pageviews', ++pageViews);\n });\n $(window).on('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 boxes[id] = new Box(id, opts);\n return boxes[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 each(boxes, function(box) { box.dismiss(); });\n } else if( typeof( boxes[id] ) === \"object\" ) {\n boxes[id].dismiss();\n }\n};\n\nBoxzilla.hide = function(id) {\n if( typeof(id) === \"undefined\" ) {\n each(boxes, function(box) { box.hide(); });\n } else if( typeof( boxes[id] ) === \"object\" ) {\n boxes[id].hide();\n }\n};\n\nBoxzilla.show = function(id) {\n if( typeof(id) === \"undefined\" ) {\n each(boxes, function(box) { box.show(); });\n } else if( typeof( boxes[id] ) === \"object\" ) {\n boxes[id].show();\n }\n};\n\nBoxzilla.toggle = function(id) {\n if( typeof(id) === \"undefined\" ) {\n each(boxes, function(box) { box.toggle(); });\n } else if( typeof( boxes[id] ) === \"object\" ) {\n boxes[id].toggle();\n }\n};\n\nif ( typeof module !== 'undefined' && module.exports ) {\n module.exports = Boxzilla;\n} else {\n this.Boxzilla = Boxzilla;\n}\n},{\"./Box.js\":2,\"./Timer.js\":4,\"wolfy87-eventemitter\":5}],4:[function(require,module,exports){\n'use strict';\n\nvar Timer = function(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 window.clearInterval(this.interval);\n this.interval = 0;\n};\n\nmodule.exports = Timer;\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 })();"],"sourceRoot":"/source/"}
bootstrap.php CHANGED
@@ -10,58 +10,40 @@ $boxzilla = boxzilla();
10
  // register services
11
  $provider = new BoxzillaServiceProvider();
12
  $provider->register( $boxzilla );
 
 
13
 
14
- // load default filters
15
- require __DIR__ . '/src/default-filters.php';
16
 
17
- add_action( 'init', function() use( $boxzilla ){
18
- // Register custom post type
19
- $args = array(
20
- 'public' => false,
21
- 'labels' => array(
22
- 'name' => __( 'Boxzilla', 'boxzilla' ),
23
- 'singular_name' => __( 'Box', 'boxzilla' ),
24
- 'add_new' => __( 'Add New', 'boxzilla' ),
25
- 'add_new_item' => __( 'Add New Box', 'boxzilla' ),
26
- 'edit_item' => __( 'Edit Box', 'boxzilla' ),
27
- 'new_item' => __( 'New Box', 'boxzilla' ),
28
- 'all_items' => __( 'All Boxes', 'boxzilla' ),
29
- 'view_item' => __( 'View Box', 'boxzilla' ),
30
- 'search_items' => __( 'Search Boxes', 'boxzilla' ),
31
- 'not_found' => __( 'No Boxes found', 'boxzilla' ),
32
- 'not_found_in_trash' => __( 'No Boxes found in Trash', 'boxzilla' ),
33
- 'parent_item_colon' => '',
34
- 'menu_name' => __( 'Boxzilla', 'boxzilla' )
35
- ),
36
- 'show_ui' => true,
37
- 'menu_position' => '108.1337133',
38
- 'menu_icon' => $boxzilla->plugin->url( '/assets/img/menu-icon.png' ),
39
- 'query_var' => false
40
- );
41
 
42
- register_post_type( 'boxzilla-box', $args );
43
- });
44
 
45
- if( ! is_admin() ) {
 
46
 
47
- // PUBLIC
48
- add_action( 'template_redirect', function() use( $boxzilla ) {
49
- $boxzilla['box_loader']->init();
 
50
  });
51
 
52
- } else {
53
-
54
- // ADMIN (and AJAX)
55
- $provider = new Licensing\LicenseServiceProvider();
56
- $provider->register( $boxzilla );
57
 
58
- if( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
59
- add_action('init', function() use( $boxzilla ) {
60
- $boxzilla['admin']->init();
61
  });
62
- } else {
63
- $boxzilla['filter.autocomplete']->add_hooks();
64
- }
65
-
66
- }
67
 
 
 
10
  // register services
11
  $provider = new BoxzillaServiceProvider();
12
  $provider->register( $boxzilla );
13
+ $provider = new Licensing\LicenseServiceProvider();
14
+ $provider->register( $boxzilla );
15
 
16
+ // Rest of bootstrapping runs at plugins_loaded:90
17
+ add_action( 'plugins_loaded', function() use( $boxzilla ) {
18
 
19
+ // load default filters
20
+ require __DIR__ . '/src/default-filters.php';
21
+ require __DIR__ . '/src/default-actions.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
+ $bootstrapper = $boxzilla->bootstrapper;
 
24
 
25
+ $bootstrapper->admin(function() use( $boxzilla ){
26
+ $boxzilla['admin']->init();
27
 
28
+ if( count( $boxzilla->plugins ) > 0 ) {
29
+ $boxzilla['license_manager']->hook();
30
+ $boxzilla['update_manager']->hook();
31
+ }
32
  });
33
 
34
+ $bootstrapper->ajax(function() use( $boxzilla ) {
35
+ $boxzilla['filter.autocomplete']->add_hooks();
36
+ });
 
 
37
 
38
+ $bootstrapper->front(function() use( $boxzilla ) {
39
+ add_action( 'template_redirect', function() use( $boxzilla ) {
40
+ $boxzilla['box_loader']->init();
41
  });
42
+ });
43
+
44
+ $bootstrapper->cron(function() use( $boxzilla ) {
45
+ $boxzilla['license_poller']->hook();
46
+ });
47
 
48
+ $bootstrapper->run();
49
+ }, 90 );
boxzilla.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Boxzilla
4
- Version: 3.0
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
@@ -48,7 +48,7 @@ function __load_boxzilla() {
48
  }
49
 
50
  define( 'BOXZILLA_FILE', __FILE__ );
51
- define( 'BOXZILLA_VERSION', '3.0' );
52
 
53
  require __DIR__ . '/bootstrap.php';
54
  }
1
  <?php
2
  /*
3
  Plugin Name: Boxzilla
4
+ Version: 3.0.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
48
  }
49
 
50
  define( 'BOXZILLA_FILE', __FILE__ );
51
+ define( 'BOXZILLA_VERSION', '3.0.1' );
52
 
53
  require __DIR__ . '/bootstrap.php';
54
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=bo
4
  Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media,mc4wp
5
  Requires at least: 3.8
6
  Tested up to: 4.5.2
7
- Stable tag: 3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -149,6 +149,21 @@ Have a look at the [frequently asked questions](https://wordpress.org/plugins/bo
149
  == Changelog ==
150
 
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  #### 3.0 - May 11, 2016
153
 
154
  Initial release of [Boxzilla](https://boxzillaplugin.com/), formerly known as [Scroll Triggered Boxes](https://wordpress.org/plugins/scroll-triggered-boxes/).
4
  Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media,mc4wp
5
  Requires at least: 3.8
6
  Tested up to: 4.5.2
7
+ Stable tag: 3.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
149
  == Changelog ==
150
 
151
 
152
+ #### 3.0.1 - May 23, 2016
153
+
154
+ **Improvements**
155
+
156
+ - You can now use `<script>` tags directly in box content (again).
157
+
158
+ **Additions**
159
+
160
+ - Add "post tag is / is not" loading condition.
161
+ - Plugin will now show a notice to deactivate old Scroll Triggered Boxes plugin.
162
+ - Internal changes to dependency container for use in add-on plugins.
163
+ - Add-on: [Boxzilla Pageviews Trigger](https://boxzillaplugin.com/add-ons/pageviews/).
164
+ - Add-on: [Boxzilla WooCommerce](https://boxzillaplugin.com/add-ons/woocommerce/)
165
+
166
+
167
  #### 3.0 - May 11, 2016
168
 
169
  Initial release of [Boxzilla](https://boxzillaplugin.com/), formerly known as [Scroll Triggered Boxes](https://wordpress.org/plugins/scroll-triggered-boxes/).
src/admin/class-admin.php CHANGED
@@ -45,21 +45,34 @@ class Admin {
45
  * Add necessary hooks
46
  */
47
  protected function add_hooks() {
48
-
49
  add_action( 'admin_init', array( $this, 'lazy_add_hooks' ) );
50
  add_action( 'admin_init', array( $this, 'register' ) );
51
  add_action( 'admin_menu', array( $this, 'menu' ) );
52
-
53
  add_action( 'save_post_boxzilla-box', array( $this, 'save_box_options' ), 20, 2 );
54
  add_action( 'trashed_post', array( $this, 'flush_rules' ) );
55
  add_action( 'untrashed_post', array( $this, 'flush_rules' ) );
 
 
 
 
 
 
 
 
56
 
57
- // if a premium add-on is installed, instantiate dependencies
58
- if ( count( $this->boxzilla['plugins'] ) > 0 ) {
59
- $this->boxzilla['license_manager']->add_hooks();
60
- $this->boxzilla['update_manager']->add_hooks();
61
- $this->boxzilla['api_authenticator']->add_hooks();
 
 
 
 
 
62
  }
 
63
  }
64
 
65
  /**
@@ -635,7 +648,7 @@ class Admin {
635
 
636
  // add box rules to all rules
637
  $rules[ $box->ID ] = $box_meta['rules'];
638
- $rules[ $box->ID ]['comparision'] = $box_meta['rules_comparision'];
639
 
640
  }
641
 
45
  * Add necessary hooks
46
  */
47
  protected function add_hooks() {
 
48
  add_action( 'admin_init', array( $this, 'lazy_add_hooks' ) );
49
  add_action( 'admin_init', array( $this, 'register' ) );
50
  add_action( 'admin_menu', array( $this, 'menu' ) );
51
+ add_action( 'admin_notices', array( $this, 'notices' ) );
52
  add_action( 'save_post_boxzilla-box', array( $this, 'save_box_options' ), 20, 2 );
53
  add_action( 'trashed_post', array( $this, 'flush_rules' ) );
54
  add_action( 'untrashed_post', array( $this, 'flush_rules' ) );
55
+ }
56
+
57
+ /**
58
+ * All logic for admin notices lives here.
59
+ */
60
+ public function notices() {
61
+ global $pagenow,
62
+ $current_screen;
63
 
64
+ if( ( $pagenow === 'plugins.php' || ( $current_screen && $current_screen->post_type === 'boxzilla-box' ) )
65
+ && current_user_can( 'install_plugins' )
66
+ && is_plugin_active( 'scroll-triggered-boxes/index.php' ) ) {
67
+
68
+ $url = wp_nonce_url( 'plugins.php?action=deactivate&plugin=scroll-triggered-boxes/index.php', 'deactivate-plugin_' . 'scroll-triggered-boxes/index.php' );
69
+ ?>
70
+ <div class="notice notice-info">
71
+ <p><?php printf( __( 'Awesome, you are using Boxzilla! You can now safely <a href="%s">deactivate the Scroll Triggered Boxes plugin</a>.', 'boxzilla' ), $url ); ?></p>
72
+ </div>
73
+ <?php
74
  }
75
+
76
  }
77
 
78
  /**
648
 
649
  // add box rules to all rules
650
  $rules[ $box->ID ] = $box_meta['rules'];
651
+ $rules[ $box->ID ]['comparision'] = isset( $box_meta['rules_comparision'] ) ? $box_meta['rules_comparision'] : 'any';
652
 
653
  }
654
 
src/admin/class-autocomplete.php CHANGED
@@ -13,7 +13,7 @@ class Autocomplete {
13
  */
14
  public function ajax() {
15
  $q = ( isset( $_GET['q'] ) ) ? sanitize_text_field( $_GET['q'] ) : '';
16
- $type = ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'page', 'post', 'category', 'post_type' ) ) ) ? $_GET['type'] : 'post';
17
 
18
  // do nothing if supplied 'q' parameter is omitted or empty
19
  // or less than 2 characters long
@@ -36,6 +36,10 @@ class Autocomplete {
36
  case 'post_type':
37
  echo $this->list_post_types( $q );
38
  break;
 
 
 
 
39
  }
40
 
41
  die();
@@ -60,10 +64,21 @@ class Autocomplete {
60
  * @return string
61
  */
62
  protected function list_categories( $query ) {
63
- $categories = get_terms( 'category', array( 'name__like' => $query, 'fields' => 'names', 'hide_empty' => false ) );
64
- return join( $categories, PHP_EOL );
 
 
 
 
 
 
 
 
 
 
65
  }
66
 
 
67
  /**
68
  * @param string $query
69
  *
13
  */
14
  public function ajax() {
15
  $q = ( isset( $_GET['q'] ) ) ? sanitize_text_field( $_GET['q'] ) : '';
16
+ $type = ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'page', 'post', 'category', 'post_type', 'post_tag' ) ) ) ? $_GET['type'] : 'post';
17
 
18
  // do nothing if supplied 'q' parameter is omitted or empty
19
  // or less than 2 characters long
36
  case 'post_type':
37
  echo $this->list_post_types( $q );
38
  break;
39
+
40
+ case 'post_tag':
41
+ echo $this->list_tags( $q );
42
+ break;
43
  }
44
 
45
  die();
64
  * @return string
65
  */
66
  protected function list_categories( $query ) {
67
+ $terms = get_terms( 'category', array( 'name__like' => $query, 'fields' => 'names', 'hide_empty' => false ) );
68
+ return join( $terms, PHP_EOL );
69
+ }
70
+
71
+ /**
72
+ * @param string $query
73
+ *
74
+ * @return string
75
+ */
76
+ protected function list_tags( $query ) {
77
+ $terms = get_terms( 'post_tag', array( 'name__like' => $query, 'fields' => 'names', 'hide_empty' => false ) );
78
+ return join( $terms, PHP_EOL );
79
  }
80
 
81
+
82
  /**
83
  * @param string $query
84
  *
src/admin/views/metaboxes/box-option-controls.php CHANGED
@@ -12,12 +12,18 @@ $rule_options = array(
12
  'everywhere' => __( 'everywhere', 'boxzilla' ),
13
  'is_page' => __( 'if page', 'boxzilla' ),
14
  'is_single' => __( 'if post', 'boxzilla' ),
 
15
  'is_post_in_category' => __( 'if post category', 'boxzilla' ),
16
  'is_post_type' => __( 'if post type', 'boxzilla' ),
17
  'is_url' => __( 'if URL', 'boxzilla' ),
18
  'is_referer' => __( 'if referer', 'boxzilla' ),
19
  );
20
 
 
 
 
 
 
21
  $box_positions = array(
22
  'bottom-left' => __( 'Bottom Left', 'boxzilla' ),
23
  'bottom-right' => __( 'Bottom Right', 'boxzilla' ),
@@ -29,6 +35,10 @@ $box_positions = array(
29
  ?>
30
  <table class="form-table">
31
  <?php
 
 
 
 
32
  do_action( 'boxzilla_before_box_option_controls', $box, $opts );
33
 
34
  ?>
@@ -135,7 +145,12 @@ $box_positions = array(
135
  <p class="help"><?php _e( 'If test mode is enabled, all boxes will show up regardless of whether a cookie has been set.', 'boxzilla' ); ?></p>
136
  </td>
137
  </tr>
138
- <?php do_action( 'boxzilla_after_box_option_controls', $box, $opts ); ?>
 
 
 
 
 
139
  </tbody>
140
  </table>
141
 
@@ -152,8 +167,8 @@ $box_positions = array(
152
  } ?>
153
  </select>
154
  <select class="boxzilla-rule-qualifier" name="boxzilla_box[rules][{{{data.key}}}][qualifier]" style="display: none;" >
155
- <option><?php _e( 'is', 'boxzilla' ); ?></option>
156
- <option><?php _e( 'is not', 'boxzilla' ); ?></option>
157
  </select>
158
 
159
  <input class="boxzilla-rule-value regular-text" name="boxzilla_box[rules][{{{data.key}}}][value]" type="text" value="" placeholder="<?php _e( 'Leave empty for any or enter (comma-separated) names or ID\'s', 'boxzilla' ); ?>" style="display: none;" />
12
  'everywhere' => __( 'everywhere', 'boxzilla' ),
13
  'is_page' => __( 'if page', 'boxzilla' ),
14
  'is_single' => __( 'if post', 'boxzilla' ),
15
+ 'is_post_with_tag' => __( 'if post tag', 'boxzilla' ),
16
  'is_post_in_category' => __( 'if post category', 'boxzilla' ),
17
  'is_post_type' => __( 'if post type', 'boxzilla' ),
18
  'is_url' => __( 'if URL', 'boxzilla' ),
19
  'is_referer' => __( 'if referer', 'boxzilla' ),
20
  );
21
 
22
+ /**
23
+ * @ignore
24
+ */
25
+ $rule_options = apply_filters( 'boxzilla_rules_options', $rule_options );
26
+
27
  $box_positions = array(
28
  'bottom-left' => __( 'Bottom Left', 'boxzilla' ),
29
  'bottom-right' => __( 'Bottom Right', 'boxzilla' ),
35
  ?>
36
  <table class="form-table">
37
  <?php
38
+
39
+ /**
40
+ * @ignore
41
+ */
42
  do_action( 'boxzilla_before_box_option_controls', $box, $opts );
43
 
44
  ?>
145
  <p class="help"><?php _e( 'If test mode is enabled, all boxes will show up regardless of whether a cookie has been set.', 'boxzilla' ); ?></p>
146
  </td>
147
  </tr>
148
+ <?php
149
+
150
+ /**
151
+ * @ignore
152
+ */
153
+ do_action( 'boxzilla_after_box_option_controls', $box, $opts ); ?>
154
  </tbody>
155
  </table>
156
 
167
  } ?>
168
  </select>
169
  <select class="boxzilla-rule-qualifier" name="boxzilla_box[rules][{{{data.key}}}][qualifier]" style="display: none;" >
170
+ <option value="1" selected><?php _e( 'is', 'boxzilla' ); ?></option>
171
+ <option value="0"><?php _e( 'is not', 'boxzilla' ); ?></option>
172
  </select>
173
 
174
  <input class="boxzilla-rule-value regular-text" name="boxzilla_box[rules][{{{data.key}}}][value]" type="text" value="" placeholder="<?php _e( 'Leave empty for any or enter (comma-separated) names or ID\'s', 'boxzilla' ); ?>" style="display: none;" />
src/class-bootstrapper.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla;
4
+
5
+ use InvalidArgumentException;
6
+
7
+ /**
8
+ * Class Bootstrapper
9
+ * @package Boxzilla
10
+ *
11
+ * @method void admin( callable $callback )
12
+ * @method void cron( callable $callback )
13
+ * @method void front( callable $callback )
14
+ * @method void ajax( callable $callback )
15
+ * @method void cli( callable $callback )
16
+ */
17
+ class Bootstrapper {
18
+
19
+ /**
20
+ * @var array
21
+ */
22
+ private $bootstrappers = array(
23
+ 'admin' => array(),
24
+ 'ajax' => array(),
25
+ 'cli' => array(),
26
+ 'cron' => array(),
27
+ 'front' => array(),
28
+ 'global' => array(),
29
+ );
30
+
31
+ /**
32
+ * @param string $section
33
+ * @param callable $callable
34
+ */
35
+ public function register( $section, $callable ) {
36
+
37
+ if( ! isset( $this->bootstrappers[ $section ] ) ) {
38
+ throw new InvalidArgumentException( "Section $section is invalid." );
39
+ }
40
+
41
+ if( ! is_callable( $callable ) ) {
42
+ throw new InvalidArgumentException( 'Callable argument is not callable.' );
43
+ }
44
+
45
+ $this->bootstrappers[ $section ][] = $callable;
46
+ }
47
+
48
+ /**
49
+ * @param string $name
50
+ * @param array $arguments
51
+ */
52
+ public function __call( $name, $arguments ) {
53
+ if( isset( $this->bootstrappers[ $name ] ) ) {
54
+ $this->register( $name, $arguments[0] );
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Run registered bootstrappers
60
+ *
61
+ * @param string $section
62
+ */
63
+ public function run( $section = '' ) {
64
+
65
+ if( ! $section ) {
66
+ $section = $this->section();
67
+ }
68
+
69
+ foreach( $this->bootstrappers['global'] as $callback ) {
70
+ $callback();
71
+ }
72
+
73
+ foreach( $this->bootstrappers[ $section ] as $callback ) {
74
+ $callback();
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Get currently active section.
80
+ *
81
+ * @return string
82
+ */
83
+ public function section() {
84
+ if( is_admin() ) {
85
+ if( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
86
+ return 'ajax';
87
+ } else {
88
+ return 'admin';
89
+ }
90
+ } else {
91
+ if( defined( 'DOING_CRON' ) && DOING_CRON ) {
92
+ return 'cron';
93
+ } else if( defined( 'WP_CLI' ) && WP_CLI ) {
94
+ return 'cli';
95
+ } else {
96
+ return 'front';
97
+ }
98
+ }
99
+ }
100
+
101
+ }
src/class-boxzilla-service-provider.php CHANGED
@@ -19,13 +19,23 @@ class BoxzillaServiceProvider implements ServiceProviderInterface {
19
  */
20
  public function register( Container $container ) {
21
 
22
- $container['plugin'] = new Plugin(
23
- 0,
24
- 'Boxzilla',
25
- BOXZILLA_VERSION,
26
- BOXZILLA_FILE,
27
- dirname( BOXZILLA_FILE )
28
- );
 
 
 
 
 
 
 
 
 
 
29
 
30
  $container['options'] = function( $container ) {
31
  $defaults = array(
@@ -37,25 +47,23 @@ class BoxzillaServiceProvider implements ServiceProviderInterface {
37
  return $options;
38
  };
39
 
 
 
 
 
 
 
 
 
40
  $container['plugins'] = function( $container ) {
41
  $plugins = (array) apply_filters( 'boxzilla_extensions', array() );
42
  return new Collection( $plugins );
43
  };
44
 
45
- $container['box_loader'] = function( $container ) {
46
- return new BoxLoader( $container->plugin, $container->options );
47
- };
48
 
49
- $container['admin'] = function( $container ) {
50
- return new Admin( $container->plugin, $container );
51
- };
52
 
53
- $container['filter.autocomplete'] = function( $container ) {
54
- return new Filter\Autocomplete();
55
- };
56
 
57
- $container['notices'] = function( $container ) {
58
- return new Notices();
59
- };
60
  }
61
  }
19
  */
20
  public function register( Container $container ) {
21
 
22
+ $container['admin'] = function( $container ) {
23
+ return new Admin( $container->plugin, $container );
24
+ };
25
+
26
+ $container['bootstrapper'] = new Bootstrapper();
27
+
28
+ $container['box_loader'] = function( $container ) {
29
+ return new BoxLoader( $container->plugin, $container->options );
30
+ };
31
+
32
+ $container['filter.autocomplete'] = function( $container ) {
33
+ return new Filter\Autocomplete();
34
+ };
35
+
36
+ $container['notices'] = function( $container ) {
37
+ return new Notices();
38
+ };
39
 
40
  $container['options'] = function( $container ) {
41
  $defaults = array(
47
  return $options;
48
  };
49
 
50
+ $container['plugin'] = new Plugin(
51
+ 'boxzilla',
52
+ 'Boxzilla',
53
+ BOXZILLA_VERSION,
54
+ BOXZILLA_FILE,
55
+ dirname( BOXZILLA_FILE )
56
+ );
57
+
58
  $container['plugins'] = function( $container ) {
59
  $plugins = (array) apply_filters( 'boxzilla_extensions', array() );
60
  return new Collection( $plugins );
61
  };
62
 
 
 
 
63
 
 
 
 
64
 
 
 
 
65
 
66
+
67
+
 
68
  }
69
  }
src/class-boxzilla.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace Boxzilla;
4
 
5
  use Boxzilla\DI\ContainerWithPropertyAccess;
 
6
 
7
  /**
8
  * Class Boxzilla
@@ -12,5 +13,8 @@ use Boxzilla\DI\ContainerWithPropertyAccess;
12
  * @property array $options
13
  * @property Plugin $plugin
14
  * @property Plugin[] $plugins
 
 
 
15
  */
16
  class Boxzilla extends ContainerWithPropertyAccess {}
3
  namespace Boxzilla;
4
 
5
  use Boxzilla\DI\ContainerWithPropertyAccess;
6
+ use Boxzilla\Licensing\License;
7
 
8
  /**
9
  * Class Boxzilla
13
  * @property array $options
14
  * @property Plugin $plugin
15
  * @property Plugin[] $plugins
16
+ * @property License $license
17
+ * @property Bootstrapper $bootstrapper
18
+ *
19
  */
20
  class Boxzilla extends ContainerWithPropertyAccess {}
src/class-collection.php CHANGED
@@ -4,8 +4,9 @@ namespace Boxzilla;
4
 
5
  use Iterator;
6
  use Countable;
 
7
 
8
- class Collection implements Iterator, Countable {
9
 
10
  protected $elements = array();
11
  private $position = 0;
@@ -78,4 +79,76 @@ class Collection implements Iterator, Countable {
78
  public function count() {
79
  return count( $this->elements );
80
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  }
4
 
5
  use Iterator;
6
  use Countable;
7
+ use ArrayAccess;
8
 
9
+ class Collection implements Iterator, Countable, ArrayAccess {
10
 
11
  protected $elements = array();
12
  private $position = 0;
79
  public function count() {
80
  return count( $this->elements );
81
  }
82
+
83
+ /**
84
+ * Whether a offset exists
85
+ * @link http://php.net/manual/en/arrayaccess.offsetexists.php
86
+ * @param mixed $offset <p>
87
+ * An offset to check for.
88
+ * </p>
89
+ * @return boolean true on success or false on failure.
90
+ * </p>
91
+ * <p>
92
+ * The return value will be casted to boolean if non-boolean was returned.
93
+ * @since 5.0.0
94
+ */
95
+ public function offsetExists($offset)
96
+ {
97
+ return isset( $this->elements[ $offset ] );
98
+ }
99
+
100
+ /**
101
+ * Offset to retrieve
102
+ * @link http://php.net/manual/en/arrayaccess.offsetget.php
103
+ * @param mixed $offset <p>
104
+ * The offset to retrieve.
105
+ * </p>
106
+ * @return mixed Can return all value types.
107
+ * @since 5.0.0
108
+ */
109
+ public function offsetGet($offset)
110
+ {
111
+ return $this->elements[ $offset ];
112
+ }
113
+
114
+ /**
115
+ * Offset to set
116
+ * @link http://php.net/manual/en/arrayaccess.offsetset.php
117
+ * @param mixed $offset <p>
118
+ * The offset to assign the value to.
119
+ * </p>
120
+ * @param mixed $value <p>
121
+ * The value to set.
122
+ * </p>
123
+ * @return void
124
+ * @since 5.0.0
125
+ */
126
+ public function offsetSet($offset, $value)
127
+ {
128
+ $this->elements[ $offset ] = $value;
129
+ }
130
+
131
+ /**
132
+ * Offset to unset
133
+ * @link http://php.net/manual/en/arrayaccess.offsetunset.php
134
+ * @param mixed $offset <p>
135
+ * The offset to unset.
136
+ * </p>
137
+ * @return void
138
+ * @since 5.0.0
139
+ */
140
+ public function offsetUnset($offset)
141
+ {
142
+ unset( $this->elements[ $offset] );
143
+ }
144
+
145
+ /**
146
+ * Return a random value out of the collection.
147
+ *
148
+ * @return mixed
149
+ */
150
+ public function random() {
151
+ $key = array_rand( $this->elements );
152
+ return $this->elements[ $key ];
153
+ }
154
  }
src/class-loader.php CHANGED
@@ -139,8 +139,21 @@ class BoxLoader {
139
  $matched = is_page( $value );
140
  break;
141
 
 
 
 
142
  }
143
 
 
 
 
 
 
 
 
 
 
 
144
  // if qualifier is set to false, we need to reverse this value here.
145
  if( ! $qualifier ) {
146
  $matched = ! $matched;
139
  $matched = is_page( $value );
140
  break;
141
 
142
+ case 'is_post_with_tag':
143
+ $matched = is_singular( 'post' ) && has_tag( $value );
144
+ break;
145
  }
146
 
147
+ /**
148
+ * Filters whether a given box rule matches the condition and expected value.
149
+ *
150
+ * The dynamic portion of the hook, `$condition`, refers to the condition being matched.
151
+ *
152
+ * @param boolean $matched
153
+ * @param array $value
154
+ */
155
+ $matched = apply_filters( 'boxzilla_box_rule_matches_' . $condition, $matched, $value );
156
+
157
  // if qualifier is set to false, we need to reverse this value here.
158
  if( ! $qualifier ) {
159
  $matched = ! $matched;
src/default-actions.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or exit;
4
+
5
+ $boxzilla = boxzilla();
6
+
7
+ // Register custom post type
8
+ add_action( 'init', function() use( $boxzilla ){
9
+ $args = array(
10
+ 'public' => false,
11
+ 'labels' => array(
12
+ 'name' => __( 'Boxzilla', 'boxzilla' ),
13
+ 'singular_name' => __( 'Box', 'boxzilla' ),
14
+ 'add_new' => __( 'Add New', 'boxzilla' ),
15
+ 'add_new_item' => __( 'Add New Box', 'boxzilla' ),
16
+ 'edit_item' => __( 'Edit Box', 'boxzilla' ),
17
+ 'new_item' => __( 'New Box', 'boxzilla' ),
18
+ 'all_items' => __( 'All Boxes', 'boxzilla' ),
19
+ 'view_item' => __( 'View Box', 'boxzilla' ),
20
+ 'search_items' => __( 'Search Boxes', 'boxzilla' ),
21
+ 'not_found' => __( 'No Boxes found', 'boxzilla' ),
22
+ 'not_found_in_trash' => __( 'No Boxes found in Trash', 'boxzilla' ),
23
+ 'parent_item_colon' => '',
24
+ 'menu_name' => __( 'Boxzilla', 'boxzilla' )
25
+ ),
26
+ 'show_ui' => true,
27
+ 'menu_position' => '108.1337133',
28
+ 'menu_icon' => $boxzilla->plugin->url( '/assets/img/menu-icon.png' ),
29
+ 'query_var' => false
30
+ );
31
+
32
+ register_post_type( 'boxzilla-box', $args );
33
+ });
src/di/class-container-with-property-access.php CHANGED
@@ -2,6 +2,13 @@
2
 
3
  namespace Boxzilla\DI;
4
 
 
 
 
 
 
 
 
5
  class ContainerWithPropertyAccess extends Container {
6
 
7
  /**
@@ -9,7 +16,7 @@ class ContainerWithPropertyAccess extends Container {
9
  * @return mixed
10
  */
11
  public function __get( $name ) {
12
- return $this[ $name ];
13
  }
14
 
15
  /**
@@ -20,4 +27,28 @@ class ContainerWithPropertyAccess extends Container {
20
  $this[ $name ] = $value;
21
  }
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
2
 
3
  namespace Boxzilla\DI;
4
 
5
+ /**
6
+ * Class ContainerWithPropertyAccess
7
+ *
8
+ * This modifies Pimple so it is PSR-11 compatible and can be accessed using property accessors.
9
+ *
10
+ * @package Boxzilla\DI
11
+ */
12
  class ContainerWithPropertyAccess extends Container {
13
 
14
  /**
16
  * @return mixed
17
  */
18
  public function __get( $name ) {
19
+ return $this->offsetGet( $name );
20
  }
21
 
22
  /**
27
  $this[ $name ] = $value;
28
  }
29
 
30
+ /**
31
+ * @param string $name
32
+ * @return bool
33
+ */
34
+ public function __isset( $name ) {
35
+ return $this->offsetExists( $name );
36
+ }
37
+
38
+ /**
39
+ * @param string $name
40
+ * @return bool
41
+ */
42
+ public function has( $name ) {
43
+ return $this->offsetExists( $name );
44
+ }
45
+
46
+ /**
47
+ * @param string $name
48
+ * @return mixed
49
+ */
50
+ public function get( $name ) {
51
+ return $this->offsetGet( $name );
52
+ }
53
+
54
  }
src/functions.php CHANGED
@@ -14,3 +14,4 @@ function boxzilla() {
14
 
15
  return $instance;
16
  }
 
14
 
15
  return $instance;
16
  }
17
+
src/licensing/class-api-exception.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Boxzilla\Licensing;
4
+
5
+ use Exception;
6
+
7
+ class API_Exception extends Exception {
8
+
9
+ /**
10
+ * @var string
11
+ */
12
+ protected $apiCode;
13
+
14
+ /**
15
+ * API_Exception constructor.
16
+ *
17
+ * @param string $message
18
+ * @param string $apiCode (optional)
19
+ */
20
+ public function __construct( $message, $apiCode = '' ) {
21
+ parent::__construct( $message );
22
+
23
+ $this->apiCode = $apiCode;
24
+ }
25
+
26
+ /**
27
+ * @return string
28
+ */
29
+ public function getApiCode() {
30
+ return $this->apiCode;
31
+ }
32
+
33
+ }
src/licensing/class-api.php CHANGED
@@ -2,8 +2,8 @@
2
 
3
  namespace Boxzilla\Licensing;
4
 
5
- use Boxzilla\Admin\Notices;
6
  use Boxzilla\Plugin;
 
7
  use WP_Error;
8
 
9
  class API {
@@ -14,14 +14,11 @@ class API {
14
  protected $license;
15
 
16
  /**
17
- * @var Notices
18
- */
19
- protected $notices;
20
-
21
- /**
22
  * @var string
23
  */
24
- protected $api_url = '';
25
 
26
  /**
27
  * @var int
@@ -39,53 +36,49 @@ class API {
39
  protected $last_response;
40
 
41
  /**
42
- * @param string $api_url
43
- * @param Notices $notices
44
  */
45
- public function __construct( $api_url, Notices $notices ) {
46
- $this->api_url = $api_url;
47
- $this->notices = $notices;
48
  }
49
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  /**
51
  * Logs the current site in to the remote API
52
  *
53
- * @param License $license
54
- * @return bool
55
  */
56
- public function create_license_activation( License $license ) {
57
  $endpoint = '/license/activations';
58
- $data = array(
59
- 'site_url' => $license->site
60
  );
61
- $result = $this->request( 'POST', $endpoint, $data );
62
- if( $result ) {
63
- $this->notices->add( $result->message, 'info' );
64
- return true;
65
- }
66
-
67
- return false;
68
  }
69
 
70
  /**
71
  * Logs the current site out of the remote API
72
  *
73
- * @param License $license
74
- * @return bool
75
  */
76
- public function delete_license_activation( License $license ) {
77
- $endpoint = '/license/activations';
78
- $data = array(
79
- 'site_url' => $license->site
80
- );
81
- $result = $this->request( 'DELETE', $endpoint, $data );
82
-
83
- if( $result ) {
84
- $this->notices->add( $result->message, 'info' );
85
- return true;
86
- }
87
-
88
- return false;
89
  }
90
 
91
  /**
@@ -94,73 +87,88 @@ class API {
94
  */
95
  public function get_plugin( Plugin $plugin ) {
96
  $endpoint = sprintf( '/plugins/%s?format=wp', $plugin->id() );
97
- return $this->request( 'GET', $endpoint );
 
98
  }
99
 
100
  /**
101
- * @param Plugin[] $plugins
102
  * @return object
103
  */
104
- public function get_plugins( $plugins ) {
105
- // create array of plugin ID's
106
- $plugin_slugs = $plugins->map(function( $p ) { return $p->id(); });
107
- $endpoint = add_query_arg( array( 'sids' => implode(',', $plugin_slugs ), 'format' => 'wp' ), '/plugins' );
108
- return $this->request( 'GET', $endpoint );
 
 
 
 
 
 
 
 
 
 
109
  }
110
 
111
  /**
112
  * @param string $method
113
  * @param string $endpoint
114
  * @param array $data
115
- * @return object
 
116
  */
117
  public function request( $method, $endpoint, $data = array() ) {
118
 
119
- $url = $this->api_url . $endpoint;
120
  $args = array(
121
- 'method' => $method
 
122
  );
123
 
 
 
 
 
 
124
  if( in_array( $method, array( 'GET', 'DELETE' ) ) ) {
125
  $url = add_query_arg( $data, $url );
126
  } else {
127
  $args['body'] = $data;
128
  }
129
 
130
- $request = wp_remote_request( $url, $args );
 
 
131
 
 
 
 
 
 
 
 
 
132
  // test for wp errors
133
- if( $request instanceof WP_Error) {
134
- $this->notices->add( $request->get_error_message(), 'error' ); ;
135
- return false;
136
  }
137
 
138
  // retrieve response body
139
- $body = wp_remote_retrieve_body( $request );
140
- $response = json_decode( $body );
141
- if( ! is_object( $response ) ) {
142
- $this->notices->add( __( "The Boxzilla server returned an invalid response.", 'boxzilla' ), 'error' );
143
- return false;
144
  }
145
 
146
- // store response
147
- $this->last_response = $response;
148
-
149
  // did request return an error response?
150
- if( isset( $response->error ) ) {
151
- $this->notices->add( $response->error->message, 'error' );
152
- return null;
153
  }
154
 
155
  // return actual response data
156
- return $response->data;
157
- }
158
-
159
- /**
160
- * @return object|null
161
- */
162
- public function get_last_response() {
163
- return $this->last_response;
164
  }
165
 
166
  }
2
 
3
  namespace Boxzilla\Licensing;
4
 
 
5
  use Boxzilla\Plugin;
6
+ use Exception;
7
  use WP_Error;
8
 
9
  class API {
14
  protected $license;
15
 
16
  /**
17
+ * The API url
18
+ *
 
 
 
19
  * @var string
20
  */
21
+ public $url = '';
22
 
23
  /**
24
  * @var int
36
  protected $last_response;
37
 
38
  /**
39
+ * @param string $url
40
+ * @param License $license
41
  */
42
+ public function __construct( $url, License $license ) {
43
+ $this->url = $url;
44
+ $this->license = $license;
45
  }
46
 
47
+ /**
48
+ * Gets license status
49
+ *
50
+ * @return object
51
+ */
52
+ public function get_license() {
53
+ $endpoint = '/license';
54
+ $response = $this->request( 'GET', $endpoint );
55
+ return $response;
56
+ }
57
+
58
+
59
  /**
60
  * Logs the current site in to the remote API
61
  *
62
+ * @return object
 
63
  */
64
+ public function activate_license() {
65
  $endpoint = '/license/activations';
66
+ $args = array(
67
+ 'site_url' => get_option( 'siteurl' )
68
  );
69
+ $response = $this->request( 'POST', $endpoint, $args );
70
+ return $response;
 
 
 
 
 
71
  }
72
 
73
  /**
74
  * Logs the current site out of the remote API
75
  *
76
+ * @return object
 
77
  */
78
+ public function deactivate_license() {
79
+ $endpoint = sprintf( '/license/activations/%s', $this->license->activation_key );
80
+ $response = $this->request( 'DELETE', $endpoint );
81
+ return $response;
 
 
 
 
 
 
 
 
 
82
  }
83
 
84
  /**
87
  */
88
  public function get_plugin( Plugin $plugin ) {
89
  $endpoint = sprintf( '/plugins/%s?format=wp', $plugin->id() );
90
+ $response = $this->request( 'GET', $endpoint );
91
+ return $response;
92
  }
93
 
94
  /**
95
+ * @param Plugin[] $plugins (optional)
96
  * @return object
97
  */
98
+ public function get_plugins( $plugins = null ) {
99
+
100
+ $args = array(
101
+ 'format' => 'wp',
102
+ );
103
+
104
+ // create array of plugin sids if given
105
+ if( $plugins ) {
106
+ $plugin_slugs = $plugins->map(function( $p ) { return $p->id(); });
107
+ $args['sids'] = implode(',', $plugin_slugs );
108
+ }
109
+
110
+ $endpoint = add_query_arg( $args, '/plugins' );
111
+ $response = $this->request( 'GET', $endpoint );
112
+ return $response;
113
  }
114
 
115
  /**
116
  * @param string $method
117
  * @param string $endpoint
118
  * @param array $data
119
+ *
120
+ * @return object|array
121
  */
122
  public function request( $method, $endpoint, $data = array() ) {
123
 
124
+ $url = $this->url . $endpoint;
125
  $args = array(
126
+ 'method' => $method,
127
+ 'headers' => array(),
128
  );
129
 
130
+ // add license key to headers if set
131
+ if( ! empty( $this->license->key ) ) {
132
+ $args['headers']['Authorization'] = 'Bearer ' . urlencode( $this->license->key );
133
+ }
134
+
135
  if( in_array( $method, array( 'GET', 'DELETE' ) ) ) {
136
  $url = add_query_arg( $data, $url );
137
  } else {
138
  $args['body'] = $data;
139
  }
140
 
141
+ $response = wp_remote_request( $url, $args );
142
+ return $this->parse_response( $response );
143
+ }
144
 
145
+ /**
146
+ * @param mixed $response
147
+ *
148
+ * @return object|null
149
+ *
150
+ * @throws API_Exception
151
+ */
152
+ public function parse_response( $response ) {
153
  // test for wp errors
154
+ if( $response instanceof WP_Error) {
155
+ throw new API_Exception( $response->get_error_message() );
 
156
  }
157
 
158
  // retrieve response body
159
+ $body = wp_remote_retrieve_body( $response );
160
+ $json = json_decode( $body );
161
+ if( ! is_object( $json ) ) {
162
+ throw new API_Exception( __( "The Boxzilla server returned an invalid response.", 'boxzilla' ) );
 
163
  }
164
 
 
 
 
165
  // did request return an error response?
166
+ if( isset( $json->error ) ) {
167
+ throw new API_Exception( $json->error->message, $json->error->code );
 
168
  }
169
 
170
  // return actual response data
171
+ return $json->data;
 
 
 
 
 
 
 
172
  }
173
 
174
  }
src/licensing/class-authenticator.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
-
3
- namespace Boxzilla\Licensing;
4
-
5
- class Authenticator {
6
-
7
- /**
8
- * @var string
9
- */
10
- protected $api_url;
11
-
12
- /**
13
- * @var License
14
- */
15
- protected $license;
16
-
17
- /**
18
- * Add the necessary Auth headers to all requests to our API
19
- *
20
- * @param $api_url
21
- * @param License $license
22
- */
23
- public function __construct( $api_url, License $license ) {
24
- $this->license = $license;
25
- $this->api_url = $api_url;
26
- }
27
-
28
- /**
29
- * Initialise the awesome
30
- */
31
- public function add_hooks() {
32
- add_filter( 'http_request_args', array( $this, 'add_auth_headers' ), 10, 2 );
33
- }
34
-
35
- /**
36
- * @param $args
37
- * @param $url
38
- *
39
- * @return mixed
40
- */
41
- public function add_auth_headers( $args, $url ) {
42
-
43
- if( strpos( $url, $this->api_url ) !== 0 ) {
44
- return $args;
45
- }
46
-
47
- $this->license->load();