Boxzilla - Version 3.2.9

Version Description

Download this release

Release Info

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

Code changes from version 3.2.7 to 3.2.9

assets/browserify/admin/_designer.js CHANGED
@@ -19,7 +19,6 @@ var Designer = function($, Option, events) {
19
 
20
  // functions
21
  function init() {
22
-
23
  // Only run if TinyMCE has actually inited
24
  if( typeof( window.tinyMCE ) !== "object" || tinyMCE.get('content') === null ) {
25
  return;
@@ -57,23 +56,26 @@ var Designer = function($, Option, events) {
57
  * @return bool
58
  */
59
  function applyStyles() {
60
-
61
  if( ! visualEditorInitialised ) {
62
  return false;
63
  }
64
 
65
- // apply styles from CSS editor
66
- $innerEditor.css({
67
- 'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),
68
- 'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),
69
- 'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),
70
- 'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),
71
- 'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),
72
- 'color': options.color.getColorValue() // getColorValue( 'color', '' )
73
- });
74
-
75
- /* @since 2.0.3 */
76
- events.trigger('editor.styles.apply');
 
 
 
 
77
 
78
  return true;
79
  }
19
 
20
  // functions
21
  function init() {
 
22
  // Only run if TinyMCE has actually inited
23
  if( typeof( window.tinyMCE ) !== "object" || tinyMCE.get('content') === null ) {
24
  return;
56
  * @return bool
57
  */
58
  function applyStyles() {
 
59
  if( ! visualEditorInitialised ) {
60
  return false;
61
  }
62
 
63
+ // Apply styles from CSS editor.
64
+ // Use short timeout to make sure color values are updated.
65
+ window.setTimeout(() => {
66
+
67
+ $innerEditor.css({
68
+ 'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),
69
+ 'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),
70
+ 'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),
71
+ 'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),
72
+ 'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),
73
+ 'color': options.color.getColorValue() // getColorValue( 'color', '' )
74
+ });
75
+
76
+ /* @since 2.0.3 */
77
+ events.trigger('editor.styles.apply');
78
+ }, 10)
79
 
80
  return true;
81
  }
assets/js/admin-script.js CHANGED
@@ -1,296 +1,296 @@
1
- (function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){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}return e})()({1:[function(require,module,exports){
2
- 'use strict';
3
 
4
  window.Boxzilla_Admin = require('./admin/_admin.js');
5
 
6
  },{"./admin/_admin.js":2}],2:[function(require,module,exports){
7
- 'use strict';
8
 
9
  (function () {
10
- 'use strict';
11
 
12
- var $ = window.jQuery;
13
- var Option = require('./_option.js');
14
- var optionControls = document.getElementById('boxzilla-box-options-controls');
15
- var $optionControls = $(optionControls);
16
- var tnLoggedIn = document.createTextNode(' logged in');
17
 
18
- // sanity check, are we on the correct page?
19
- if ($optionControls.length === 0) {
20
- return;
21
- }
22
 
23
- var EventEmitter = require('wolfy87-eventemitter');
24
- var events = new EventEmitter();
25
- var Designer = require('./_designer.js')($, Option, events);
26
- var rowTemplate = wp.template('rule-row-template');
27
- var i18n = boxzilla_i18n;
28
- var ruleComparisonEl = document.getElementById('boxzilla-rule-comparison');
29
- var rulesContainerEl = document.getElementById('boxzilla-box-rules');
30
-
31
- // events
32
- $optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
33
- $optionControls.on('click', ".boxzilla-remove-rule", removeRule);
34
- $optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
35
- $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);
36
- $(ruleComparisonEl).change(toggleAndOrTexts);
37
-
38
- $(window).load(function () {
39
- if (typeof window.tinyMCE === "undefined") {
40
- document.getElementById('notice-notinymce').style.display = '';
41
- }
42
- });
43
 
44
- // call contextual helper method for each row
45
- $('.boxzilla-rule-row').each(setContextualHelpers);
 
46
 
47
- function toggleAndOrTexts() {
48
- var newText = ruleComparisonEl.value === 'any' ? i18n.or : i18n.and;
49
- $('.boxzilla-andor').text(newText);
50
- }
51
 
52
- function toggleTriggerOptions() {
53
- $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');
54
- }
55
 
56
- function removeRule() {
57
- var row = $(this).parents('tr');
58
 
59
- // delete andor row
60
- row.prev().remove();
 
 
61
 
62
- // delete rule row
63
- row.remove();
 
 
 
 
 
 
64
  }
 
65
 
66
- function setContextualHelpers() {
67
- var context = this.tagName.toLowerCase() === "tr" ? this : $(this).parents('tr').get(0);
68
- var condition = context.querySelector('.boxzilla-rule-condition').value;
69
- var valueInput = context.querySelector('.boxzilla-rule-value');
70
- var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
71
- var betterInput = valueInput.cloneNode(true);
72
- var $betterInput = $(betterInput);
73
-
74
- // remove previously added helpers
75
- $(context.querySelectorAll('.boxzilla-helper')).remove();
76
-
77
- // prepare better input
78
- betterInput.removeAttribute('name');
79
- betterInput.className = betterInput.className + ' boxzilla-helper';
80
- valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
81
- $betterInput.change(function () {
82
- valueInput.value = this.value;
83
- });
84
 
85
- betterInput.style.display = '';
86
- valueInput.style.display = 'none';
87
- qualifierInput.style.display = '';
88
- qualifierInput.querySelector('option[value="not_contains"]').style.display = 'none';
89
- qualifierInput.querySelector('option[value="contains"]').style.display = 'none';
90
- if (tnLoggedIn.parentNode) {
91
- tnLoggedIn.parentNode.removeChild(tnLoggedIn);
92
- }
93
 
94
- // change placeholder for textual help
95
- switch (condition) {
96
- default:
97
- betterInput.placeholder = i18n.enterCommaSeparatedValues;
98
- break;
99
-
100
- case '':
101
- case 'everywhere':
102
- qualifierInput.value = '1';
103
- valueInput.value = '';
104
- betterInput.style.display = 'none';
105
- qualifierInput.style.display = 'none';
106
- break;
107
-
108
- case 'is_single':
109
- case 'is_post':
110
- betterInput.placeholder = i18n.enterCommaSeparatedPosts;
111
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", {
112
- multiple: true,
113
- multipleSep: ","
114
- });
115
- break;
116
 
117
- case 'is_page':
118
- betterInput.placeholder = i18n.enterCommaSeparatedPages;
119
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {
120
- multiple: true,
121
- multipleSep: ","
122
- });
123
- break;
124
 
125
- case 'is_post_type':
126
- betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
127
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", {
128
- multiple: true,
129
- multipleSep: ","
130
- });
131
- break;
132
-
133
- case 'is_url':
134
- qualifierInput.querySelector('option[value="contains"]').style.display = '';
135
- qualifierInput.querySelector('option[value="not_contains"]').style.display = '';
136
- betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
137
- break;
138
-
139
- case 'is_post_in_category':
140
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {
141
- multiple: true,
142
- multipleSep: ","
143
- });
144
- break;
145
 
146
- case 'is_post_with_tag':
147
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {
148
- multiple: true,
149
- multipleSep: ","
150
- });
151
- break;
152
 
153
- case 'is_user_logged_in':
154
- betterInput.style.display = 'none';
155
- valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);
156
- break;
 
 
 
157
 
158
- case 'is_referer':
159
- qualifierInput.querySelector('option[value="contains"]').style.display = '';
160
- qualifierInput.querySelector('option[value="not_contains"]').style.display = '';
161
- break;
162
 
163
- }
164
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
- function addRuleFields() {
167
- var data = {
168
- 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length,
169
- 'andor': ruleComparisonEl.value === 'any' ? i18n.or : i18n.and
170
- };
171
- var html = rowTemplate(data);
172
- $(rulesContainerEl).append(html);
173
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  }
 
175
 
176
- module.exports = {
177
- 'Designer': Designer,
178
- 'Option': Option,
179
- 'events': events
180
  };
 
 
 
 
 
 
 
 
 
 
181
  })();
182
 
183
  },{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(require,module,exports){
184
- 'use strict';
185
 
186
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
187
 
188
  var Designer = function Designer($, Option, events) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
- // vars
191
- var boxId = document.getElementById('post_ID').value || 0,
192
- $editor,
193
- $editorFrame,
194
- $innerEditor,
195
- options = {},
196
- visualEditorInitialised = false;
197
-
198
- var $appearanceControls = $("#boxzilla-box-appearance-controls");
199
-
200
- // create Option objects
201
- options.borderColor = new Option('border-color');
202
- options.borderWidth = new Option('border-width');
203
- options.borderStyle = new Option('border-style');
204
- options.backgroundColor = new Option('background-color');
205
- options.width = new Option('width');
206
- options.color = new Option('color');
207
-
208
- // functions
209
- function init() {
210
-
211
- // Only run if TinyMCE has actually inited
212
- if (_typeof(window.tinyMCE) !== "object" || tinyMCE.get('content') === null) {
213
- return;
214
- }
215
-
216
- // add classes to TinyMCE <html>
217
- $editorFrame = $("#content_ifr");
218
- $editor = $editorFrame.contents().find('html');
219
- $editor.css({
220
- 'background': 'white'
221
- });
222
-
223
- // add content class and padding to TinyMCE <body>
224
- $innerEditor = $editor.find('#tinymce');
225
- $innerEditor.addClass('boxzilla boxzilla-' + boxId);
226
- $innerEditor.css({
227
- 'margin': 0,
228
- 'background': 'white',
229
- 'display': 'inline-block',
230
- 'width': 'auto',
231
- 'min-width': '240px',
232
- 'position': 'relative'
233
- });
234
- $innerEditor.get(0).style.cssText += ';padding: 25px !important;';
235
-
236
- visualEditorInitialised = true;
237
-
238
- /* @since 2.0.3 */
239
- events.trigger('editor.init');
240
- }
241
-
242
- /**
243
- * Applies the styles from the options to the TinyMCE Editor
244
- *
245
- * @return bool
246
- */
247
- function applyStyles() {
248
-
249
- if (!visualEditorInitialised) {
250
- return false;
251
- }
252
-
253
- // apply styles from CSS editor
254
- $innerEditor.css({
255
- 'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),
256
- 'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),
257
- 'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),
258
- 'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),
259
- 'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),
260
- 'color': options.color.getColorValue() // getColorValue( 'color', '' )
261
- });
262
-
263
- /* @since 2.0.3 */
264
- events.trigger('editor.styles.apply');
265
-
266
- return true;
267
- }
268
-
269
- function resetStyles() {
270
- for (var key in options) {
271
- if (key.substring(0, 5) === 'theme') {
272
- continue;
273
- }
274
-
275
- options[key].clear();
276
- }
277
- applyStyles();
278
-
279
- /* @since 2.0.3 */
280
- events.trigger('editor.styles.reset');
281
- }
282
-
283
- // event binders
284
- $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });
285
- $appearanceControls.find(":input").not(".boxzilla-color-field").change(applyStyles);
286
- events.on('editor.init', applyStyles);
287
-
288
- // public methods
289
- return {
290
- 'init': init,
291
- 'resetStyles': resetStyles,
292
- 'options': options
293
- };
294
  };
295
 
296
  module.exports = Designer;
@@ -301,61 +301,59 @@ module.exports = Designer;
301
  var $ = window.jQuery;
302
 
303
  var Option = function Option(element) {
 
 
 
 
304
 
305
- // find corresponding element
306
- if (typeof element == "string") {
307
- element = document.getElementById('boxzilla-' + element);
308
- }
309
 
310
- if (!element) {
311
- console.error("Unable to find option element.");
312
- }
313
-
314
- this.element = element;
315
  };
316
 
317
  Option.prototype.getColorValue = function () {
318
- if (this.element.value.length > 0) {
319
- if ($(this.element).hasClass('wp-color-field')) {
320
- return $(this.element).wpColorPicker('color');
321
- } else {
322
- return this.element.value;
323
- }
324
- }
325
-
326
- return '';
327
  };
328
 
329
  Option.prototype.getPxValue = function (fallbackValue) {
330
- if (this.element.value.length > 0) {
331
- return parseInt(this.element.value) + "px";
332
- }
333
 
334
- return fallbackValue || '';
335
  };
336
 
337
  Option.prototype.getValue = function (fallbackValue) {
 
 
 
338
 
339
- if (this.element.value.length > 0) {
340
- return this.element.value;
341
- }
342
-
343
- return fallbackValue || '';
344
  };
345
 
346
  Option.prototype.clear = function () {
347
- this.element.value = '';
348
  };
349
 
350
  Option.prototype.setValue = function (value) {
351
- this.element.value = value;
352
  };
353
 
354
  module.exports = Option;
355
 
356
  },{}],5:[function(require,module,exports){
357
  /*!
358
- * EventEmitter v5.2.4 - git.io/ee
359
  * Unlicense - http://unlicense.org/
360
  * Oliver Caldwell - http://oli.me.uk/
361
  * @preserve
@@ -839,7 +837,7 @@ module.exports = Option;
839
  else {
840
  exports.EventEmitter = EventEmitter;
841
  }
842
- }(this || {}));
843
 
844
  },{}]},{},[1]);
845
  ; })();
1
+ (function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
+ "use strict";
3
 
4
  window.Boxzilla_Admin = require('./admin/_admin.js');
5
 
6
  },{"./admin/_admin.js":2}],2:[function(require,module,exports){
7
+ "use strict";
8
 
9
  (function () {
10
+ 'use strict';
11
 
12
+ var $ = window.jQuery;
 
 
 
 
13
 
14
+ var Option = require('./_option.js');
 
 
 
15
 
16
+ var optionControls = document.getElementById('boxzilla-box-options-controls');
17
+ var $optionControls = $(optionControls);
18
+ var tnLoggedIn = document.createTextNode(' logged in'); // sanity check, are we on the correct page?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ if ($optionControls.length === 0) {
21
+ return;
22
+ }
23
 
24
+ var EventEmitter = require('wolfy87-eventemitter');
 
 
 
25
 
26
+ var events = new EventEmitter();
 
 
27
 
28
+ var Designer = require('./_designer.js')($, Option, events);
 
29
 
30
+ var rowTemplate = wp.template('rule-row-template');
31
+ var i18n = boxzilla_i18n;
32
+ var ruleComparisonEl = document.getElementById('boxzilla-rule-comparison');
33
+ var rulesContainerEl = document.getElementById('boxzilla-box-rules'); // events
34
 
35
+ $optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
36
+ $optionControls.on('click', ".boxzilla-remove-rule", removeRule);
37
+ $optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
38
+ $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);
39
+ $(ruleComparisonEl).change(toggleAndOrTexts);
40
+ $(window).load(function () {
41
+ if (typeof window.tinyMCE === "undefined") {
42
+ document.getElementById('notice-notinymce').style.display = '';
43
  }
44
+ }); // call contextual helper method for each row
45
 
46
+ $('.boxzilla-rule-row').each(setContextualHelpers);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
+ function toggleAndOrTexts() {
49
+ var newText = ruleComparisonEl.value === 'any' ? i18n.or : i18n.and;
50
+ $('.boxzilla-andor').text(newText);
51
+ }
 
 
 
 
52
 
53
+ function toggleTriggerOptions() {
54
+ $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');
55
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
+ function removeRule() {
58
+ var row = $(this).parents('tr'); // delete andor row
 
 
 
 
 
59
 
60
+ row.prev().remove(); // delete rule row
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
+ row.remove();
63
+ }
 
 
 
 
64
 
65
+ function setContextualHelpers() {
66
+ var context = this.tagName.toLowerCase() === "tr" ? this : $(this).parents('tr').get(0);
67
+ var condition = context.querySelector('.boxzilla-rule-condition').value;
68
+ var valueInput = context.querySelector('.boxzilla-rule-value');
69
+ var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
70
+ var betterInput = valueInput.cloneNode(true);
71
+ var $betterInput = $(betterInput); // remove previously added helpers
72
 
73
+ $(context.querySelectorAll('.boxzilla-helper')).remove(); // prepare better input
 
 
 
74
 
75
+ betterInput.removeAttribute('name');
76
+ betterInput.className = betterInput.className + ' boxzilla-helper';
77
+ valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
78
+ $betterInput.change(function () {
79
+ valueInput.value = this.value;
80
+ });
81
+ betterInput.style.display = '';
82
+ valueInput.style.display = 'none';
83
+ qualifierInput.style.display = '';
84
+ qualifierInput.querySelector('option[value="not_contains"]').style.display = 'none';
85
+ qualifierInput.querySelector('option[value="contains"]').style.display = 'none';
86
+
87
+ if (tnLoggedIn.parentNode) {
88
+ tnLoggedIn.parentNode.removeChild(tnLoggedIn);
89
+ } // change placeholder for textual help
90
+
91
+
92
+ switch (condition) {
93
+ default:
94
+ betterInput.placeholder = i18n.enterCommaSeparatedValues;
95
+ break;
96
+
97
+ case '':
98
+ case 'everywhere':
99
+ qualifierInput.value = '1';
100
+ valueInput.value = '';
101
+ betterInput.style.display = 'none';
102
+ qualifierInput.style.display = 'none';
103
+ break;
104
+
105
+ case 'is_single':
106
+ case 'is_post':
107
+ betterInput.placeholder = i18n.enterCommaSeparatedPosts;
108
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", {
109
+ multiple: true,
110
+ multipleSep: ","
111
+ });
112
+ break;
113
 
114
+ case 'is_page':
115
+ betterInput.placeholder = i18n.enterCommaSeparatedPages;
116
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {
117
+ multiple: true,
118
+ multipleSep: ","
119
+ });
120
+ break;
121
+
122
+ case 'is_post_type':
123
+ betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
124
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", {
125
+ multiple: true,
126
+ multipleSep: ","
127
+ });
128
+ break;
129
+
130
+ case 'is_url':
131
+ qualifierInput.querySelector('option[value="contains"]').style.display = '';
132
+ qualifierInput.querySelector('option[value="not_contains"]').style.display = '';
133
+ betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
134
+ break;
135
+
136
+ case 'is_post_in_category':
137
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {
138
+ multiple: true,
139
+ multipleSep: ","
140
+ });
141
+ break;
142
+
143
+ case 'is_post_with_tag':
144
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {
145
+ multiple: true,
146
+ multipleSep: ","
147
+ });
148
+ break;
149
+
150
+ case 'is_user_logged_in':
151
+ betterInput.style.display = 'none';
152
+ valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);
153
+ break;
154
+
155
+ case 'is_referer':
156
+ qualifierInput.querySelector('option[value="contains"]').style.display = '';
157
+ qualifierInput.querySelector('option[value="not_contains"]').style.display = '';
158
+ break;
159
  }
160
+ }
161
 
162
+ function addRuleFields() {
163
+ var data = {
164
+ 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length,
165
+ 'andor': ruleComparisonEl.value === 'any' ? i18n.or : i18n.and
166
  };
167
+ var html = rowTemplate(data);
168
+ $(rulesContainerEl).append(html);
169
+ return false;
170
+ }
171
+
172
+ module.exports = {
173
+ 'Designer': Designer,
174
+ 'Option': Option,
175
+ 'events': events
176
+ };
177
  })();
178
 
179
  },{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(require,module,exports){
180
+ "use strict";
181
 
182
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
183
 
184
  var Designer = function Designer($, Option, events) {
185
+ // vars
186
+ var boxId = document.getElementById('post_ID').value || 0,
187
+ $editor,
188
+ $editorFrame,
189
+ $innerEditor,
190
+ options = {},
191
+ visualEditorInitialised = false;
192
+ var $appearanceControls = $("#boxzilla-box-appearance-controls"); // create Option objects
193
+
194
+ options.borderColor = new Option('border-color');
195
+ options.borderWidth = new Option('border-width');
196
+ options.borderStyle = new Option('border-style');
197
+ options.backgroundColor = new Option('background-color');
198
+ options.width = new Option('width');
199
+ options.color = new Option('color'); // functions
200
+
201
+ function init() {
202
+ // Only run if TinyMCE has actually inited
203
+ if (_typeof(window.tinyMCE) !== "object" || tinyMCE.get('content') === null) {
204
+ return;
205
+ } // add classes to TinyMCE <html>
206
+
207
+
208
+ $editorFrame = $("#content_ifr");
209
+ $editor = $editorFrame.contents().find('html');
210
+ $editor.css({
211
+ 'background': 'white'
212
+ }); // add content class and padding to TinyMCE <body>
213
+
214
+ $innerEditor = $editor.find('#tinymce');
215
+ $innerEditor.addClass('boxzilla boxzilla-' + boxId);
216
+ $innerEditor.css({
217
+ 'margin': 0,
218
+ 'background': 'white',
219
+ 'display': 'inline-block',
220
+ 'width': 'auto',
221
+ 'min-width': '240px',
222
+ 'position': 'relative'
223
+ });
224
+ $innerEditor.get(0).style.cssText += ';padding: 25px !important;';
225
+ visualEditorInitialised = true;
226
+ /* @since 2.0.3 */
227
+
228
+ events.trigger('editor.init');
229
+ }
230
+ /**
231
+ * Applies the styles from the options to the TinyMCE Editor
232
+ *
233
+ * @return bool
234
+ */
235
+
236
+
237
+ function applyStyles() {
238
+ if (!visualEditorInitialised) {
239
+ return false;
240
+ } // Apply styles from CSS editor.
241
+ // Use short timeout to make sure color values are updated.
242
+
243
+
244
+ window.setTimeout(function () {
245
+ $innerEditor.css({
246
+ 'border-color': options.borderColor.getColorValue(),
247
+ //getColorValue( 'borderColor', '' ),
248
+ 'border-width': options.borderWidth.getPxValue(),
249
+ //getPxValue( 'borderWidth', '' ),
250
+ 'border-style': options.borderStyle.getValue(),
251
+ //getValue('borderStyle', '' ),
252
+ 'background-color': options.backgroundColor.getColorValue(),
253
+ //getColorValue( 'backgroundColor', ''),
254
+ 'width': options.width.getPxValue(),
255
+ //getPxValue( 'width', 'auto' ),
256
+ 'color': options.color.getColorValue() // getColorValue( 'color', '' )
257
+
258
+ });
259
+ /* @since 2.0.3 */
260
+
261
+ events.trigger('editor.styles.apply');
262
+ }, 10);
263
+ return true;
264
+ }
265
+
266
+ function resetStyles() {
267
+ for (var key in options) {
268
+ if (key.substring(0, 5) === 'theme') {
269
+ continue;
270
+ }
271
+
272
+ options[key].clear();
273
+ }
274
+
275
+ applyStyles();
276
+ /* @since 2.0.3 */
277
+
278
+ events.trigger('editor.styles.reset');
279
+ } // event binders
280
+
281
+
282
+ $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({
283
+ change: applyStyles,
284
+ clear: applyStyles
285
+ });
286
+ $appearanceControls.find(":input").not(".boxzilla-color-field").change(applyStyles);
287
+ events.on('editor.init', applyStyles); // public methods
288
 
289
+ return {
290
+ 'init': init,
291
+ 'resetStyles': resetStyles,
292
+ 'options': options
293
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  };
295
 
296
  module.exports = Designer;
301
  var $ = window.jQuery;
302
 
303
  var Option = function Option(element) {
304
+ // find corresponding element
305
+ if (typeof element == "string") {
306
+ element = document.getElementById('boxzilla-' + element);
307
+ }
308
 
309
+ if (!element) {
310
+ console.error("Unable to find option element.");
311
+ }
 
312
 
313
+ this.element = element;
 
 
 
 
314
  };
315
 
316
  Option.prototype.getColorValue = function () {
317
+ if (this.element.value.length > 0) {
318
+ if ($(this.element).hasClass('wp-color-field')) {
319
+ return $(this.element).wpColorPicker('color');
320
+ } else {
321
+ return this.element.value;
322
+ }
323
+ }
324
+
325
+ return '';
326
  };
327
 
328
  Option.prototype.getPxValue = function (fallbackValue) {
329
+ if (this.element.value.length > 0) {
330
+ return parseInt(this.element.value) + "px";
331
+ }
332
 
333
+ return fallbackValue || '';
334
  };
335
 
336
  Option.prototype.getValue = function (fallbackValue) {
337
+ if (this.element.value.length > 0) {
338
+ return this.element.value;
339
+ }
340
 
341
+ return fallbackValue || '';
 
 
 
 
342
  };
343
 
344
  Option.prototype.clear = function () {
345
+ this.element.value = '';
346
  };
347
 
348
  Option.prototype.setValue = function (value) {
349
+ this.element.value = value;
350
  };
351
 
352
  module.exports = Option;
353
 
354
  },{}],5:[function(require,module,exports){
355
  /*!
356
+ * EventEmitter v5.2.5 - git.io/ee
357
  * Unlicense - http://unlicense.org/
358
  * Oliver Caldwell - http://oli.me.uk/
359
  * @preserve
837
  else {
838
  exports.EventEmitter = EventEmitter;
839
  }
840
+ }(typeof window !== 'undefined' ? window : this || {}));
841
 
842
  },{}]},{},[1]);
843
  ; })();
assets/js/admin-script.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){var e=void 0,t=void 0;!function(){function t(n,o,r){function i(s,a){if(!o[s]){if(!n[s]){var u="function"==typeof e&&e;if(!a&&u)return u(s,!0);if(l)return l(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var p=o[s]={exports:{}};n[s][0].call(p.exports,function(e){var t=n[s][1][e];return i(t||e)},p,p.exports,t,n,o,r)}return o[s].exports}for(var l="function"==typeof e&&e,s=0;s<r.length;s++)i(r[s]);return i}return t}()({1:[function(e,t,n){"use strict";window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(e,t,n){"use strict";!function(){function n(){var e="tr"===this.tagName.toLowerCase()?this:o(this).parents("tr").get(0),t=e.querySelector(".boxzilla-rule-condition").value,n=e.querySelector(".boxzilla-rule-value"),r=e.querySelector(".boxzilla-rule-qualifier"),i=n.cloneNode(!0),l=o(i);switch(o(e.querySelectorAll(".boxzilla-helper")).remove(),i.removeAttribute("name"),i.className=i.className+" boxzilla-helper",n.parentNode.insertBefore(i,n.nextSibling),l.change(function(){n.value=this.value}),i.style.display="",n.style.display="none",r.style.display="",r.querySelector('option[value="not_contains"]').style.display="none",r.querySelector('option[value="contains"]').style.display="none",s.parentNode&&s.parentNode.removeChild(s),t){default:i.placeholder=p.enterCommaSeparatedValues;break;case"":case"everywhere":r.value="1",n.value="",i.style.display="none",r.style.display="none";break;case"is_single":case"is_post":i.placeholder=p.enterCommaSeparatedPosts,l.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":i.placeholder=p.enterCommaSeparatedPages,l.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":i.placeholder=p.enterCommaSeparatedPostTypes,l.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":r.querySelector('option[value="contains"]').style.display="",r.querySelector('option[value="not_contains"]').style.display="",i.placeholder=p.enterCommaSeparatedRelativeUrls;break;case"is_post_in_category":l.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=category",{multiple:!0,multipleSep:","});break;case"is_post_with_tag":l.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_tag",{multiple:!0,multipleSep:","});break;case"is_user_logged_in":i.style.display="none",n.parentNode.insertBefore(s,n.nextSibling);break;case"is_referer":r.querySelector('option[value="contains"]').style.display="",r.querySelector('option[value="not_contains"]').style.display=""}}var o=window.jQuery,r=e("./_option.js"),i=document.getElementById("boxzilla-box-options-controls"),l=o(i),s=document.createTextNode(" logged in");if(0!==l.length){var a=new(e("wolfy87-eventemitter")),u=e("./_designer.js")(o,r,a),c=wp.template("rule-row-template"),p=boxzilla_i18n,d=document.getElementById("boxzilla-rule-comparison"),f=document.getElementById("boxzilla-box-rules");l.on("click",".boxzilla-add-rule",function(){var e={key:i.querySelectorAll(".boxzilla-rule-row").length,andor:"any"===d.value?p.or:p.and},t=c(e);return o(f).append(t),!1}),l.on("click",".boxzilla-remove-rule",function(){var e=o(this).parents("tr");e.prev().remove(),e.remove()}),l.on("change",".boxzilla-rule-condition",n),l.find(".boxzilla-auto-show-trigger").on("change",function(){l.find(".boxzilla-trigger-options").toggle(""!==this.value)}),o(d).change(function(){var e="any"===d.value?p.or:p.and;o(".boxzilla-andor").text(e)}),o(window).load(function(){void 0===window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),o(".boxzilla-rule-row").each(n),t.exports={Designer:u,Option:r,events:a}}}()},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.exports=function(e,t,n){function r(){return!!c&&(s.css({"border-color":u.borderColor.getColorValue(),"border-width":u.borderWidth.getPxValue(),"border-style":u.borderStyle.getValue(),"background-color":u.backgroundColor.getColorValue(),width:u.width.getPxValue(),color:u.color.getColorValue()}),n.trigger("editor.styles.apply"),!0)}var i,l,s,a=document.getElementById("post_ID").value||0,u={},c=!1,p=e("#boxzilla-box-appearance-controls");return u.borderColor=new t("border-color"),u.borderWidth=new t("border-width"),u.borderStyle=new t("border-style"),u.backgroundColor=new t("background-color"),u.width=new t("width"),u.color=new t("color"),p.find("input.boxzilla-color-field").wpColorPicker({change:r,clear:r}),p.find(":input").not(".boxzilla-color-field").change(r),n.on("editor.init",r),{init:function(){"object"===o(window.tinyMCE)&&null!==tinyMCE.get("content")&&(l=e("#content_ifr"),(i=l.contents().find("html")).css({background:"white"}),(s=i.find("#tinymce")).addClass("boxzilla boxzilla-"+a),s.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),s.get(0).style.cssText+=";padding: 25px !important;",c=!0,n.trigger("editor.init"))},resetStyles:function(){for(var e in u)"theme"!==e.substring(0,5)&&u[e].clear();r(),n.trigger("editor.styles.reset")},options:u}}},{}],4:[function(e,t,n){"use strict";var o=window.jQuery,r=function(e){"string"==typeof e&&(e=document.getElementById("boxzilla-"+e)),e||console.error("Unable to find option element."),this.element=e};r.prototype.getColorValue=function(){return this.element.value.length>0?o(this.element).hasClass("wp-color-field")?o(this.element).wpColorPicker("color"):this.element.value:""},r.prototype.getPxValue=function(e){return this.element.value.length>0?parseInt(this.element.value)+"px":e||""},r.prototype.getValue=function(e){return this.element.value.length>0?this.element.value:e||""},r.prototype.clear=function(){this.element.value=""},r.prototype.setValue=function(e){this.element.value=e},t.exports=r},{}],5:[function(e,n,o){!function(e){"use strict";function o(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function i(e){return function(){return this[e].apply(this,arguments)}}function l(e){return"function"==typeof e||e instanceof RegExp||!(!e||"object"!=typeof e)&&l(e.listener)}var s=o.prototype,a=e.EventEmitter;s.getListeners=function(e){var t,n,o=this._getEvents();if(e instanceof RegExp){t={};for(n in o)o.hasOwnProperty(n)&&e.test(n)&&(t[n]=o[n])}else t=o[e]||(o[e]=[]);return t},s.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},s.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&((t={})[e]=n),t||n},s.addListener=function(e,t){if(!l(t))throw new TypeError("listener must be a function");var n,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},s.on=i("addListener"),s.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},s.once=i("addOnceListener"),s.defineEvent=function(e){return this.getListeners(e),this},s.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},s.removeListener=function(e,t){var n,o,i=this.getListenersAsObject(e);for(o in i)i.hasOwnProperty(o)&&-1!==(n=r(i[o],t))&&i[o].splice(n,1);return this},s.off=i("removeListener"),s.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},s.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},s.manipulateListeners=function(e,t,n){var o,r,i=e?this.removeListener:this.addListener,l=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(o=n.length;o--;)i.call(this,t,n[o]);else for(o in t)t.hasOwnProperty(o)&&(r=t[o])&&("function"==typeof r?i.call(this,o,r):l.call(this,o,r));return this},s.removeEvent=function(e){var t,n=typeof e,o=this._getEvents();if("string"===n)delete o[e];else if(e instanceof RegExp)for(t in o)o.hasOwnProperty(t)&&e.test(t)&&delete o[t];else delete this._events;return this},s.removeAllListeners=i("removeEvent"),s.emitEvent=function(e,t){var n,o,r,i,l=this.getListenersAsObject(e);for(i in l)if(l.hasOwnProperty(i))for(n=l[i].slice(0),r=0;r<n.length;r++)!0===(o=n[r]).once&&this.removeListener(e,o.listener),o.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,o.listener);return this},s.trigger=i("emitEvent"),s.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},s.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},s._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},s._getEvents=function(){return this._events||(this._events={})},o.noConflict=function(){return e.EventEmitter=a,o},"function"==typeof t&&t.amd?t(function(){return o}):"object"==typeof n&&n.exports?n.exports=o:e.EventEmitter=o}(this||{})},{}]},{},[1])}();
2
  //# sourceMappingURL=admin-script.min.js.map
1
+ !function(){var s=void 0;!function i(l,s,a){function u(t,e){if(!s[t]){if(!l[t]){var n=!1;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}var r=s[t]={exports:{}};l[t][0].call(r.exports,function(e){return u(l[t][1][e]||e)},r,r.exports,i,l,s,a)}return s[t].exports}for(var c=!1,e=0;e<a.length;e++)u(a[e]);return u}({1:[function(e,t,n){"use strict";window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(d,f,e){"use strict";!function(){var l=window.jQuery,e=d("./_option.js"),n=document.getElementById("boxzilla-box-options-controls"),t=l(n),s=document.createTextNode(" logged in");if(0!==t.length){var o=new(d("wolfy87-eventemitter")),r=d("./_designer.js")(l,e,o),i=wp.template("rule-row-template"),a=boxzilla_i18n,u=document.getElementById("boxzilla-rule-comparison"),c=document.getElementById("boxzilla-box-rules");t.on("click",".boxzilla-add-rule",function(){var e={key:n.querySelectorAll(".boxzilla-rule-row").length,andor:"any"===u.value?a.or:a.and},t=i(e);return l(c).append(t),!1}),t.on("click",".boxzilla-remove-rule",function(){var e=l(this).parents("tr");e.prev().remove(),e.remove()}),t.on("change",".boxzilla-rule-condition",p),t.find(".boxzilla-auto-show-trigger").on("change",function(){t.find(".boxzilla-trigger-options").toggle(""!==this.value)}),l(u).change(function(){var e="any"===u.value?a.or:a.and;l(".boxzilla-andor").text(e)}),l(window).load(function(){void 0===window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),l(".boxzilla-rule-row").each(p),f.exports={Designer:r,Option:e,events:o}}function p(){var e="tr"===this.tagName.toLowerCase()?this:l(this).parents("tr").get(0),t=e.querySelector(".boxzilla-rule-condition").value,n=e.querySelector(".boxzilla-rule-value"),o=e.querySelector(".boxzilla-rule-qualifier"),r=n.cloneNode(!0),i=l(r);switch(l(e.querySelectorAll(".boxzilla-helper")).remove(),r.removeAttribute("name"),r.className=r.className+" boxzilla-helper",n.parentNode.insertBefore(r,n.nextSibling),i.change(function(){n.value=this.value}),r.style.display="",n.style.display="none",o.style.display="",o.querySelector('option[value="not_contains"]').style.display="none",o.querySelector('option[value="contains"]').style.display="none",s.parentNode&&s.parentNode.removeChild(s),t){default:r.placeholder=a.enterCommaSeparatedValues;break;case"":case"everywhere":o.value="1",n.value="",r.style.display="none",o.style.display="none";break;case"is_single":case"is_post":r.placeholder=a.enterCommaSeparatedPosts,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":r.placeholder=a.enterCommaSeparatedPages,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":r.placeholder=a.enterCommaSeparatedPostTypes,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":o.querySelector('option[value="contains"]').style.display="",o.querySelector('option[value="not_contains"]').style.display="",r.placeholder=a.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:","});break;case"is_user_logged_in":r.style.display="none",n.parentNode.insertBefore(s,n.nextSibling);break;case"is_referer":o.querySelector('option[value="contains"]').style.display="",o.querySelector('option[value="not_contains"]').style.display=""}}}()},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){"use strict";function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.exports=function(e,t,n){var o,r,i,l=document.getElementById("post_ID").value||0,s={},a=!1,u=e("#boxzilla-box-appearance-controls");function c(){return!!a&&(window.setTimeout(function(){i.css({"border-color":s.borderColor.getColorValue(),"border-width":s.borderWidth.getPxValue(),"border-style":s.borderStyle.getValue(),"background-color":s.backgroundColor.getColorValue(),width:s.width.getPxValue(),color:s.color.getColorValue()}),n.trigger("editor.styles.apply")},10),!0)}return s.borderColor=new t("border-color"),s.borderWidth=new t("border-width"),s.borderStyle=new t("border-style"),s.backgroundColor=new t("background-color"),s.width=new t("width"),s.color=new t("color"),u.find("input.boxzilla-color-field").wpColorPicker({change:c,clear:c}),u.find(":input").not(".boxzilla-color-field").change(c),n.on("editor.init",c),{init:function(){"object"===p(window.tinyMCE)&&null!==tinyMCE.get("content")&&(r=e("#content_ifr"),(o=r.contents().find("html")).css({background:"white"}),(i=o.find("#tinymce")).addClass("boxzilla boxzilla-"+l),i.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),i.get(0).style.cssText+=";padding: 25px !important;",a=!0,n.trigger("editor.init"))},resetStyles:function(){for(var e in s)"theme"!==e.substring(0,5)&&s[e].clear();c(),n.trigger("editor.styles.reset")},options:s}}},{}],4:[function(e,t,n){"use strict";var o=window.jQuery,r=function(e){"string"==typeof e&&(e=document.getElementById("boxzilla-"+e)),e||console.error("Unable to find option element."),this.element=e};r.prototype.getColorValue=function(){return 0<this.element.value.length?o(this.element).hasClass("wp-color-field")?o(this.element).wpColorPicker("color"):this.element.value:""},r.prototype.getPxValue=function(e){return 0<this.element.value.length?parseInt(this.element.value)+"px":e||""},r.prototype.getValue=function(e){return 0<this.element.value.length?this.element.value:e||""},r.prototype.clear=function(){this.element.value=""},r.prototype.setValue=function(e){this.element.value=e},t.exports=r},{}],5:[function(e,l,t){!function(e){"use strict";function t(){}var n=t.prototype,o=e.EventEmitter;function i(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function r(e){return function(){return this[e].apply(this,arguments)}}n.getListeners=function(e){var t,n,o=this._getEvents();if(e instanceof RegExp)for(n in t={},o)o.hasOwnProperty(n)&&e.test(n)&&(t[n]=o[n]);else t=o[e]||(o[e]=[]);return t},n.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},n.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&((t={})[e]=n),t||n},n.addListener=function(e,t){if(!function e(t){return"function"==typeof t||t instanceof RegExp||!(!t||"object"!=typeof t)&&e(t.listener)}(t))throw new TypeError("listener must be a function");var n,o=this.getListenersAsObject(e),r="object"==typeof t;for(n in o)o.hasOwnProperty(n)&&-1===i(o[n],t)&&o[n].push(r?t:{listener:t,once:!1});return this},n.on=r("addListener"),n.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},n.once=r("addOnceListener"),n.defineEvent=function(e){return this.getListeners(e),this},n.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},n.removeListener=function(e,t){var n,o,r=this.getListenersAsObject(e);for(o in r)r.hasOwnProperty(o)&&-1!==(n=i(r[o],t))&&r[o].splice(n,1);return this},n.off=r("removeListener"),n.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},n.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},n.manipulateListeners=function(e,t,n){var o,r,i=e?this.removeListener:this.addListener,l=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(o=n.length;o--;)i.call(this,t,n[o]);else for(o in t)t.hasOwnProperty(o)&&(r=t[o])&&("function"==typeof r?i.call(this,o,r):l.call(this,o,r));return this},n.removeEvent=function(e){var t,n=typeof e,o=this._getEvents();if("string"===n)delete o[e];else if(e instanceof RegExp)for(t in o)o.hasOwnProperty(t)&&e.test(t)&&delete o[t];else delete this._events;return this},n.removeAllListeners=r("removeEvent"),n.emitEvent=function(e,t){var n,o,r,i,l=this.getListenersAsObject(e);for(i in l)if(l.hasOwnProperty(i))for(n=l[i].slice(0),r=0;r<n.length;r++)!0===(o=n[r]).once&&this.removeListener(e,o.listener),o.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,o.listener);return this},n.trigger=r("emitEvent"),n.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},n.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},n._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},n._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return e.EventEmitter=o,t},"function"==typeof s&&s.amd?s(function(){return t}):"object"==typeof l&&l.exports?l.exports=t:e.EventEmitter=t}("undefined"!=typeof window?window: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","setContextualHelpers","context","this","tagName","toLowerCase","$","parents","get","condition","querySelector","value","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","querySelectorAll","remove","removeAttribute","className","parentNode","insertBefore","nextSibling","change","style","display","tnLoggedIn","removeChild","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","jQuery","Option","optionControls","document","getElementById","$optionControls","createTextNode","events","Designer","rowTemplate","wp","template","boxzilla_i18n","ruleComparisonEl","rulesContainerEl","on","data","key","andor","or","and","html","append","row","prev","find","toggle","newText","text","load","tinyMCE","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","_typeof","Symbol","iterator","obj","constructor","prototype","applyStyles","visualEditorInitialised","$innerEditor","css","border-color","options","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","width","color","trigger","$editor","$editorFrame","boxId","$appearanceControls","wpColorPicker","clear","not","init","contents","background","addClass","margin","min-width","position","cssText","resetStyles","substring","4","element","console","error","hasClass","fallbackValue","parseInt","setValue","5","EventEmitter","indexOfListener","listeners","listener","alias","name","apply","arguments","isValidListener","RegExp","proto","originalGlobalValue","getListeners","evt","response","_getEvents","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","TypeError","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"CAAA,WAAe,IAAIA,OAAUC,EAAgEC,OAASD,GAAW,WAAY,SAASE,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAkB,mBAATV,GAAqBA,EAAQ,IAAIS,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,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BAAXrJ,GAAyBA,EAAOyM,IACvCzM,EAAO,WACH,OAAOqJ,IAGY,iBAAXnI,GAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUuI,EAGjBvI,EAAQuI,aAAeA,EA5d9B,CA8dC5H,oBAES,IA30BX","file":"admin-script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){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}return e})()({1:[function(require,module,exports){\n'use strict';\n\nwindow.Boxzilla_Admin = require('./admin/_admin.js');\n\n},{\"./admin/_admin.js\":2}],2:[function(require,module,exports){\n'use strict';\n\n(function () {\n 'use strict';\n\n var $ = window.jQuery;\n var Option = require('./_option.js');\n var optionControls = document.getElementById('boxzilla-box-options-controls');\n var $optionControls = $(optionControls);\n var tnLoggedIn = document.createTextNode(' logged in');\n\n // sanity check, are we on the correct page?\n if ($optionControls.length === 0) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter');\n var events = new EventEmitter();\n var Designer = require('./_designer.js')($, Option, events);\n var rowTemplate = wp.template('rule-row-template');\n var i18n = boxzilla_i18n;\n var ruleComparisonEl = document.getElementById('boxzilla-rule-comparison');\n var rulesContainerEl = document.getElementById('boxzilla-box-rules');\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 $(ruleComparisonEl).change(toggleAndOrTexts);\n\n $(window).load(function () {\n if (typeof window.tinyMCE === \"undefined\") {\n document.getElementById('notice-notinymce').style.display = '';\n }\n });\n\n // call contextual helper method for each row\n $('.boxzilla-rule-row').each(setContextualHelpers);\n\n function toggleAndOrTexts() {\n var newText = ruleComparisonEl.value === 'any' ? i18n.or : i18n.and;\n $('.boxzilla-andor').text(newText);\n }\n\n function toggleTriggerOptions() {\n $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n }\n\n function removeRule() {\n var row = $(this).parents('tr');\n\n // delete andor row\n row.prev().remove();\n\n // delete rule row\n row.remove();\n }\n\n function setContextualHelpers() {\n var context = this.tagName.toLowerCase() === \"tr\" ? this : $(this).parents('tr').get(0);\n var condition = context.querySelector('.boxzilla-rule-condition').value;\n var valueInput = context.querySelector('.boxzilla-rule-value');\n var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n var betterInput = valueInput.cloneNode(true);\n var $betterInput = $(betterInput);\n\n // remove previously added helpers\n $(context.querySelectorAll('.boxzilla-helper')).remove();\n\n // prepare better input\n betterInput.removeAttribute('name');\n betterInput.className = betterInput.className + ' boxzilla-helper';\n valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n $betterInput.change(function () {\n valueInput.value = this.value;\n });\n\n betterInput.style.display = '';\n valueInput.style.display = 'none';\n qualifierInput.style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = 'none';\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = 'none';\n if (tnLoggedIn.parentNode) {\n tnLoggedIn.parentNode.removeChild(tnLoggedIn);\n }\n\n // change placeholder for textual help\n switch (condition) {\n default:\n betterInput.placeholder = i18n.enterCommaSeparatedValues;\n break;\n\n case '':\n case 'everywhere':\n qualifierInput.value = '1';\n valueInput.value = '';\n betterInput.style.display = 'none';\n qualifierInput.style.display = 'none';\n break;\n\n case 'is_single':\n case 'is_post':\n betterInput.placeholder = i18n.enterCommaSeparatedPosts;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_page':\n betterInput.placeholder = i18n.enterCommaSeparatedPages;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_type':\n betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_url':\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = '';\n betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n break;\n\n case 'is_post_in_category':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_with_tag':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_user_logged_in':\n betterInput.style.display = 'none';\n valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);\n break;\n\n case 'is_referer':\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = '';\n break;\n\n }\n }\n\n function addRuleFields() {\n var data = {\n 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length,\n 'andor': ruleComparisonEl.value === 'any' ? i18n.or : i18n.and\n };\n var html = rowTemplate(data);\n $(rulesContainerEl).append(html);\n return false;\n }\n\n module.exports = {\n 'Designer': Designer,\n 'Option': Option,\n 'events': events\n };\n})();\n\n},{\"./_designer.js\":3,\"./_option.js\":4,\"wolfy87-eventemitter\":5}],3:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar Designer = function Designer($, Option, events) {\n\n\t// vars\n\tvar boxId = document.getElementById('post_ID').value || 0,\n\t $editor,\n\t $editorFrame,\n\t $innerEditor,\n\t options = {},\n\t visualEditorInitialised = false;\n\n\tvar $appearanceControls = $(\"#boxzilla-box-appearance-controls\");\n\n\t// create Option objects\n\toptions.borderColor = new Option('border-color');\n\toptions.borderWidth = new Option('border-width');\n\toptions.borderStyle = new Option('border-style');\n\toptions.backgroundColor = new Option('background-color');\n\toptions.width = new Option('width');\n\toptions.color = new Option('color');\n\n\t// functions\n\tfunction init() {\n\n\t\t// Only run if TinyMCE has actually inited\n\t\tif (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// add classes to TinyMCE <html>\n\t\t$editorFrame = $(\"#content_ifr\");\n\t\t$editor = $editorFrame.contents().find('html');\n\t\t$editor.css({\n\t\t\t'background': 'white'\n\t\t});\n\n\t\t// add content class and padding to TinyMCE <body>\n\t\t$innerEditor = $editor.find('#tinymce');\n\t\t$innerEditor.addClass('boxzilla boxzilla-' + boxId);\n\t\t$innerEditor.css({\n\t\t\t'margin': 0,\n\t\t\t'background': 'white',\n\t\t\t'display': 'inline-block',\n\t\t\t'width': 'auto',\n\t\t\t'min-width': '240px',\n\t\t\t'position': 'relative'\n\t\t});\n\t\t$innerEditor.get(0).style.cssText += ';padding: 25px !important;';\n\n\t\tvisualEditorInitialised = true;\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.init');\n\t}\n\n\t/**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n\tfunction applyStyles() {\n\n\t\tif (!visualEditorInitialised) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// apply styles from CSS editor\n\t\t$innerEditor.css({\n\t\t\t'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),\n\t\t\t'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),\n\t\t\t'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),\n\t\t\t'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),\n\t\t\t'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),\n\t\t\t'color': options.color.getColorValue() // getColorValue( 'color', '' )\n\t\t});\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.apply');\n\n\t\treturn true;\n\t}\n\n\tfunction resetStyles() {\n\t\tfor (var key in options) {\n\t\t\tif (key.substring(0, 5) === 'theme') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toptions[key].clear();\n\t\t}\n\t\tapplyStyles();\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.reset');\n\t}\n\n\t// event binders\n\t$appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });\n\t$appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n\tevents.on('editor.init', applyStyles);\n\n\t// public methods\n\treturn {\n\t\t'init': init,\n\t\t'resetStyles': resetStyles,\n\t\t'options': options\n\t};\n};\n\nmodule.exports = Designer;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\n\nvar Option = function Option(element) {\n\n\t// find corresponding element\n\tif (typeof element == \"string\") {\n\t\telement = document.getElementById('boxzilla-' + element);\n\t}\n\n\tif (!element) {\n\t\tconsole.error(\"Unable to find option element.\");\n\t}\n\n\tthis.element = element;\n};\n\nOption.prototype.getColorValue = function () {\n\tif (this.element.value.length > 0) {\n\t\tif ($(this.element).hasClass('wp-color-field')) {\n\t\t\treturn $(this.element).wpColorPicker('color');\n\t\t} else {\n\t\t\treturn this.element.value;\n\t\t}\n\t}\n\n\treturn '';\n};\n\nOption.prototype.getPxValue = function (fallbackValue) {\n\tif (this.element.value.length > 0) {\n\t\treturn parseInt(this.element.value) + \"px\";\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.getValue = function (fallbackValue) {\n\n\tif (this.element.value.length > 0) {\n\t\treturn this.element.value;\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.clear = function () {\n\tthis.element.value = '';\n};\n\nOption.prototype.setValue = function (value) {\n\tthis.element.value = value;\n};\n\nmodule.exports = Option;\n\n},{}],5:[function(require,module,exports){\n/*!\n * EventEmitter v5.2.4 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function (exports) {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n function isValidListener (listener) {\n if (typeof listener === 'function' || listener instanceof RegExp) {\n return true\n } else if (listener && typeof listener === 'object') {\n return isValidListener(listener.listener)\n } else {\n return false\n }\n }\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n if (!isValidListener(listener)) {\n throw new TypeError('listener must be a function');\n }\n\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n\n for (i = 0; i < listeners.length; i++) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}(this || {}));\n\n},{}]},{},[1]);\n; })();"]}
1
+ {"version":3,"sources":["admin-script.js"],"names":["define","undefined","r","e","n","t","o","i","f","c","u","a","Error","code","p","exports","call","length","1","require","module","window","Boxzilla_Admin","./admin/_admin.js","2","$","jQuery","Option","optionControls","document","getElementById","$optionControls","tnLoggedIn","createTextNode","events","Designer","rowTemplate","wp","template","i18n","boxzilla_i18n","ruleComparisonEl","rulesContainerEl","on","data","key","querySelectorAll","andor","value","or","and","html","append","row","this","parents","prev","remove","setContextualHelpers","find","toggle","change","newText","text","load","tinyMCE","style","display","each","context","tagName","toLowerCase","get","condition","querySelector","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","removeAttribute","className","parentNode","insertBefore","nextSibling","removeChild","placeholder","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","./_designer.js","./_option.js","wolfy87-eventemitter","3","_typeof","obj","Symbol","iterator","constructor","prototype","$editor","$editorFrame","$innerEditor","boxId","options","visualEditorInitialised","$appearanceControls","applyStyles","setTimeout","css","border-color","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","width","color","trigger","wpColorPicker","clear","not","init","contents","background","addClass","margin","min-width","position","cssText","resetStyles","substring","4","element","console","error","hasClass","fallbackValue","parseInt","setValue","5","EventEmitter","proto","originalGlobalValue","indexOfListener","listeners","listener","alias","name","apply","arguments","getListeners","evt","response","_getEvents","RegExp","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","isValidListener","TypeError","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"CAAA,WAAe,IAA8EA,OAASC,GAAuB,SAASC,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,GAAE,EAAoC,IAAID,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EAAEG,GAAG,CAACQ,QAAQ,IAAIZ,EAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAoB,OAAOI,EAAlBH,EAAEI,GAAG,GAAGL,IAAeA,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGQ,QAAQ,IAAI,IAAIL,GAAE,EAAoCH,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAA7b,CAA4c,CAACY,EAAE,CAAC,SAASC,EAAQC,EAAOL,GACzlB,aAEAM,OAAOC,eAAiBH,EAAQ,sBAE9B,CAACI,oBAAoB,IAAIC,EAAE,CAAC,SAASL,EAAQC,EAAOL,GACtD,cAEA,WAGE,IAAIU,EAAIJ,OAAOK,OAEXC,EAASR,EAAQ,gBAEjBS,EAAiBC,SAASC,eAAe,iCACzCC,EAAkBN,EAAEG,GACpBI,EAAaH,SAASI,eAAe,cAEzC,GAA+B,IAA3BF,EAAgBd,OAApB,CAIA,IAEIiB,EAAS,IAFMf,EAAQ,yBAIvBgB,EAAWhB,E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iI,eAAepB,EAAKN,EAASA,UAG3BA,EAASA,SAASG,MAAM1G,KAAM8I,GAAQ,MAEhC9I,KAAKiJ,uBAClBjJ,KAAKiI,eAAepB,EAAKN,EAASA,UAMlD,OAAOvG,MAMXmG,EAAMxB,QAAU6B,EAAM,aAUtBL,EAAM+C,KAAO,SAAcrC,GACvB,IAAIiC,EAAOvB,MAAMpE,UAAU6F,MAAMtL,KAAKiJ,UAAW,GACjD,OAAO3G,KAAK6I,UAAUhC,EAAKiC,IAW/B3C,EAAMgD,mBAAqB,SAA4BzJ,GAEnD,OADAM,KAAKoJ,iBAAmB1J,EACjBM,MAWXmG,EAAM8C,oBAAsB,WACxB,OAAIjJ,KAAKiH,eAAe,qBACbjH,KAAKoJ,kBAapBjD,EAAMY,WAAa,WACf,OAAO/G,KAAK2I,UAAY3I,KAAK2I,QAAU,KAQ3CzC,EAAamD,WAAa,WAEtB,OADA5L,EAAQyI,aAAeE,EAChBF,GAIW,mBAAXxJ,GAAyBA,EAAO4M,IACvC5M,EAAO,WACH,OAAOwJ,IAGY,iBAAXpI,GAAuBA,EAAOL,QAC1CK,EAAOL,QAAUyI,EAGjBzI,EAAQyI,aAAeA,EA5d9B,CA8dmB,oBAAXnI,OAAyBA,OAASiC,MAAQ,KAEjD,KAAK,GAAG,CAAC,IAz0BX","file":"admin-script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n\"use strict\";\n\nwindow.Boxzilla_Admin = require('./admin/_admin.js');\n\n},{\"./admin/_admin.js\":2}],2:[function(require,module,exports){\n\"use strict\";\n\n(function () {\n 'use strict';\n\n var $ = window.jQuery;\n\n var Option = require('./_option.js');\n\n var optionControls = document.getElementById('boxzilla-box-options-controls');\n var $optionControls = $(optionControls);\n var tnLoggedIn = document.createTextNode(' logged in'); // sanity check, are we on the correct page?\n\n if ($optionControls.length === 0) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter');\n\n var events = new EventEmitter();\n\n var Designer = require('./_designer.js')($, Option, events);\n\n var rowTemplate = wp.template('rule-row-template');\n var i18n = boxzilla_i18n;\n var ruleComparisonEl = document.getElementById('boxzilla-rule-comparison');\n var rulesContainerEl = document.getElementById('boxzilla-box-rules'); // events\n\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 $(ruleComparisonEl).change(toggleAndOrTexts);\n $(window).load(function () {\n if (typeof window.tinyMCE === \"undefined\") {\n document.getElementById('notice-notinymce').style.display = '';\n }\n }); // call contextual helper method for each row\n\n $('.boxzilla-rule-row').each(setContextualHelpers);\n\n function toggleAndOrTexts() {\n var newText = ruleComparisonEl.value === 'any' ? i18n.or : i18n.and;\n $('.boxzilla-andor').text(newText);\n }\n\n function toggleTriggerOptions() {\n $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n }\n\n function removeRule() {\n var row = $(this).parents('tr'); // delete andor row\n\n row.prev().remove(); // delete rule row\n\n row.remove();\n }\n\n function setContextualHelpers() {\n var context = this.tagName.toLowerCase() === \"tr\" ? this : $(this).parents('tr').get(0);\n var condition = context.querySelector('.boxzilla-rule-condition').value;\n var valueInput = context.querySelector('.boxzilla-rule-value');\n var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n var betterInput = valueInput.cloneNode(true);\n var $betterInput = $(betterInput); // remove previously added helpers\n\n $(context.querySelectorAll('.boxzilla-helper')).remove(); // prepare better input\n\n betterInput.removeAttribute('name');\n betterInput.className = betterInput.className + ' boxzilla-helper';\n valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n $betterInput.change(function () {\n valueInput.value = this.value;\n });\n betterInput.style.display = '';\n valueInput.style.display = 'none';\n qualifierInput.style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = 'none';\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = 'none';\n\n if (tnLoggedIn.parentNode) {\n tnLoggedIn.parentNode.removeChild(tnLoggedIn);\n } // change placeholder for textual help\n\n\n switch (condition) {\n default:\n betterInput.placeholder = i18n.enterCommaSeparatedValues;\n break;\n\n case '':\n case 'everywhere':\n qualifierInput.value = '1';\n valueInput.value = '';\n betterInput.style.display = 'none';\n qualifierInput.style.display = 'none';\n break;\n\n case 'is_single':\n case 'is_post':\n betterInput.placeholder = i18n.enterCommaSeparatedPosts;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_page':\n betterInput.placeholder = i18n.enterCommaSeparatedPages;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_type':\n betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_url':\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = '';\n betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n break;\n\n case 'is_post_in_category':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_with_tag':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_user_logged_in':\n betterInput.style.display = 'none';\n valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);\n break;\n\n case 'is_referer':\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = '';\n break;\n }\n }\n\n function addRuleFields() {\n var data = {\n 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length,\n 'andor': ruleComparisonEl.value === 'any' ? i18n.or : i18n.and\n };\n var html = rowTemplate(data);\n $(rulesContainerEl).append(html);\n return false;\n }\n\n module.exports = {\n 'Designer': Designer,\n 'Option': Option,\n 'events': events\n };\n})();\n\n},{\"./_designer.js\":3,\"./_option.js\":4,\"wolfy87-eventemitter\":5}],3:[function(require,module,exports){\n\"use strict\";\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar Designer = function Designer($, Option, events) {\n // vars\n var boxId = document.getElementById('post_ID').value || 0,\n $editor,\n $editorFrame,\n $innerEditor,\n options = {},\n visualEditorInitialised = false;\n var $appearanceControls = $(\"#boxzilla-box-appearance-controls\"); // create Option objects\n\n options.borderColor = new Option('border-color');\n options.borderWidth = new Option('border-width');\n options.borderStyle = new Option('border-style');\n options.backgroundColor = new Option('background-color');\n options.width = new Option('width');\n options.color = new Option('color'); // functions\n\n function init() {\n // Only run if TinyMCE has actually inited\n if (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n return;\n } // add classes to TinyMCE <html>\n\n\n $editorFrame = $(\"#content_ifr\");\n $editor = $editorFrame.contents().find('html');\n $editor.css({\n 'background': 'white'\n }); // add content class and padding to TinyMCE <body>\n\n $innerEditor = $editor.find('#tinymce');\n $innerEditor.addClass('boxzilla boxzilla-' + boxId);\n $innerEditor.css({\n 'margin': 0,\n 'background': 'white',\n 'display': 'inline-block',\n 'width': 'auto',\n 'min-width': '240px',\n 'position': 'relative'\n });\n $innerEditor.get(0).style.cssText += ';padding: 25px !important;';\n visualEditorInitialised = true;\n /* @since 2.0.3 */\n\n events.trigger('editor.init');\n }\n /**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n\n\n function applyStyles() {\n if (!visualEditorInitialised) {\n return false;\n } // Apply styles from CSS editor. \n // Use short timeout to make sure color values are updated.\n\n\n window.setTimeout(function () {\n $innerEditor.css({\n 'border-color': options.borderColor.getColorValue(),\n //getColorValue( 'borderColor', '' ),\n 'border-width': options.borderWidth.getPxValue(),\n //getPxValue( 'borderWidth', '' ),\n 'border-style': options.borderStyle.getValue(),\n //getValue('borderStyle', '' ),\n 'background-color': options.backgroundColor.getColorValue(),\n //getColorValue( 'backgroundColor', ''),\n 'width': options.width.getPxValue(),\n //getPxValue( 'width', 'auto' ),\n 'color': options.color.getColorValue() // getColorValue( 'color', '' )\n\n });\n /* @since 2.0.3 */\n\n events.trigger('editor.styles.apply');\n }, 10);\n return true;\n }\n\n function resetStyles() {\n for (var key in options) {\n if (key.substring(0, 5) === 'theme') {\n continue;\n }\n\n options[key].clear();\n }\n\n applyStyles();\n /* @since 2.0.3 */\n\n events.trigger('editor.styles.reset');\n } // event binders\n\n\n $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({\n change: applyStyles,\n clear: applyStyles\n });\n $appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n events.on('editor.init', applyStyles); // public methods\n\n return {\n 'init': init,\n 'resetStyles': resetStyles,\n 'options': options\n };\n};\n\nmodule.exports = Designer;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\n\nvar Option = function Option(element) {\n // find corresponding element\n if (typeof element == \"string\") {\n element = document.getElementById('boxzilla-' + element);\n }\n\n if (!element) {\n console.error(\"Unable to find option element.\");\n }\n\n this.element = element;\n};\n\nOption.prototype.getColorValue = function () {\n if (this.element.value.length > 0) {\n if ($(this.element).hasClass('wp-color-field')) {\n return $(this.element).wpColorPicker('color');\n } else {\n return this.element.value;\n }\n }\n\n return '';\n};\n\nOption.prototype.getPxValue = function (fallbackValue) {\n if (this.element.value.length > 0) {\n return parseInt(this.element.value) + \"px\";\n }\n\n return fallbackValue || '';\n};\n\nOption.prototype.getValue = function (fallbackValue) {\n if (this.element.value.length > 0) {\n return this.element.value;\n }\n\n return fallbackValue || '';\n};\n\nOption.prototype.clear = function () {\n this.element.value = '';\n};\n\nOption.prototype.setValue = function (value) {\n this.element.value = value;\n};\n\nmodule.exports = Option;\n\n},{}],5:[function(require,module,exports){\n/*!\n * EventEmitter v5.2.5 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function (exports) {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n function isValidListener (listener) {\n if (typeof listener === 'function' || listener instanceof RegExp) {\n return true\n } else if (listener && typeof listener === 'object') {\n return isValidListener(listener.listener)\n } else {\n return false\n }\n }\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n if (!isValidListener(listener)) {\n throw new TypeError('listener must be a function');\n }\n\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n\n for (i = 0; i < listeners.length; i++) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}(typeof window !== 'undefined' ? window : this || {}));\n\n},{}]},{},[1]);\n; })();"]}
assets/js/script.js CHANGED
@@ -1,147 +1,140 @@
1
- (function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){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}return e})()({1:[function(require,module,exports){
2
- 'use strict';
3
 
4
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
5
 
6
  (function () {
7
- 'use strict';
8
 
9
- var Boxzilla = require('boxzilla');
10
- var options = window.boxzilla_options;
11
 
12
- // expose Boxzilla object to window
13
- window.Boxzilla = Boxzilla;
14
 
15
- // helper function for setting CSS styles
16
- function css(element, styles) {
17
- if (styles.background_color) {
18
- element.style.background = styles.background_color;
19
- }
20
 
21
- if (styles.color) {
22
- element.style.color = styles.color;
23
- }
 
24
 
25
- if (styles.border_color) {
26
- element.style.borderColor = styles.border_color;
27
- }
28
 
29
- if (styles.border_width) {
30
- element.style.borderWidth = parseInt(styles.border_width) + "px";
31
- }
32
 
33
- if (styles.border_style) {
34
- element.style.borderStyle = styles.border_style;
35
- }
36
 
37
- if (styles.width) {
38
- element.style.maxWidth = parseInt(styles.width) + "px";
39
- }
40
  }
41
 
42
- function createBoxesFromConfig() {
 
 
 
43
 
44
- // failsafe against including script twice.
45
- if (options.inited) {
46
- return;
47
- }
 
48
 
49
- // create boxes from options
50
- for (var key in options.boxes) {
51
 
52
- // get opts
53
- var boxOpts = options.boxes[key];
54
- boxOpts.testMode = isLoggedIn && options.testMode;
 
55
 
56
- // find box content element, bail if not found
57
- var boxContentElement = document.getElementById('boxzilla-box-' + boxOpts.id + '-content');
58
- if (!boxContentElement) {
59
- continue;
60
- }
61
 
62
- // use element as content option
63
- boxOpts.content = boxContentElement;
 
64
 
65
- // create box
66
- var box = Boxzilla.create(boxOpts.id, boxOpts);
67
 
68
- // add box slug to box element as classname
69
- box.element.className = box.element.className + ' boxzilla-' + boxOpts.post.slug;
70
 
71
- // add custom css to box
72
- css(box.element, boxOpts.css);
73
 
74
- box.element.firstChild.firstChild.className += " first-child";
75
- box.element.firstChild.lastChild.className += " last-child";
76
 
77
- // maybe show box right away
78
- if (box.fits() && locationHashRefersBox(box)) {
79
- box.show();
80
- }
81
- }
82
 
83
- // set flag to prevent initialising twice
84
- options.inited = true;
 
 
85
 
86
- // trigger "done" event.
87
- Boxzilla.trigger('done');
88
 
89
- // maybe open box with MC4WP form in it
90
- maybeOpenMailChimpForWordPressBox();
91
- }
92
 
93
- function locationHashRefersBox(box) {
94
- if (!window.location.hash || 0 === window.location.hash.length) {
95
- return false;
96
- }
97
 
98
- var elementId = window.location.hash.substring(1);
 
99
 
100
- // only attempt on strings looking like an ID
101
- var regex = /^[a-zA-Z\-\_0-9]+$/;
102
- if (!regex.test(elementId)) {
103
- return false;
104
- }
105
 
106
- if (elementId === box.element.id) {
107
- return true;
108
- } else if (box.element.querySelector('#' + elementId)) {
109
- return true;
110
- }
111
 
112
- return false;
 
113
  }
114
 
115
- function maybeOpenMailChimpForWordPressBox() {
116
- if (_typeof(window.mc4wp_forms_config) !== "object" || !window.mc4wp_forms_config.submitted_form) {
117
- return;
118
- }
 
119
 
120
- var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;
121
- var boxes = Boxzilla.boxes;
122
- for (var boxId in boxes) {
123
- if (!boxes.hasOwnProperty(boxId)) {
124
- continue;
125
- }
126
- var box = boxes[boxId];
127
- if (box.element.querySelector(selector)) {
128
- box.show();
129
- return;
130
- }
131
- }
132
  }
133
 
134
- // print message when test mode is enabled
135
- var isLoggedIn = document.body.className.indexOf('logged-in') > -1;
136
- if (isLoggedIn && options.testMode) {
137
- console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\'re done testing.');
 
 
 
 
 
 
 
 
 
 
138
  }
 
139
 
140
- // init boxzilla
141
- Boxzilla.init();
142
 
143
- // on window.load, create DOM elements for boxes
144
- window.addEventListener('load', createBoxesFromConfig);
 
 
 
 
 
 
 
 
145
  })();
146
 
147
  },{"boxzilla":5}],2:[function(require,module,exports){
@@ -621,170 +614,177 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
621
  }.call(this));
622
 
623
  },{}],3:[function(require,module,exports){
624
- 'use strict';
625
 
626
  var duration = 320;
627
 
628
  function css(element, styles) {
629
- for (var property in styles) {
630
- element.style[property] = styles[property];
631
- }
632
  }
633
 
634
  function initObjectProperties(properties, value) {
635
- var newObject = {};
636
- for (var i = 0; i < properties.length; i++) {
637
- newObject[properties[i]] = value;
638
- }
639
- return newObject;
 
 
640
  }
641
 
642
  function copyObjectProperties(properties, object) {
643
- var newObject = {};
644
- for (var i = 0; i < properties.length; i++) {
645
- newObject[properties[i]] = object[properties[i]];
646
- }
647
- return newObject;
648
- }
649
 
 
 
 
 
 
 
650
  /**
651
  * Checks if the given element is currently being animated.
652
  *
653
  * @param element
654
  * @returns {boolean}
655
  */
 
 
656
  function animated(element) {
657
- return !!element.getAttribute('data-animated');
658
  }
659
-
660
  /**
661
  * Toggles the element using the given animation.
662
  *
663
  * @param element
664
  * @param animation Either "fade" or "slide"
665
  */
 
 
666
  function toggle(element, animation, callbackFn) {
667
- var nowVisible = element.style.display != 'none' || element.offsetLeft > 0;
668
-
669
- // create clone for reference
670
- var clone = element.cloneNode(true);
671
- var cleanup = function cleanup() {
672
- element.removeAttribute('data-animated');
673
- element.setAttribute('style', clone.getAttribute('style'));
674
- element.style.display = nowVisible ? 'none' : '';
675
- if (callbackFn) {
676
- callbackFn();
677
- }
678
- };
679
 
680
- // store attribute so everyone knows we're animating this element
681
- element.setAttribute('data-animated', "true");
682
 
683
- // toggle element visiblity right away if we're making something visible
684
- if (!nowVisible) {
685
- element.style.display = '';
 
 
 
 
686
  }
 
687
 
688
- var hiddenStyles, visibleStyles;
689
 
690
- // animate properties
691
- if (animation === 'slide') {
692
- hiddenStyles = initObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 0);
693
- visibleStyles = {};
694
 
695
- if (!nowVisible) {
696
- var computedStyles = window.getComputedStyle(element);
697
- visibleStyles = copyObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], computedStyles);
698
 
699
- // in some browsers, getComputedStyle returns "auto" value. this falls back to getBoundingClientRect() in those browsers since we need an actual height.
700
- if (!isFinite(visibleStyles.height)) {
701
- var clientRect = element.getBoundingClientRect();
702
- visibleStyles.height = clientRect.height;
703
- }
704
- css(element, hiddenStyles);
705
- }
706
 
707
- // don't show a scrollbar during animation
708
- element.style.overflowY = 'hidden';
709
- animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);
710
- } else {
711
- hiddenStyles = { opacity: 0 };
712
- visibleStyles = { opacity: 1 };
713
- if (!nowVisible) {
714
- css(element, hiddenStyles);
715
- }
716
 
717
- animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
718
  }
 
 
 
719
  }
720
 
721
  function animate(element, targetStyles, fn) {
722
- var last = +new Date();
723
- var initialStyles = window.getComputedStyle(element);
724
- var currentStyles = {};
725
- var propSteps = {};
726
 
727
- for (var property in targetStyles) {
728
- // make sure we have an object filled with floats
729
- targetStyles[property] = parseFloat(targetStyles[property]);
730
-
731
- // calculate step size & current value
732
- var to = targetStyles[property];
733
- var current = parseFloat(initialStyles[property]);
734
 
735
- // is there something to do?
736
- if (current == to) {
737
- delete targetStyles[property];
738
- continue;
739
- }
740
 
741
- propSteps[property] = (to - current) / duration; // points per second
742
- currentStyles[property] = current;
 
743
  }
744
 
745
- var tick = function tick() {
746
- var now = +new Date();
747
- var timeSinceLastTick = now - last;
748
- var done = true;
749
-
750
- var step, to, increment, newValue;
751
- for (var property in targetStyles) {
752
- step = propSteps[property];
753
- to = targetStyles[property];
754
- increment = step * timeSinceLastTick;
755
- newValue = currentStyles[property] + increment;
756
-
757
- if (step > 0 && newValue >= to || step < 0 && newValue <= to) {
758
- newValue = to;
759
- } else {
760
- done = false;
761
- }
762
 
763
- // store new value
764
- currentStyles[property] = newValue;
 
 
 
765
 
766
- var suffix = property !== "opacity" ? "px" : "";
767
- element.style[property] = newValue + suffix;
768
- }
 
 
769
 
770
- last = +new Date();
 
 
 
 
771
 
772
- // keep going until we're done for all props
773
- if (!done) {
774
- window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);
775
- } else {
776
- // call callback
777
- fn && fn();
778
- }
779
- };
780
 
781
- tick();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
782
  }
783
 
784
  module.exports = {
785
- 'toggle': toggle,
786
- 'animate': animate,
787
- 'animated': animated
788
  };
789
 
790
  },{}],4:[function(require,module,exports){
@@ -804,7 +804,6 @@ var defaults = {
804
  },
805
  Boxzilla,
806
  Animator = require('./animator.js');
807
-
808
  /**
809
  * Merge 2 objects, values of the latter overwriting the former.
810
  *
@@ -812,41 +811,42 @@ var defaults = {
812
  * @param obj2
813
  * @returns {*}
814
  */
 
 
815
  function merge(obj1, obj2) {
816
  var obj3 = {};
 
817
  for (var attrname in obj1) {
818
  obj3[attrname] = obj1[attrname];
819
  }
 
820
  for (var attrname in obj2) {
821
  obj3[attrname] = obj2[attrname];
822
  }
 
823
  return obj3;
824
  }
825
-
826
  /**
827
  * Get the real height of entire document.
828
  * @returns {number}
829
  */
 
 
830
  function getDocumentHeight() {
831
  var body = document.body,
832
  html = document.documentElement;
833
-
834
  var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
835
-
836
  return height;
837
- }
 
838
 
839
- // Box Object
840
  var Box = function Box(id, config) {
841
- this.id = id;
842
 
843
- // store config values
844
- this.config = merge(defaults, config);
845
 
846
- // store ref to overlay
847
- this.overlay = document.getElementById('boxzilla-overlay');
848
 
849
- // state
850
  this.visible = false;
851
  this.dismissed = false;
852
  this.triggered = false;
@@ -854,20 +854,17 @@ var Box = function Box(id, config) {
854
  this.cookieSet = this.isCookieSet();
855
  this.element = null;
856
  this.contentElement = null;
857
- this.closeIcon = null;
858
 
859
- // create dom elements for this box
860
- this.dom();
861
 
862
- // further initialise the box
863
  this.events();
864
- };
 
865
 
866
- // initialise the box
867
  Box.prototype.events = function () {
868
- var box = this;
869
 
870
- // attach event to "close" icon inside box
871
  if (this.closeIcon) {
872
  this.closeIcon.addEventListener('click', this.dismiss.bind(this));
873
  }
@@ -877,34 +874,32 @@ Box.prototype.events = function () {
877
  Boxzilla.trigger('box.interactions.link', [box, e.target]);
878
  }
879
  }, false);
880
-
881
  this.element.addEventListener('submit', function (e) {
882
  box.setCookie();
883
  Boxzilla.trigger('box.interactions.form', [box, e.target]);
884
  }, false);
885
- };
 
886
 
887
- // generate dom elements for this box
888
  Box.prototype.dom = function () {
889
  var wrapper = document.createElement('div');
890
  wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';
891
-
892
  var box = document.createElement('div');
893
  box.setAttribute('id', 'boxzilla-' + this.id);
894
  box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;
895
  box.style.display = 'none';
896
  wrapper.appendChild(box);
897
-
898
  var content;
 
899
  if (typeof this.config.content === "string") {
900
  content = document.createElement('div');
901
  content.innerHTML = this.config.content;
902
  } else {
903
- content = this.config.content;
904
 
905
- // make sure element is visible
906
  content.style.display = '';
907
  }
 
908
  content.className = 'boxzilla-content';
909
  box.appendChild(content);
910
 
@@ -919,28 +914,25 @@ Box.prototype.dom = function () {
919
  document.body.appendChild(wrapper);
920
  this.contentElement = content;
921
  this.element = box;
922
- };
923
 
924
- // set (calculate) custom box styling depending on box options
925
- Box.prototype.setCustomBoxStyling = function () {
926
 
 
927
  // reset element to its initial state
928
  var origDisplay = this.element.style.display;
929
  this.element.style.display = '';
930
  this.element.style.overflowY = 'auto';
931
- this.element.style.maxHeight = 'none';
932
 
933
- // get new dimensions
934
  var windowHeight = window.innerHeight;
935
- var boxHeight = this.element.clientHeight;
936
 
937
- // add scrollbar to box and limit height
938
  if (boxHeight > windowHeight) {
939
  this.element.style.maxHeight = windowHeight + "px";
940
  this.element.style.overflowY = 'scroll';
941
- }
 
942
 
943
- // set new top margin for boxes which are centered
944
  if (this.config.position === 'center') {
945
  var newTopMargin = (windowHeight - boxHeight) / 2;
946
  newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;
@@ -948,41 +940,37 @@ Box.prototype.setCustomBoxStyling = function () {
948
  }
949
 
950
  this.element.style.display = origDisplay;
951
- };
952
 
953
- // toggle visibility of the box
954
- Box.prototype.toggle = function (show) {
955
 
 
956
  // revert visibility if no explicit argument is given
957
  if (typeof show === "undefined") {
958
  show = !this.visible;
959
- }
 
960
 
961
- // is box already at desired visibility?
962
  if (show === this.visible) {
963
  return false;
964
- }
 
965
 
966
- // is box being animated?
967
  if (Animator.animated(this.element)) {
968
  return false;
969
- }
 
970
 
971
- // if box should be hidden but is not closable, bail.
972
  if (!show && !this.config.closable) {
973
  return false;
974
- }
975
 
976
- // set new visibility status
977
- this.visible = show;
978
 
979
- // calculate new styling rules
980
- this.setCustomBoxStyling();
981
 
982
- // trigger event
983
- Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]);
 
984
 
985
- // show or hide box using selected animation
986
  if (this.config.position === 'center') {
987
  this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');
988
  Animator.toggle(this.overlay, "fade");
@@ -992,29 +980,30 @@ Box.prototype.toggle = function (show) {
992
  if (this.visible) {
993
  return;
994
  }
 
995
  this.contentElement.innerHTML = this.contentElement.innerHTML;
996
  }.bind(this));
997
-
998
  return true;
999
- };
 
1000
 
1001
- // show the box
1002
  Box.prototype.show = function () {
1003
  return this.toggle(true);
1004
- };
 
1005
 
1006
- // hide the box
1007
  Box.prototype.hide = function () {
1008
  return this.toggle(false);
1009
- };
 
1010
 
1011
- // calculate trigger height
1012
  Box.prototype.calculateTriggerHeight = function () {
1013
  var triggerHeight = 0;
1014
 
1015
  if (this.config.trigger) {
1016
  if (this.config.trigger.method === 'element') {
1017
  var triggerElement = document.body.querySelector(this.config.trigger.value);
 
1018
  if (triggerElement) {
1019
  var offset = triggerElement.getBoundingClientRect();
1020
  triggerHeight = offset.top;
@@ -1035,37 +1024,37 @@ Box.prototype.fits = function () {
1035
  switch (this.config.screenWidthCondition.condition) {
1036
  case "larger":
1037
  return window.innerWidth > this.config.screenWidthCondition.value;
 
1038
  case "smaller":
1039
  return window.innerWidth < this.config.screenWidthCondition.value;
1040
- }
 
1041
 
1042
- // meh.. condition should be "smaller" or "larger", just return true.
1043
  return true;
1044
  };
1045
 
1046
  Box.prototype.onResize = function () {
1047
  this.triggerHeight = this.calculateTriggerHeight();
1048
  this.setCustomBoxStyling();
1049
- };
1050
 
1051
- // is this box enabled?
1052
- Box.prototype.mayAutoShow = function () {
1053
 
 
1054
  if (this.dismissed) {
1055
  return false;
1056
- }
 
1057
 
1058
- // check if box fits on given minimum screen width
1059
  if (!this.fits()) {
1060
  return false;
1061
- }
 
1062
 
1063
- // if trigger empty or error in calculating triggerHeight, return false
1064
  if (!this.config.trigger) {
1065
  return false;
1066
- }
 
1067
 
1068
- // rely on cookie value (show if not set, don't show if set)
1069
  return !this.cookieSet;
1070
  };
1071
 
@@ -1077,18 +1066,18 @@ Box.prototype.isCookieSet = function () {
1077
  // always show on test mode or when no auto-trigger is configured
1078
  if (this.config.testMode || !this.config.trigger) {
1079
  return false;
1080
- }
 
1081
 
1082
- // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.
1083
  if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {
1084
  return false;
1085
  }
1086
 
1087
  var cookieSet = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + 'boxzilla_box_' + this.id + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1") === "true";
1088
  return cookieSet;
1089
- };
 
1090
 
1091
- // set cookie that disables automatically showing the box
1092
  Box.prototype.setCookie = function (hours) {
1093
  var expiryDate = new Date();
1094
  expiryDate.setHours(expiryDate.getHours() + hours);
@@ -1097,35 +1086,36 @@ Box.prototype.setCookie = function (hours) {
1097
 
1098
  Box.prototype.trigger = function () {
1099
  var shown = this.show();
 
1100
  if (!shown) {
1101
  return;
1102
  }
1103
 
1104
  this.triggered = true;
 
1105
  if (this.config.cookie && this.config.cookie.triggered) {
1106
  this.setCookie(this.config.cookie.triggered);
1107
  }
1108
  };
1109
-
1110
  /**
1111
  * Dismisses the box and optionally sets a cookie.
1112
  *
1113
  * @param e The event that triggered this dismissal.
1114
  * @returns {boolean}
1115
  */
 
 
1116
  Box.prototype.dismiss = function (e) {
1117
  // prevent default action
1118
- e && e.preventDefault();
1119
 
1120
- // only dismiss box if it's currently open.
1121
  if (!this.visible) {
1122
  return false;
1123
- }
1124
 
1125
- // hide box element
1126
- this.hide();
1127
 
1128
- // set cookie
 
1129
  if (this.config.cookie && this.config.cookie.dismissed) {
1130
  this.setCookie(this.config.cookie.dismissed);
1131
  }
@@ -1157,256 +1147,247 @@ var EventEmitter = require('wolfy87-eventemitter'),
1157
  pageViews;
1158
 
1159
  function throttle(fn, threshhold, scope) {
1160
- threshhold || (threshhold = 250);
1161
- var last, deferTimer;
1162
- return function () {
1163
- var context = scope || this;
1164
-
1165
- var now = +new Date(),
1166
- args = arguments;
1167
- if (last && now < last + threshhold) {
1168
- // hold on to it
1169
- clearTimeout(deferTimer);
1170
- deferTimer = setTimeout(function () {
1171
- last = now;
1172
- fn.apply(context, args);
1173
- }, threshhold);
1174
- } else {
1175
- last = now;
1176
- fn.apply(context, args);
1177
- }
1178
- };
1179
- }
 
1180
 
1181
- // "keyup" listener
1182
  function onKeyUp(e) {
1183
- if (e.keyCode == 27) {
1184
- Boxzilla.dismiss();
1185
- }
1186
- }
 
1187
 
1188
- // check "pageviews" criteria for each box
1189
  function checkPageViewsCriteria() {
 
 
 
 
1190
 
1191
- // don't bother if another box is currently open
1192
- if (isAnyBoxVisible()) {
1193
- return;
1194
  }
1195
 
1196
- boxes.forEach(function (box) {
1197
- if (!box.mayAutoShow()) {
1198
- return;
1199
- }
 
1200
 
1201
- if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {
1202
- box.trigger();
1203
- }
1204
- });
1205
- }
1206
 
1207
- // check time trigger criteria for each box
1208
  function checkTimeCriteria() {
1209
- // don't bother if another box is currently open
1210
- if (isAnyBoxVisible()) {
1211
- return;
1212
- }
1213
 
1214
- boxes.forEach(function (box) {
1215
- if (!box.mayAutoShow()) {
1216
- return;
1217
- }
1218
 
1219
- // check "time on site" trigger
1220
- if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {
1221
- box.trigger();
1222
- }
1223
 
1224
- // check "time on page" trigger
1225
- if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {
1226
- box.trigger();
1227
- }
1228
- });
1229
- }
 
 
 
 
 
1230
 
1231
- // check triggerHeight criteria for all boxes
1232
  function checkHeightCriteria() {
 
 
 
 
 
 
1233
 
1234
- var scrollY = scrollElement.hasOwnProperty('pageYOffset') ? scrollElement.pageYOffset : scrollElement.scrollTop;
1235
- scrollY = scrollY + window.innerHeight * 0.9;
 
 
 
1236
 
1237
- boxes.forEach(function (box) {
1238
- if (!box.mayAutoShow() || box.triggerHeight <= 0) {
1239
- return;
1240
- }
1241
 
1242
- if (scrollY > box.triggerHeight) {
1243
- // don't bother if another box is currently open
1244
- if (isAnyBoxVisible()) {
1245
- return;
1246
- }
 
 
 
 
1247
 
1248
- // trigger box
1249
- box.trigger();
1250
- } else if (box.mayRehide()) {
1251
- box.hide();
1252
- }
1253
- });
1254
- }
1255
 
1256
- // recalculate heights and variables based on height
1257
  function recalculateHeights() {
1258
- boxes.forEach(function (box) {
1259
- box.onResize();
1260
- });
1261
  }
1262
 
1263
  function onOverlayClick(e) {
1264
- var x = e.offsetX;
1265
- var y = e.offsetY;
1266
 
1267
- // calculate if click was less than 40px outside box to avoid closing it by accident
1268
- boxes.forEach(function (box) {
1269
- var rect = box.element.getBoundingClientRect();
1270
- var margin = 40;
1271
 
1272
- // if click was not anywhere near box, dismiss it.
1273
- if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {
1274
- box.dismiss();
1275
- }
1276
- });
1277
  }
1278
 
1279
  function triggerExitIntent() {
1280
- // do nothing if already triggered OR another box is visible.
1281
- if (exitIntentTriggered || isAnyBoxVisible()) {
1282
- return;
1283
- }
1284
-
1285
- boxes.forEach(function (box) {
1286
- if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {
1287
- box.trigger();
1288
- }
1289
- });
1290
 
1291
- exitIntentTriggered = true;
 
 
 
 
 
1292
  }
1293
 
1294
  function onMouseLeave(e) {
1295
- var delay = 400;
1296
 
1297
- // did mouse leave at top of window?
1298
- if (e.clientY <= 0) {
1299
- exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);
1300
- }
1301
  }
1302
 
1303
  function isAnyBoxVisible() {
 
 
1304
 
1305
- for (var i = 0; i < boxes.length; i++) {
1306
- var box = boxes[i];
1307
-
1308
- if (box.visible) {
1309
- return true;
1310
- }
1311
  }
 
1312
 
1313
- return false;
1314
  }
1315
 
1316
  function onMouseEnter() {
1317
- if (exitIntentDelayTimer) {
1318
- window.clearInterval(exitIntentDelayTimer);
1319
- exitIntentDelayTimer = null;
1320
- }
1321
  }
1322
 
1323
  function onElementClick(e) {
1324
- // find <a> element in up to 3 parent elements
1325
- var el = e.target || e.srcElement;
1326
- var depth = 3;
1327
- for (var i = 0; i <= depth; i++) {
1328
- if (!el || el.tagName === 'A') {
1329
- break;
1330
- }
1331
 
1332
- el = el.parentElement;
 
 
1333
  }
1334
 
1335
- if (!el || el.tagName !== 'A' || !el.getAttribute('href')) {
1336
- return;
1337
- }
1338
 
1339
- if (el.getAttribute('href').toLowerCase().indexOf('#boxzilla-') === 0) {
1340
- var boxId = el.getAttribute('href').toLowerCase().substring("#boxzilla-".length);
1341
- Boxzilla.toggle(boxId);
1342
- }
 
 
 
 
1343
  }
1344
 
1345
  var timers = {
1346
- start: function start() {
1347
- try {
1348
- var sessionTime = sessionStorage.getItem('boxzilla_timer');
1349
- if (sessionTime) siteTimer.time = sessionTime;
1350
- } catch (e) {}
1351
- siteTimer.start();
1352
- pageTimer.start();
1353
- },
1354
- stop: function stop() {
1355
- sessionStorage.setItem('boxzilla_timer', siteTimer.time);
1356
- siteTimer.stop();
1357
- pageTimer.stop();
1358
- }
1359
- };
 
1360
 
1361
- // initialise & add event listeners
1362
  Boxzilla.init = function () {
1363
- document.body.addEventListener('click', onElementClick, true);
1364
-
1365
- try {
1366
- pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;
1367
- } catch (e) {
1368
- pageViews = 0;
1369
- }
1370
 
1371
- siteTimer = new Timer(0);
1372
- pageTimer = new Timer(0);
1373
-
1374
- // insert styles into DOM
1375
- var styles = require('./styles.js');
1376
- var styleElement = document.createElement('style');
1377
- styleElement.setAttribute("type", "text/css");
1378
- styleElement.innerHTML = styles;
1379
- document.head.appendChild(styleElement);
1380
-
1381
- // add overlay element to dom
1382
- overlay = document.createElement('div');
1383
- overlay.style.display = 'none';
1384
- overlay.id = 'boxzilla-overlay';
1385
- document.body.appendChild(overlay);
1386
-
1387
- // event binds
1388
- scrollElement.addEventListener('touchstart', throttle(checkHeightCriteria), true);
1389
- scrollElement.addEventListener('scroll', throttle(checkHeightCriteria), true);
1390
- window.addEventListener('resize', throttle(recalculateHeights));
1391
- window.addEventListener('load', recalculateHeights);
1392
- overlay.addEventListener('click', onOverlayClick);
1393
- window.setInterval(checkTimeCriteria, 1000);
1394
- window.setTimeout(checkPageViewsCriteria, 1000);
1395
- document.documentElement.addEventListener('mouseleave', onMouseLeave);
1396
- document.documentElement.addEventListener('mouseenter', onMouseEnter);
1397
- document.addEventListener('keyup', onKeyUp);
1398
-
1399
- timers.start();
1400
- window.addEventListener('focus', timers.start);
1401
- window.addEventListener('beforeunload', function () {
1402
- timers.stop();
1403
- sessionStorage.setItem('boxzilla_pageviews', ++pageViews);
1404
- });
1405
- window.addEventListener('blur', timers.stop);
1406
 
1407
- Boxzilla.trigger('ready');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1408
  };
1409
-
1410
  /**
1411
  * Create a new Box
1412
  *
@@ -1415,82 +1396,83 @@ Boxzilla.init = function () {
1415
  *
1416
  * @returns Box
1417
  */
1418
- Boxzilla.create = function (id, opts) {
1419
 
1420
- // preserve backwards compat for minimumScreenWidth option
1421
- if (typeof opts.minimumScreenWidth !== "undefined") {
1422
- opts.screenWidthCondition = {
1423
- condition: "larger",
1424
- value: opts.minimumScreenWidth
1425
- };
1426
- }
1427
 
1428
- var box = new Box(id, opts);
1429
- boxes.push(box);
1430
- return box;
 
 
 
 
 
 
 
 
 
1431
  };
1432
 
1433
  Boxzilla.get = function (id) {
1434
- for (var i = 0; i < boxes.length; i++) {
1435
- var box = boxes[i];
1436
- if (box.id == id) {
1437
- return box;
1438
- }
1439
  }
 
 
 
 
1440
 
1441
- throw new Error("No box exists with ID " + id);
1442
- };
1443
 
1444
- // dismiss a single box (or all by omitting id param)
1445
  Boxzilla.dismiss = function (id) {
1446
- // if no id given, dismiss all current open boxes
1447
- if (typeof id === "undefined") {
1448
- boxes.forEach(function (box) {
1449
- box.dismiss();
1450
- });
1451
- } else {
1452
- Boxzilla.get(id).dismiss();
1453
- }
1454
  };
1455
 
1456
  Boxzilla.hide = function (id) {
1457
- if (typeof id === "undefined") {
1458
- boxes.forEach(function (box) {
1459
- box.hide();
1460
- });
1461
- } else {
1462
- Boxzilla.get(id).hide();
1463
- }
1464
  };
1465
 
1466
  Boxzilla.show = function (id) {
1467
- if (typeof id === "undefined") {
1468
- boxes.forEach(function (box) {
1469
- box.show();
1470
- });
1471
- } else {
1472
- Boxzilla.get(id).show();
1473
- }
1474
  };
1475
 
1476
  Boxzilla.toggle = function (id) {
1477
- if (typeof id === "undefined") {
1478
- boxes.forEach(function (box) {
1479
- box.toggle();
1480
- });
1481
- } else {
1482
- Boxzilla.get(id).toggle();
1483
- }
1484
- };
 
1485
 
1486
- // expose each individual box.
1487
- Boxzilla.boxes = boxes;
1488
 
1489
- // expose boxzilla object
1490
  window.Boxzilla = Boxzilla;
1491
 
1492
  if (typeof module !== 'undefined' && module.exports) {
1493
- module.exports = Boxzilla;
1494
  }
1495
 
1496
  },{"./box.js":4,"./styles.js":6,"./timer.js":7,"wolfy87-eventemitter":2}],6:[function(require,module,exports){
@@ -1503,25 +1485,25 @@ module.exports = styles;
1503
  'use strict';
1504
 
1505
  var Timer = function Timer(start) {
1506
- this.time = start;
1507
- this.interval = 0;
1508
  };
1509
 
1510
  Timer.prototype.tick = function () {
1511
- this.time++;
1512
  };
1513
 
1514
  Timer.prototype.start = function () {
1515
- if (!this.interval) {
1516
- this.interval = window.setInterval(this.tick.bind(this), 1000);
1517
- }
1518
  };
1519
 
1520
  Timer.prototype.stop = function () {
1521
- if (this.interval) {
1522
- window.clearInterval(this.interval);
1523
- this.interval = 0;
1524
- }
1525
  };
1526
 
1527
  module.exports = Timer;
1
+ (function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
+ "use strict";
3
 
4
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
5
 
6
  (function () {
7
+ 'use strict';
8
 
9
+ var Boxzilla = require('boxzilla');
 
10
 
11
+ var options = window.boxzilla_options; // expose Boxzilla object to window
 
12
 
13
+ window.Boxzilla = Boxzilla; // helper function for setting CSS styles
 
 
 
 
14
 
15
+ function css(element, styles) {
16
+ if (styles.background_color) {
17
+ element.style.background = styles.background_color;
18
+ }
19
 
20
+ if (styles.color) {
21
+ element.style.color = styles.color;
22
+ }
23
 
24
+ if (styles.border_color) {
25
+ element.style.borderColor = styles.border_color;
26
+ }
27
 
28
+ if (styles.border_width) {
29
+ element.style.borderWidth = parseInt(styles.border_width) + "px";
30
+ }
31
 
32
+ if (styles.border_style) {
33
+ element.style.borderStyle = styles.border_style;
 
34
  }
35
 
36
+ if (styles.width) {
37
+ element.style.maxWidth = parseInt(styles.width) + "px";
38
+ }
39
+ }
40
 
41
+ function createBoxesFromConfig() {
42
+ // failsafe against including script twice.
43
+ if (options.inited) {
44
+ return;
45
+ } // create boxes from options
46
 
 
 
47
 
48
+ for (var key in options.boxes) {
49
+ // get opts
50
+ var boxOpts = options.boxes[key];
51
+ boxOpts.testMode = isLoggedIn && options.testMode; // find box content element, bail if not found
52
 
53
+ var boxContentElement = document.getElementById('boxzilla-box-' + boxOpts.id + '-content');
 
 
 
 
54
 
55
+ if (!boxContentElement) {
56
+ continue;
57
+ } // use element as content option
58
 
 
 
59
 
60
+ boxOpts.content = boxContentElement; // create box
 
61
 
62
+ var box = Boxzilla.create(boxOpts.id, boxOpts); // add box slug to box element as classname
 
63
 
64
+ box.element.className = box.element.className + ' boxzilla-' + boxOpts.post.slug; // add custom css to box
 
65
 
66
+ css(box.element, boxOpts.css);
67
+ box.element.firstChild.firstChild.className += " first-child";
68
+ box.element.firstChild.lastChild.className += " last-child"; // maybe show box right away
 
 
69
 
70
+ if (box.fits() && locationHashRefersBox(box)) {
71
+ box.show();
72
+ }
73
+ } // set flag to prevent initialising twice
74
 
 
 
75
 
76
+ options.inited = true; // trigger "done" event.
 
 
77
 
78
+ Boxzilla.trigger('done'); // maybe open box with MC4WP form in it
 
 
 
79
 
80
+ maybeOpenMailChimpForWordPressBox();
81
+ }
82
 
83
+ function locationHashRefersBox(box) {
84
+ if (!window.location.hash || 0 === window.location.hash.length) {
85
+ return false;
86
+ }
 
87
 
88
+ var elementId = window.location.hash.substring(1); // only attempt on strings looking like an ID
89
+
90
+ var regex = /^[a-zA-Z\-\_0-9]+$/;
 
 
91
 
92
+ if (!regex.test(elementId)) {
93
+ return false;
94
  }
95
 
96
+ if (elementId === box.element.id) {
97
+ return true;
98
+ } else if (box.element.querySelector('#' + elementId)) {
99
+ return true;
100
+ }
101
 
102
+ return false;
103
+ }
104
+
105
+ function maybeOpenMailChimpForWordPressBox() {
106
+ if (_typeof(window.mc4wp_forms_config) !== "object" || !window.mc4wp_forms_config.submitted_form) {
107
+ return;
 
 
 
 
 
 
108
  }
109
 
110
+ var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;
111
+ var boxes = Boxzilla.boxes;
112
+
113
+ for (var boxId in boxes) {
114
+ if (!boxes.hasOwnProperty(boxId)) {
115
+ continue;
116
+ }
117
+
118
+ var box = boxes[boxId];
119
+
120
+ if (box.element.querySelector(selector)) {
121
+ box.show();
122
+ return;
123
+ }
124
  }
125
+ } // print message when test mode is enabled
126
 
 
 
127
 
128
+ var isLoggedIn = document.body.className.indexOf('logged-in') > -1;
129
+
130
+ if (isLoggedIn && options.testMode) {
131
+ console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\'re done testing.');
132
+ } // init boxzilla
133
+
134
+
135
+ Boxzilla.init(); // on window.load, create DOM elements for boxes
136
+
137
+ window.addEventListener('load', createBoxesFromConfig);
138
  })();
139
 
140
  },{"boxzilla":5}],2:[function(require,module,exports){
614
  }.call(this));
615
 
616
  },{}],3:[function(require,module,exports){
617
+ "use strict";
618
 
619
  var duration = 320;
620
 
621
  function css(element, styles) {
622
+ for (var property in styles) {
623
+ element.style[property] = styles[property];
624
+ }
625
  }
626
 
627
  function initObjectProperties(properties, value) {
628
+ var newObject = {};
629
+
630
+ for (var i = 0; i < properties.length; i++) {
631
+ newObject[properties[i]] = value;
632
+ }
633
+
634
+ return newObject;
635
  }
636
 
637
  function copyObjectProperties(properties, object) {
638
+ var newObject = {};
 
 
 
 
 
639
 
640
+ for (var i = 0; i < properties.length; i++) {
641
+ newObject[properties[i]] = object[properties[i]];
642
+ }
643
+
644
+ return newObject;
645
+ }
646
  /**
647
  * Checks if the given element is currently being animated.
648
  *
649
  * @param element
650
  * @returns {boolean}
651
  */
652
+
653
+
654
  function animated(element) {
655
+ return !!element.getAttribute('data-animated');
656
  }
 
657
  /**
658
  * Toggles the element using the given animation.
659
  *
660
  * @param element
661
  * @param animation Either "fade" or "slide"
662
  */
663
+
664
+
665
  function toggle(element, animation, callbackFn) {
666
+ var nowVisible = element.style.display != 'none' || element.offsetLeft > 0; // create clone for reference
 
 
 
 
 
 
 
 
 
 
 
667
 
668
+ var clone = element.cloneNode(true);
 
669
 
670
+ var cleanup = function cleanup() {
671
+ element.removeAttribute('data-animated');
672
+ element.setAttribute('style', clone.getAttribute('style'));
673
+ element.style.display = nowVisible ? 'none' : '';
674
+
675
+ if (callbackFn) {
676
+ callbackFn();
677
  }
678
+ }; // store attribute so everyone knows we're animating this element
679
 
 
680
 
681
+ element.setAttribute('data-animated', "true"); // toggle element visiblity right away if we're making something visible
 
 
 
682
 
683
+ if (!nowVisible) {
684
+ element.style.display = '';
685
+ }
686
 
687
+ var hiddenStyles, visibleStyles; // animate properties
 
 
 
 
 
 
688
 
689
+ if (animation === 'slide') {
690
+ hiddenStyles = initObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 0);
691
+ visibleStyles = {};
692
+
693
+ if (!nowVisible) {
694
+ var computedStyles = window.getComputedStyle(element);
695
+ visibleStyles = copyObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], computedStyles); // in some browsers, getComputedStyle returns "auto" value. this falls back to getBoundingClientRect() in those browsers since we need an actual height.
 
 
696
 
697
+ if (!isFinite(visibleStyles.height)) {
698
+ var clientRect = element.getBoundingClientRect();
699
+ visibleStyles.height = clientRect.height;
700
+ }
701
+
702
+ css(element, hiddenStyles);
703
+ } // don't show a scrollbar during animation
704
+
705
+
706
+ element.style.overflowY = 'hidden';
707
+ animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);
708
+ } else {
709
+ hiddenStyles = {
710
+ opacity: 0
711
+ };
712
+ visibleStyles = {
713
+ opacity: 1
714
+ };
715
+
716
+ if (!nowVisible) {
717
+ css(element, hiddenStyles);
718
  }
719
+
720
+ animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);
721
+ }
722
  }
723
 
724
  function animate(element, targetStyles, fn) {
725
+ var last = +new Date();
726
+ var initialStyles = window.getComputedStyle(element);
727
+ var currentStyles = {};
728
+ var propSteps = {};
729
 
730
+ for (var property in targetStyles) {
731
+ // make sure we have an object filled with floats
732
+ targetStyles[property] = parseFloat(targetStyles[property]); // calculate step size & current value
 
 
 
 
733
 
734
+ var to = targetStyles[property];
735
+ var current = parseFloat(initialStyles[property]); // is there something to do?
 
 
 
736
 
737
+ if (current == to) {
738
+ delete targetStyles[property];
739
+ continue;
740
  }
741
 
742
+ propSteps[property] = (to - current) / duration; // points per second
743
+
744
+ currentStyles[property] = current;
745
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
746
 
747
+ var tick = function tick() {
748
+ var now = +new Date();
749
+ var timeSinceLastTick = now - last;
750
+ var done = true;
751
+ var step, to, increment, newValue;
752
 
753
+ for (var property in targetStyles) {
754
+ step = propSteps[property];
755
+ to = targetStyles[property];
756
+ increment = step * timeSinceLastTick;
757
+ newValue = currentStyles[property] + increment;
758
 
759
+ if (step > 0 && newValue >= to || step < 0 && newValue <= to) {
760
+ newValue = to;
761
+ } else {
762
+ done = false;
763
+ } // store new value
764
 
 
 
 
 
 
 
 
 
765
 
766
+ currentStyles[property] = newValue;
767
+ var suffix = property !== "opacity" ? "px" : "";
768
+ element.style[property] = newValue + suffix;
769
+ }
770
+
771
+ last = +new Date(); // keep going until we're done for all props
772
+
773
+ if (!done) {
774
+ window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);
775
+ } else {
776
+ // call callback
777
+ fn && fn();
778
+ }
779
+ };
780
+
781
+ tick();
782
  }
783
 
784
  module.exports = {
785
+ 'toggle': toggle,
786
+ 'animate': animate,
787
+ 'animated': animated
788
  };
789
 
790
  },{}],4:[function(require,module,exports){
804
  },
805
  Boxzilla,
806
  Animator = require('./animator.js');
 
807
  /**
808
  * Merge 2 objects, values of the latter overwriting the former.
809
  *
811
  * @param obj2
812
  * @returns {*}
813
  */
814
+
815
+
816
  function merge(obj1, obj2) {
817
  var obj3 = {};
818
+
819
  for (var attrname in obj1) {
820
  obj3[attrname] = obj1[attrname];
821
  }
822
+
823
  for (var attrname in obj2) {
824
  obj3[attrname] = obj2[attrname];
825
  }
826
+
827
  return obj3;
828
  }
 
829
  /**
830
  * Get the real height of entire document.
831
  * @returns {number}
832
  */
833
+
834
+
835
  function getDocumentHeight() {
836
  var body = document.body,
837
  html = document.documentElement;
 
838
  var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
 
839
  return height;
840
+ } // Box Object
841
+
842
 
 
843
  var Box = function Box(id, config) {
844
+ this.id = id; // store config values
845
 
846
+ this.config = merge(defaults, config); // store ref to overlay
 
847
 
848
+ this.overlay = document.getElementById('boxzilla-overlay'); // state
 
849
 
 
850
  this.visible = false;
851
  this.dismissed = false;
852
  this.triggered = false;
854
  this.cookieSet = this.isCookieSet();
855
  this.element = null;
856
  this.contentElement = null;
857
+ this.closeIcon = null; // create dom elements for this box
858
 
859
+ this.dom(); // further initialise the box
 
860
 
 
861
  this.events();
862
+ }; // initialise the box
863
+
864
 
 
865
  Box.prototype.events = function () {
866
+ var box = this; // attach event to "close" icon inside box
867
 
 
868
  if (this.closeIcon) {
869
  this.closeIcon.addEventListener('click', this.dismiss.bind(this));
870
  }
874
  Boxzilla.trigger('box.interactions.link', [box, e.target]);
875
  }
876
  }, false);
 
877
  this.element.addEventListener('submit', function (e) {
878
  box.setCookie();
879
  Boxzilla.trigger('box.interactions.form', [box, e.target]);
880
  }, false);
881
+ }; // generate dom elements for this box
882
+
883
 
 
884
  Box.prototype.dom = function () {
885
  var wrapper = document.createElement('div');
886
  wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';
 
887
  var box = document.createElement('div');
888
  box.setAttribute('id', 'boxzilla-' + this.id);
889
  box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;
890
  box.style.display = 'none';
891
  wrapper.appendChild(box);
 
892
  var content;
893
+
894
  if (typeof this.config.content === "string") {
895
  content = document.createElement('div');
896
  content.innerHTML = this.config.content;
897
  } else {
898
+ content = this.config.content; // make sure element is visible
899
 
 
900
  content.style.display = '';
901
  }
902
+
903
  content.className = 'boxzilla-content';
904
  box.appendChild(content);
905
 
914
  document.body.appendChild(wrapper);
915
  this.contentElement = content;
916
  this.element = box;
917
+ }; // set (calculate) custom box styling depending on box options
918
 
 
 
919
 
920
+ Box.prototype.setCustomBoxStyling = function () {
921
  // reset element to its initial state
922
  var origDisplay = this.element.style.display;
923
  this.element.style.display = '';
924
  this.element.style.overflowY = 'auto';
925
+ this.element.style.maxHeight = 'none'; // get new dimensions
926
 
 
927
  var windowHeight = window.innerHeight;
928
+ var boxHeight = this.element.clientHeight; // add scrollbar to box and limit height
929
 
 
930
  if (boxHeight > windowHeight) {
931
  this.element.style.maxHeight = windowHeight + "px";
932
  this.element.style.overflowY = 'scroll';
933
+ } // set new top margin for boxes which are centered
934
+
935
 
 
936
  if (this.config.position === 'center') {
937
  var newTopMargin = (windowHeight - boxHeight) / 2;
938
  newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;
940
  }
941
 
942
  this.element.style.display = origDisplay;
943
+ }; // toggle visibility of the box
944
 
 
 
945
 
946
+ Box.prototype.toggle = function (show) {
947
  // revert visibility if no explicit argument is given
948
  if (typeof show === "undefined") {
949
  show = !this.visible;
950
+ } // is box already at desired visibility?
951
+
952
 
 
953
  if (show === this.visible) {
954
  return false;
955
+ } // is box being animated?
956
+
957
 
 
958
  if (Animator.animated(this.element)) {
959
  return false;
960
+ } // if box should be hidden but is not closable, bail.
961
+
962
 
 
963
  if (!show && !this.config.closable) {
964
  return false;
965
+ } // set new visibility status
966
 
 
 
967
 
968
+ this.visible = show; // calculate new styling rules
 
969
 
970
+ this.setCustomBoxStyling(); // trigger event
971
+
972
+ Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]); // show or hide box using selected animation
973
 
 
974
  if (this.config.position === 'center') {
975
  this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');
976
  Animator.toggle(this.overlay, "fade");
980
  if (this.visible) {
981
  return;
982
  }
983
+
984
  this.contentElement.innerHTML = this.contentElement.innerHTML;
985
  }.bind(this));
 
986
  return true;
987
+ }; // show the box
988
+
989
 
 
990
  Box.prototype.show = function () {
991
  return this.toggle(true);
992
+ }; // hide the box
993
+
994
 
 
995
  Box.prototype.hide = function () {
996
  return this.toggle(false);
997
+ }; // calculate trigger height
998
+
999
 
 
1000
  Box.prototype.calculateTriggerHeight = function () {
1001
  var triggerHeight = 0;
1002
 
1003
  if (this.config.trigger) {
1004
  if (this.config.trigger.method === 'element') {
1005
  var triggerElement = document.body.querySelector(this.config.trigger.value);
1006
+
1007
  if (triggerElement) {
1008
  var offset = triggerElement.getBoundingClientRect();
1009
  triggerHeight = offset.top;
1024
  switch (this.config.screenWidthCondition.condition) {
1025
  case "larger":
1026
  return window.innerWidth > this.config.screenWidthCondition.value;
1027
+
1028
  case "smaller":
1029
  return window.innerWidth < this.config.screenWidthCondition.value;
1030
+ } // meh.. condition should be "smaller" or "larger", just return true.
1031
+
1032
 
 
1033
  return true;
1034
  };
1035
 
1036
  Box.prototype.onResize = function () {
1037
  this.triggerHeight = this.calculateTriggerHeight();
1038
  this.setCustomBoxStyling();
1039
+ }; // is this box enabled?
1040
 
 
 
1041
 
1042
+ Box.prototype.mayAutoShow = function () {
1043
  if (this.dismissed) {
1044
  return false;
1045
+ } // check if box fits on given minimum screen width
1046
+
1047
 
 
1048
  if (!this.fits()) {
1049
  return false;
1050
+ } // if trigger empty or error in calculating triggerHeight, return false
1051
+
1052
 
 
1053
  if (!this.config.trigger) {
1054
  return false;
1055
+ } // rely on cookie value (show if not set, don't show if set)
1056
+
1057
 
 
1058
  return !this.cookieSet;
1059
  };
1060
 
1066
  // always show on test mode or when no auto-trigger is configured
1067
  if (this.config.testMode || !this.config.trigger) {
1068
  return false;
1069
+ } // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.
1070
+
1071
 
 
1072
  if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {
1073
  return false;
1074
  }
1075
 
1076
  var cookieSet = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + 'boxzilla_box_' + this.id + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1") === "true";
1077
  return cookieSet;
1078
+ }; // set cookie that disables automatically showing the box
1079
+
1080
 
 
1081
  Box.prototype.setCookie = function (hours) {
1082
  var expiryDate = new Date();
1083
  expiryDate.setHours(expiryDate.getHours() + hours);
1086
 
1087
  Box.prototype.trigger = function () {
1088
  var shown = this.show();
1089
+
1090
  if (!shown) {
1091
  return;
1092
  }
1093
 
1094
  this.triggered = true;
1095
+
1096
  if (this.config.cookie && this.config.cookie.triggered) {
1097
  this.setCookie(this.config.cookie.triggered);
1098
  }
1099
  };
 
1100
  /**
1101
  * Dismisses the box and optionally sets a cookie.
1102
  *
1103
  * @param e The event that triggered this dismissal.
1104
  * @returns {boolean}
1105
  */
1106
+
1107
+
1108
  Box.prototype.dismiss = function (e) {
1109
  // prevent default action
1110
+ e && e.preventDefault(); // only dismiss box if it's currently open.
1111
 
 
1112
  if (!this.visible) {
1113
  return false;
1114
+ } // hide box element
1115
 
 
 
1116
 
1117
+ this.hide(); // set cookie
1118
+
1119
  if (this.config.cookie && this.config.cookie.dismissed) {
1120
  this.setCookie(this.config.cookie.dismissed);
1121
  }
1147
  pageViews;
1148
 
1149
  function throttle(fn, threshhold, scope) {
1150
+ threshhold || (threshhold = 250);
1151
+ var last, deferTimer;
1152
+ return function () {
1153
+ var context = scope || this;
1154
+ var now = +new Date(),
1155
+ args = arguments;
1156
+
1157
+ if (last && now < last + threshhold) {
1158
+ // hold on to it
1159
+ clearTimeout(deferTimer);
1160
+ deferTimer = setTimeout(function () {
1161
+ last = now;
1162
+ fn.apply(context, args);
1163
+ }, threshhold);
1164
+ } else {
1165
+ last = now;
1166
+ fn.apply(context, args);
1167
+ }
1168
+ };
1169
+ } // "keyup" listener
1170
+
1171
 
 
1172
  function onKeyUp(e) {
1173
+ if (e.keyCode == 27) {
1174
+ Boxzilla.dismiss();
1175
+ }
1176
+ } // check "pageviews" criteria for each box
1177
+
1178
 
 
1179
  function checkPageViewsCriteria() {
1180
+ // don't bother if another box is currently open
1181
+ if (isAnyBoxVisible()) {
1182
+ return;
1183
+ }
1184
 
1185
+ boxes.forEach(function (box) {
1186
+ if (!box.mayAutoShow()) {
1187
+ return;
1188
  }
1189
 
1190
+ if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {
1191
+ box.trigger();
1192
+ }
1193
+ });
1194
+ } // check time trigger criteria for each box
1195
 
 
 
 
 
 
1196
 
 
1197
  function checkTimeCriteria() {
1198
+ // don't bother if another box is currently open
1199
+ if (isAnyBoxVisible()) {
1200
+ return;
1201
+ }
1202
 
1203
+ boxes.forEach(function (box) {
1204
+ if (!box.mayAutoShow()) {
1205
+ return;
1206
+ } // check "time on site" trigger
1207
 
 
 
 
 
1208
 
1209
+ if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {
1210
+ box.trigger();
1211
+ } // check "time on page" trigger
1212
+
1213
+
1214
+ if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {
1215
+ box.trigger();
1216
+ }
1217
+ });
1218
+ } // check triggerHeight criteria for all boxes
1219
+
1220
 
 
1221
  function checkHeightCriteria() {
1222
+ var scrollY = scrollElement.hasOwnProperty('pageYOffset') ? scrollElement.pageYOffset : scrollElement.scrollTop;
1223
+ scrollY = scrollY + window.innerHeight * 0.9;
1224
+ boxes.forEach(function (box) {
1225
+ if (!box.mayAutoShow() || box.triggerHeight <= 0) {
1226
+ return;
1227
+ }
1228
 
1229
+ if (scrollY > box.triggerHeight) {
1230
+ // don't bother if another box is currently open
1231
+ if (isAnyBoxVisible()) {
1232
+ return;
1233
+ } // trigger box
1234
 
 
 
 
 
1235
 
1236
+ box.trigger();
1237
+ } // if box may auto-hide and scrollY is less than triggerHeight (with small margin of error), hide box
1238
+
1239
+
1240
+ if (box.mayRehide() && scrollY < box.triggerHeight - 5) {
1241
+ box.hide();
1242
+ }
1243
+ });
1244
+ } // recalculate heights and variables based on height
1245
 
 
 
 
 
 
 
 
1246
 
 
1247
  function recalculateHeights() {
1248
+ boxes.forEach(function (box) {
1249
+ box.onResize();
1250
+ });
1251
  }
1252
 
1253
  function onOverlayClick(e) {
1254
+ var x = e.offsetX;
1255
+ var y = e.offsetY; // calculate if click was less than 40px outside box to avoid closing it by accident
1256
 
1257
+ boxes.forEach(function (box) {
1258
+ var rect = box.element.getBoundingClientRect();
1259
+ var margin = 40; // if click was not anywhere near box, dismiss it.
 
1260
 
1261
+ if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {
1262
+ box.dismiss();
1263
+ }
1264
+ });
 
1265
  }
1266
 
1267
  function triggerExitIntent() {
1268
+ // do nothing if already triggered OR another box is visible.
1269
+ if (exitIntentTriggered || isAnyBoxVisible()) {
1270
+ return;
1271
+ }
 
 
 
 
 
 
1272
 
1273
+ boxes.forEach(function (box) {
1274
+ if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {
1275
+ box.trigger();
1276
+ }
1277
+ });
1278
+ exitIntentTriggered = true;
1279
  }
1280
 
1281
  function onMouseLeave(e) {
1282
+ var delay = 400; // did mouse leave at top of window?
1283
 
1284
+ if (e.clientY <= 0) {
1285
+ exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);
1286
+ }
 
1287
  }
1288
 
1289
  function isAnyBoxVisible() {
1290
+ for (var i = 0; i < boxes.length; i++) {
1291
+ var box = boxes[i];
1292
 
1293
+ if (box.visible) {
1294
+ return true;
 
 
 
 
1295
  }
1296
+ }
1297
 
1298
+ return false;
1299
  }
1300
 
1301
  function onMouseEnter() {
1302
+ if (exitIntentDelayTimer) {
1303
+ window.clearInterval(exitIntentDelayTimer);
1304
+ exitIntentDelayTimer = null;
1305
+ }
1306
  }
1307
 
1308
  function onElementClick(e) {
1309
+ // find <a> element in up to 3 parent elements
1310
+ var el = e.target || e.srcElement;
1311
+ var depth = 3;
 
 
 
 
1312
 
1313
+ for (var i = 0; i <= depth; i++) {
1314
+ if (!el || el.tagName === 'A') {
1315
+ break;
1316
  }
1317
 
1318
+ el = el.parentElement;
1319
+ }
 
1320
 
1321
+ if (!el || el.tagName !== 'A' || !el.getAttribute('href')) {
1322
+ return;
1323
+ }
1324
+
1325
+ if (el.getAttribute('href').toLowerCase().indexOf('#boxzilla-') === 0) {
1326
+ var boxId = el.getAttribute('href').toLowerCase().substring("#boxzilla-".length);
1327
+ Boxzilla.toggle(boxId);
1328
+ }
1329
  }
1330
 
1331
  var timers = {
1332
+ start: function start() {
1333
+ try {
1334
+ var sessionTime = sessionStorage.getItem('boxzilla_timer');
1335
+ if (sessionTime) siteTimer.time = sessionTime;
1336
+ } catch (e) {}
1337
+
1338
+ siteTimer.start();
1339
+ pageTimer.start();
1340
+ },
1341
+ stop: function stop() {
1342
+ sessionStorage.setItem('boxzilla_timer', siteTimer.time);
1343
+ siteTimer.stop();
1344
+ pageTimer.stop();
1345
+ }
1346
+ }; // initialise & add event listeners
1347
 
 
1348
  Boxzilla.init = function () {
1349
+ document.body.addEventListener('click', onElementClick, true);
 
 
 
 
 
 
1350
 
1351
+ try {
1352
+ pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;
1353
+ } catch (e) {
1354
+ pageViews = 0;
1355
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1356
 
1357
+ siteTimer = new Timer(0);
1358
+ pageTimer = new Timer(0); // insert styles into DOM
1359
+
1360
+ var styles = require('./styles.js');
1361
+
1362
+ var styleElement = document.createElement('style');
1363
+ styleElement.setAttribute("type", "text/css");
1364
+ styleElement.innerHTML = styles;
1365
+ document.head.appendChild(styleElement); // add overlay element to dom
1366
+
1367
+ overlay = document.createElement('div');
1368
+ overlay.style.display = 'none';
1369
+ overlay.id = 'boxzilla-overlay';
1370
+ document.body.appendChild(overlay); // event binds
1371
+
1372
+ scrollElement.addEventListener('touchstart', throttle(checkHeightCriteria), true);
1373
+ scrollElement.addEventListener('scroll', throttle(checkHeightCriteria), true);
1374
+ window.addEventListener('resize', throttle(recalculateHeights));
1375
+ window.addEventListener('load', recalculateHeights);
1376
+ overlay.addEventListener('click', onOverlayClick);
1377
+ window.setInterval(checkTimeCriteria, 1000);
1378
+ window.setTimeout(checkPageViewsCriteria, 1000);
1379
+ document.documentElement.addEventListener('mouseleave', onMouseLeave);
1380
+ document.documentElement.addEventListener('mouseenter', onMouseEnter);
1381
+ document.addEventListener('keyup', onKeyUp);
1382
+ timers.start();
1383
+ window.addEventListener('focus', timers.start);
1384
+ window.addEventListener('beforeunload', function () {
1385
+ timers.stop();
1386
+ sessionStorage.setItem('boxzilla_pageviews', ++pageViews);
1387
+ });
1388
+ window.addEventListener('blur', timers.stop);
1389
+ Boxzilla.trigger('ready');
1390
  };
 
1391
  /**
1392
  * Create a new Box
1393
  *
1396
  *
1397
  * @returns Box
1398
  */
 
1399
 
 
 
 
 
 
 
 
1400
 
1401
+ Boxzilla.create = function (id, opts) {
1402
+ // preserve backwards compat for minimumScreenWidth option
1403
+ if (typeof opts.minimumScreenWidth !== "undefined") {
1404
+ opts.screenWidthCondition = {
1405
+ condition: "larger",
1406
+ value: opts.minimumScreenWidth
1407
+ };
1408
+ }
1409
+
1410
+ var box = new Box(id, opts);
1411
+ boxes.push(box);
1412
+ return box;
1413
  };
1414
 
1415
  Boxzilla.get = function (id) {
1416
+ for (var i = 0; i < boxes.length; i++) {
1417
+ var box = boxes[i];
1418
+
1419
+ if (box.id == id) {
1420
+ return box;
1421
  }
1422
+ }
1423
+
1424
+ throw new Error("No box exists with ID " + id);
1425
+ }; // dismiss a single box (or all by omitting id param)
1426
 
 
 
1427
 
 
1428
  Boxzilla.dismiss = function (id) {
1429
+ // if no id given, dismiss all current open boxes
1430
+ if (typeof id === "undefined") {
1431
+ boxes.forEach(function (box) {
1432
+ box.dismiss();
1433
+ });
1434
+ } else {
1435
+ Boxzilla.get(id).dismiss();
1436
+ }
1437
  };
1438
 
1439
  Boxzilla.hide = function (id) {
1440
+ if (typeof id === "undefined") {
1441
+ boxes.forEach(function (box) {
1442
+ box.hide();
1443
+ });
1444
+ } else {
1445
+ Boxzilla.get(id).hide();
1446
+ }
1447
  };
1448
 
1449
  Boxzilla.show = function (id) {
1450
+ if (typeof id === "undefined") {
1451
+ boxes.forEach(function (box) {
1452
+ box.show();
1453
+ });
1454
+ } else {
1455
+ Boxzilla.get(id).show();
1456
+ }
1457
  };
1458
 
1459
  Boxzilla.toggle = function (id) {
1460
+ if (typeof id === "undefined") {
1461
+ boxes.forEach(function (box) {
1462
+ box.toggle();
1463
+ });
1464
+ } else {
1465
+ Boxzilla.get(id).toggle();
1466
+ }
1467
+ }; // expose each individual box.
1468
+
1469
 
1470
+ Boxzilla.boxes = boxes; // expose boxzilla object
 
1471
 
 
1472
  window.Boxzilla = Boxzilla;
1473
 
1474
  if (typeof module !== 'undefined' && module.exports) {
1475
+ module.exports = Boxzilla;
1476
  }
1477
 
1478
  },{"./box.js":4,"./styles.js":6,"./timer.js":7,"wolfy87-eventemitter":2}],6:[function(require,module,exports){
1485
  'use strict';
1486
 
1487
  var Timer = function Timer(start) {
1488
+ this.time = start;
1489
+ this.interval = 0;
1490
  };
1491
 
1492
  Timer.prototype.tick = function () {
1493
+ this.time++;
1494
  };
1495
 
1496
  Timer.prototype.start = function () {
1497
+ if (!this.interval) {
1498
+ this.interval = window.setInterval(this.tick.bind(this), 1000);
1499
+ }
1500
  };
1501
 
1502
  Timer.prototype.stop = function () {
1503
+ if (this.interval) {
1504
+ window.clearInterval(this.interval);
1505
+ this.interval = 0;
1506
+ }
1507
  };
1508
 
1509
  module.exports = Timer;
assets/js/script.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){var t=void 0,e=void 0;!function(){function e(i,n,o){function r(l,a){if(!n[l]){if(!i[l]){var c="function"==typeof t&&t;if(!a&&c)return c(l,!0);if(s)return s(l,!0);var d=new Error("Cannot find module '"+l+"'");throw d.code="MODULE_NOT_FOUND",d}var h=n[l]={exports:{}};i[l][0].call(h.exports,function(t){var e=i[l][1][t];return r(e||t)},h,h.exports,e,i,n,o)}return n[l].exports}for(var s="function"==typeof t&&t,l=0;l<o.length;l++)r(o[l]);return r}return e}()({1:[function(t,e,i){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(){function e(t,e){e.background_color&&(t.style.background=e.background_color),e.color&&(t.style.color=e.color),e.border_color&&(t.style.borderColor=e.border_color),e.border_width&&(t.style.borderWidth=parseInt(e.border_width)+"px"),e.border_style&&(t.style.borderStyle=e.border_style),e.width&&(t.style.maxWidth=parseInt(e.width)+"px")}var i=t("boxzilla"),o=window.boxzilla_options;window.Boxzilla=i;var r=document.body.className.indexOf("logged-in")>-1;r&&o.testMode&&console.log("Boxzilla: Test mode is enabled. Please disable test mode if you're done testing."),i.init(),window.addEventListener("load",function(){if(!o.inited){for(var t in o.boxes){var s=o.boxes[t];s.testMode=r&&o.testMode;var l=document.getElementById("boxzilla-box-"+s.id+"-content");if(l){s.content=l;var a=i.create(s.id,s);a.element.className=a.element.className+" boxzilla-"+s.post.slug,e(a.element,s.css),a.element.firstChild.firstChild.className+=" first-child",a.element.firstChild.lastChild.className+=" last-child",a.fits()&&function(t){if(!window.location.hash||0===window.location.hash.length)return!1;var e=window.location.hash.substring(1);return!!/^[a-zA-Z\-\_0-9]+$/.test(e)&&(e===t.element.id||!!t.element.querySelector("#"+e))}(a)&&a.show()}}o.inited=!0,i.trigger("done"),function(){if("object"===n(window.mc4wp_forms_config)&&window.mc4wp_forms_config.submitted_form){var t="#"+window.mc4wp_forms_config.submitted_form.element_id,e=i.boxes;for(var o in e)if(e.hasOwnProperty(o)){var r=e[o];if(r.element.querySelector(t))return void r.show()}}}()}})}()},{boxzilla:5}],2:[function(t,i,n){(function(){"use strict";function t(){}function n(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function o(t){return function(){return this[t].apply(this,arguments)}}var r=t.prototype,s=this,l=s.EventEmitter;r.getListeners=function(t){var e,i,n=this._getEvents();if(t instanceof RegExp){e={};for(i in n)n.hasOwnProperty(i)&&t.test(i)&&(e[i]=n[i])}else e=n[t]||(n[t]=[]);return e},r.flattenListeners=function(t){var e,i=[];for(e=0;e<t.length;e+=1)i.push(t[e].listener);return i},r.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&((e={})[t]=i),e||i},r.addListener=function(t,e){var i,o=this.getListenersAsObject(t),r="object"==typeof e;for(i in o)o.hasOwnProperty(i)&&-1===n(o[i],e)&&o[i].push(r?e:{listener:e,once:!1});return this},r.on=o("addListener"),r.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},r.once=o("addOnceListener"),r.defineEvent=function(t){return this.getListeners(t),this},r.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},r.removeListener=function(t,e){var i,o,r=this.getListenersAsObject(t);for(o in r)r.hasOwnProperty(o)&&-1!==(i=n(r[o],e))&&r[o].splice(i,1);return this},r.off=o("removeListener"),r.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},r.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},r.manipulateListeners=function(t,e,i){var n,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(n=i.length;n--;)r.call(this,e,i[n]);else for(n in e)e.hasOwnProperty(n)&&(o=e[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},r.removeEvent=function(t){var e,i=typeof t,n=this._getEvents();if("string"===i)delete n[t];else if(t instanceof RegExp)for(e in n)n.hasOwnProperty(e)&&t.test(e)&&delete n[e];else delete this._events;return this},r.removeAllListeners=o("removeEvent"),r.emitEvent=function(t,e){var i,n,o,r,s=this.getListenersAsObject(t);for(r in s)if(s.hasOwnProperty(r))for(o=(i=s[r].slice(0)).length;o--;)!0===(n=i[o]).once&&this.removeListener(t,n.listener),n.listener.apply(this,e||[])===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},r.trigger=o("emitEvent"),r.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},r.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},r._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},r._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return s.EventEmitter=l,t},"function"==typeof e&&e.amd?e(function(){return t}):"object"==typeof i&&i.exports?i.exports=t:s.EventEmitter=t}).call(this)},{}],3:[function(t,e,i){"use strict";function n(t,e){for(var i in e)t.style[i]=e[i]}function o(t,e,i){var n=+new Date,o=window.getComputedStyle(t),s={},l={};for(var a in e){e[a]=parseFloat(e[a]);var c=e[a],d=parseFloat(o[a]);d!=c?(l[a]=(c-d)/r,s[a]=d):delete e[a]}!function o(){var r,a,c,d,h=+new Date-n,f=!0;for(var u in e){r=l[u],a=e[u],c=r*h,d=s[u]+c,r>0&&d>=a||r<0&&d<=a?d=a:f=!1,s[u]=d;var g="opacity"!==u?"px":"";t.style[u]=d+g}n=+new Date,f?i&&i():window.requestAnimationFrame&&requestAnimationFrame(o)||setTimeout(o,32)}()}var r=320;e.exports={toggle:function(t,e,i){var r="none"!=t.style.display||t.offsetLeft>0,s=t.cloneNode(!0),l=function(){t.removeAttribute("data-animated"),t.setAttribute("style",s.getAttribute("style")),t.style.display=r?"none":"",i&&i()};t.setAttribute("data-animated","true"),r||(t.style.display="");var a,c;if("slide"===e){if(a=function(t,e){for(var i={},n=0;n<t.length;n++)i[t[n]]=e;return i}(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],0),c={},!r){if(c=function(t,e){for(var i={},n=0;n<t.length;n++)i[t[n]]=e[t[n]];return i}(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],window.getComputedStyle(t)),!isFinite(c.height)){var d=t.getBoundingClientRect();c.height=d.height}n(t,a)}t.style.overflowY="hidden",o(t,r?a:c,l)}else a={opacity:0},c={opacity:1},r||n(t,a),o(t,r?a:c,l)},animate:o,animated:function(t){return!!t.getAttribute("data-animated")}}},{}],4:[function(t,e,i){"use strict";var n,o={animation:"fade",rehide:!1,content:"",cookie:null,icon:"&times",screenWidthCondition:null,position:"center",testMode:!1,trigger:!1,closable:!0},r=t("./animator.js"),s=function(t,e){this.id=t,this.config=function(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i}(o,e),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.dismissed=!1,this.triggered=!1,this.triggerHeight=this.calculateTriggerHeight(),this.cookieSet=this.isCookieSet(),this.element=null,this.contentElement=null,this.closeIcon=null,this.dom(),this.events()};s.prototype.events=function(){var t=this;this.closeIcon&&this.closeIcon.addEventListener("click",this.dismiss.bind(this)),this.element.addEventListener("click",function(e){"A"===e.target.tagName&&n.trigger("box.interactions.link",[t,e.target])},!1),this.element.addEventListener("submit",function(e){t.setCookie(),n.trigger("box.interactions.form",[t,e.target])},!1)},s.prototype.dom=function(){var t=document.createElement("div");t.className="boxzilla-container boxzilla-"+this.config.position+"-container";var e=document.createElement("div");e.setAttribute("id","boxzilla-"+this.id),e.className="boxzilla boxzilla-"+this.id+" boxzilla-"+this.config.position,e.style.display="none",t.appendChild(e);var i;if("string"==typeof this.config.content?(i=document.createElement("div")).innerHTML=this.config.content:(i=this.config.content).style.display="",i.className="boxzilla-content",e.appendChild(i),this.config.closable&&this.config.icon){var n=document.createElement("span");n.className="boxzilla-close-icon",n.innerHTML=this.config.icon,e.appendChild(n),this.closeIcon=n}document.body.appendChild(t),this.contentElement=i,this.element=e},s.prototype.setCustomBoxStyling=function(){var t=this.element.style.display;this.element.style.display="",this.element.style.overflowY="auto",this.element.style.maxHeight="none";var e=window.innerHeight,i=this.element.clientHeight;if(i>e&&(this.element.style.maxHeight=e+"px",this.element.style.overflowY="scroll"),"center"===this.config.position){var n=(e-i)/2;n=n>=0?n:0,this.element.style.marginTop=n+"px"}this.element.style.display=t},s.prototype.toggle=function(t){return void 0===t&&(t=!this.visible),t!==this.visible&&(!r.animated(this.element)&&(!(!t&&!this.config.closable)&&(this.visible=t,this.setCustomBoxStyling(),n.trigger("box."+(t?"show":"hide"),[this]),"center"===this.config.position&&(this.overlay.classList.toggle("boxzilla-"+this.id+"-overlay"),r.toggle(this.overlay,"fade")),r.toggle(this.element,this.config.animation,function(){this.visible||(this.contentElement.innerHTML=this.contentElement.innerHTML)}.bind(this)),!0)))},s.prototype.show=function(){return this.toggle(!0)},s.prototype.hide=function(){return this.toggle(!1)},s.prototype.calculateTriggerHeight=function(){var t=0;if(this.config.trigger)if("element"===this.config.trigger.method){var e=document.body.querySelector(this.config.trigger.value);if(e){t=e.getBoundingClientRect().top}}else"percentage"===this.config.trigger.method&&(t=this.config.trigger.value/100*function(){var t=document.body,e=document.documentElement;return Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight)}());return t},s.prototype.fits=function(){if(!this.config.screenWidthCondition||!this.config.screenWidthCondition.value)return!0;switch(this.config.screenWidthCondition.condition){case"larger":return window.innerWidth>this.config.screenWidthCondition.value;case"smaller":return window.innerWidth<this.config.screenWidthCondition.value}return!0},s.prototype.onResize=function(){this.triggerHeight=this.calculateTriggerHeight(),this.setCustomBoxStyling()},s.prototype.mayAutoShow=function(){return!this.dismissed&&(!!this.fits()&&(!!this.config.trigger&&!this.cookieSet))},s.prototype.mayRehide=function(){return this.config.rehide&&this.triggered},s.prototype.isCookieSet=function(){if(this.config.testMode||!this.config.trigger)return!1;if(!this.config.cookie||!this.config.cookie.triggered&&!this.config.cookie.dismissed)return!1;return"true"===document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*boxzilla_box_"+this.id+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1")},s.prototype.setCookie=function(t){var e=new Date;e.setHours(e.getHours()+t),document.cookie="boxzilla_box_"+this.id+"=true; expires="+e.toUTCString()+"; path=/"},s.prototype.trigger=function(){this.show()&&(this.triggered=!0,this.config.cookie&&this.config.cookie.triggered&&this.setCookie(this.config.cookie.triggered))},s.prototype.dismiss=function(t){return t&&t.preventDefault(),!!this.visible&&(this.hide(),this.config.cookie&&this.config.cookie.dismissed&&this.setCookie(this.config.cookie.dismissed),this.dismissed=!0,n.trigger("box.dismiss",[this]),!0)},e.exports=function(t){return n=t,s}},{"./animator.js":3}],5:[function(t,e,i){"use strict";function n(t,e,i){e||(e=250);var n,o;return function(){var r=i||this,s=+new Date,l=arguments;n&&s<n+e?(clearTimeout(o),o=setTimeout(function(){n=s,t.apply(r,l)},e)):(n=s,t.apply(r,l))}}function o(t){27==t.keyCode&&E.dismiss()}function r(){f()||_.forEach(function(t){t.mayAutoShow()&&"pageviews"===t.config.trigger.method&&w>=t.config.trigger.value&&t.trigger()})}function s(){f()||_.forEach(function(t){t.mayAutoShow()&&("time_on_site"===t.config.trigger.method&&b.time>=t.config.trigger.value&&t.trigger(),"time_on_page"===t.config.trigger.method&&y.time>=t.config.trigger.value&&t.trigger())})}function l(){var t=C.hasOwnProperty("pageYOffset")?C.pageYOffset:C.scrollTop;t+=.9*window.innerHeight,_.forEach(function(e){if(e.mayAutoShow()&&!(e.triggerHeight<=0))if(t>e.triggerHeight){if(f())return;e.trigger()}else e.mayRehide()&&e.hide()})}function a(){_.forEach(function(t){t.onResize()})}function c(t){var e=t.offsetX,i=t.offsetY;_.forEach(function(t){var n=t.element.getBoundingClientRect();(e<n.left-40||e>n.right+40||i<n.top-40||i>n.bottom+40)&&t.dismiss()})}function d(){v||f()||(_.forEach(function(t){t.mayAutoShow()&&"exit_intent"===t.config.trigger.method&&t.trigger()}),v=!0)}function h(t){t.clientY<=0&&(p=window.setTimeout(d,400))}function f(){for(var t=0;t<_.length;t++){if(_[t].visible)return!0}return!1}function u(){p&&(window.clearInterval(p),p=null)}function g(t){for(var e=t.target||t.srcElement,i=0;i<=3&&(e&&"A"!==e.tagName);i++)e=e.parentElement;if(e&&"A"===e.tagName&&e.getAttribute("href")&&0===e.getAttribute("href").toLowerCase().indexOf("#boxzilla-")){var n=e.getAttribute("href").toLowerCase().substring("#boxzilla-".length);E.toggle(n)}}var m,p,v,b,y,w,x=t("wolfy87-eventemitter"),E=Object.create(x.prototype),z=t("./box.js")(E),L=t("./timer.js"),_=[],C=window,k=function(){try{var t=sessionStorage.getItem("boxzilla_timer");t&&(b.time=t)}catch(t){}b.start(),y.start()},S=function(){sessionStorage.setItem("boxzilla_timer",b.time),b.stop(),y.stop()};E.init=function(){document.body.addEventListener("click",g,!0);try{w=sessionStorage.getItem("boxzilla_pageviews")||0}catch(t){w=0}b=new L(0),y=new L(0);var e=t("./styles.js"),i=document.createElement("style");i.setAttribute("type","text/css"),i.innerHTML=e,document.head.appendChild(i),(m=document.createElement("div")).style.display="none",m.id="boxzilla-overlay",document.body.appendChild(m),C.addEventListener("touchstart",n(l),!0),C.addEventListener("scroll",n(l),!0),window.addEventListener("resize",n(a)),window.addEventListener("load",a),m.addEventListener("click",c),window.setInterval(s,1e3),window.setTimeout(r,1e3),document.documentElement.addEventListener("mouseleave",h),document.documentElement.addEventListener("mouseenter",u),document.addEventListener("keyup",o),k(),window.addEventListener("focus",k),window.addEventListener("beforeunload",function(){S(),sessionStorage.setItem("boxzilla_pageviews",++w)}),window.addEventListener("blur",S),E.trigger("ready")},E.create=function(t,e){void 0!==e.minimumScreenWidth&&(e.screenWidthCondition={condition:"larger",value:e.minimumScreenWidth});var i=new z(t,e);return _.push(i),i},E.get=function(t){for(var e=0;e<_.length;e++){var i=_[e];if(i.id==t)return i}throw new Error("No box exists with ID "+t)},E.dismiss=function(t){void 0===t?_.forEach(function(t){t.dismiss()}):E.get(t).dismiss()},E.hide=function(t){void 0===t?_.forEach(function(t){t.hide()}):E.get(t).hide()},E.show=function(t){void 0===t?_.forEach(function(t){t.show()}):E.get(t).show()},E.toggle=function(t){void 0===t?_.forEach(function(t){t.toggle()}):E.get(t).toggle()},E.boxes=_,window.Boxzilla=E,void 0!==e&&e.exports&&(e.exports=E)},{"./box.js":4,"./styles.js":6,"./timer.js":7,"wolfy87-eventemitter":2}],6:[function(t,e,i){"use strict";e.exports="#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}"},{}],7:[function(t,e,i){"use strict";var n=function(t){this.time=t,this.interval=0};n.prototype.tick=function(){this.time++},n.prototype.start=function(){this.interval||(this.interval=window.setInterval(this.tick.bind(this),1e3))},n.prototype.stop=function(){this.interval&&(window.clearInterval(this.interval),this.interval=0)},e.exports=n},{}]},{},[1])}();
2
  //# sourceMappingURL=script.min.js.map
1
+ !function(){var l=void 0;!function r(s,l,a){function c(e,t){if(!l[e]){if(!s[e]){var i=!1;if(!t&&i)return i(e,!0);if(d)return d(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var o=l[e]={exports:{}};s[e][0].call(o.exports,function(t){return c(s[e][1][t]||t)},o,o.exports,r,s,l,a)}return l[e].exports}for(var d=!1,t=0;t<a.length;t++)c(a[t]);return c}({1:[function(t,e,i){"use strict";function d(t){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(){var s=t("boxzilla"),l=window.boxzilla_options;function a(t){if(!window.location.hash||0===window.location.hash.length)return!1;var e=window.location.hash.substring(1);return!!/^[a-zA-Z\-\_0-9]+$/.test(e)&&(e===t.element.id||!!t.element.querySelector("#"+e))}window.Boxzilla=s;var c=-1<document.body.className.indexOf("logged-in");c&&l.testMode&&console.log("Boxzilla: Test mode is enabled. Please disable test mode if you're done testing."),s.init(),window.addEventListener("load",function(){if(!l.inited){for(var t in l.boxes){var e=l.boxes[t];e.testMode=c&&l.testMode;var i=document.getElementById("boxzilla-box-"+e.id+"-content");if(i){e.content=i;var n=s.create(e.id,e);n.element.className=n.element.className+" boxzilla-"+e.post.slug,o=n.element,(r=e.css).background_color&&(o.style.background=r.background_color),r.color&&(o.style.color=r.color),r.border_color&&(o.style.borderColor=r.border_color),r.border_width&&(o.style.borderWidth=parseInt(r.border_width)+"px"),r.border_style&&(o.style.borderStyle=r.border_style),r.width&&(o.style.maxWidth=parseInt(r.width)+"px"),n.element.firstChild.firstChild.className+=" first-child",n.element.firstChild.lastChild.className+=" last-child",n.fits()&&a(n)&&n.show()}}var o,r;l.inited=!0,s.trigger("done"),function(){if("object"===d(window.mc4wp_forms_config)&&window.mc4wp_forms_config.submitted_form){var t="#"+window.mc4wp_forms_config.submitted_form.element_id,e=s.boxes;for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];if(n.element.querySelector(t))return n.show()}}}()}})}()},{boxzilla:5}],2:[function(t,s,e){(function(){"use strict";function t(){}var e=t.prototype,i=this,n=i.EventEmitter;function r(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function o(t){return function(){return this[t].apply(this,arguments)}}e.getListeners=function(t){var e,i,n=this._getEvents();if(t instanceof RegExp)for(i in e={},n)n.hasOwnProperty(i)&&t.test(i)&&(e[i]=n[i]);else e=n[t]||(n[t]=[]);return e},e.flattenListeners=function(t){var e,i=[];for(e=0;e<t.length;e+=1)i.push(t[e].listener);return i},e.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&((e={})[t]=i),e||i},e.addListener=function(t,e){var i,n=this.getListenersAsObject(t),o="object"==typeof e;for(i in n)n.hasOwnProperty(i)&&-1===r(n[i],e)&&n[i].push(o?e:{listener:e,once:!1});return this},e.on=o("addListener"),e.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},e.once=o("addOnceListener"),e.defineEvent=function(t){return this.getListeners(t),this},e.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},e.removeListener=function(t,e){var i,n,o=this.getListenersAsObject(t);for(n in o)o.hasOwnProperty(n)&&-1!==(i=r(o[n],e))&&o[n].splice(i,1);return this},e.off=o("removeListener"),e.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},e.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},e.manipulateListeners=function(t,e,i){var n,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(n=i.length;n--;)r.call(this,e,i[n]);else for(n in e)e.hasOwnProperty(n)&&(o=e[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},e.removeEvent=function(t){var e,i=typeof t,n=this._getEvents();if("string"===i)delete n[t];else if(t instanceof RegExp)for(e in n)n.hasOwnProperty(e)&&t.test(e)&&delete n[e];else delete this._events;return this},e.removeAllListeners=o("removeEvent"),e.emitEvent=function(t,e){var i,n,o,r,s=this.getListenersAsObject(t);for(r in s)if(s.hasOwnProperty(r))for(o=(i=s[r].slice(0)).length;o--;)!0===(n=i[o]).once&&this.removeListener(t,n.listener),n.listener.apply(this,e||[])===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},e.trigger=o("emitEvent"),e.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},e.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},e._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},e._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return i.EventEmitter=n,t},"function"==typeof l&&l.amd?l(function(){return t}):"object"==typeof s&&s.exports?s.exports=t:i.EventEmitter=t}).call(this)},{}],3:[function(t,e,i){"use strict";var o=320;function c(t,e){for(var i in e)t.style[i]=e[i]}function d(c,d,h){var f=+new Date,t=window.getComputedStyle(c),u={},g={};for(var e in d){d[e]=parseFloat(d[e]);var i=d[e],n=parseFloat(t[e]);n!=i?(g[e]=(i-n)/o,u[e]=n):delete d[e]}!function t(){var e,i,n,o,r=+new Date-f,s=!0;for(var l in d){e=g[l],i=d[l],n=e*r,o=u[l]+n,0<e&&i<=o||e<0&&o<=i?o=i:s=!1,u[l]=o;var a="opacity"!==l?"px":"";c.style[l]=o+a}f=+new Date,s?h&&h():window.requestAnimationFrame&&requestAnimationFrame(t)||setTimeout(t,32)}()}e.exports={toggle:function(t,e,i){var n,o,r="none"!=t.style.display||0<t.offsetLeft,s=t.cloneNode(!0),l=function(){t.removeAttribute("data-animated"),t.setAttribute("style",s.getAttribute("style")),t.style.display=r?"none":"",i&&i()};if(t.setAttribute("data-animated","true"),r||(t.style.display=""),"slide"===e){if(n=function(t,e){for(var i={},n=0;n<t.length;n++)i[t[n]]=e;return i}(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],0),o={},!r){if(o=function(t,e){for(var i={},n=0;n<t.length;n++)i[t[n]]=e[t[n]];return i}(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],window.getComputedStyle(t)),!isFinite(o.height)){var a=t.getBoundingClientRect();o.height=a.height}c(t,n)}t.style.overflowY="hidden",d(t,r?n:o,l)}else n={opacity:0},o={opacity:1},r||c(t,n),d(t,r?n:o,l)},animate:d,animated:function(t){return!!t.getAttribute("data-animated")}}},{}],4:[function(t,e,i){"use strict";var n,o={animation:"fade",rehide:!1,content:"",cookie:null,icon:"&times",screenWidthCondition:null,position:"center",testMode:!1,trigger:!1,closable:!0},r=t("./animator.js");var s=function(t,e){this.id=t,this.config=function(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i}(o,e),this.overlay=document.getElementById("boxzilla-overlay"),this.visible=!1,this.dismissed=!1,this.triggered=!1,this.triggerHeight=this.calculateTriggerHeight(),this.cookieSet=this.isCookieSet(),this.element=null,this.contentElement=null,this.closeIcon=null,this.dom(),this.events()};s.prototype.events=function(){var e=this;this.closeIcon&&this.closeIcon.addEventListener("click",this.dismiss.bind(this)),this.element.addEventListener("click",function(t){"A"===t.target.tagName&&n.trigger("box.interactions.link",[e,t.target])},!1),this.element.addEventListener("submit",function(t){e.setCookie(),n.trigger("box.interactions.form",[e,t.target])},!1)},s.prototype.dom=function(){var t=document.createElement("div");t.className="boxzilla-container boxzilla-"+this.config.position+"-container";var e,i=document.createElement("div");if(i.setAttribute("id","boxzilla-"+this.id),i.className="boxzilla boxzilla-"+this.id+" boxzilla-"+this.config.position,i.style.display="none",t.appendChild(i),"string"==typeof this.config.content?(e=document.createElement("div")).innerHTML=this.config.content:(e=this.config.content).style.display="",e.className="boxzilla-content",i.appendChild(e),this.config.closable&&this.config.icon){var n=document.createElement("span");n.className="boxzilla-close-icon",n.innerHTML=this.config.icon,i.appendChild(n),this.closeIcon=n}document.body.appendChild(t),this.contentElement=e,this.element=i},s.prototype.setCustomBoxStyling=function(){var t=this.element.style.display;this.element.style.display="",this.element.style.overflowY="auto",this.element.style.maxHeight="none";var e=window.innerHeight,i=this.element.clientHeight;if(e<i&&(this.element.style.maxHeight=e+"px",this.element.style.overflowY="scroll"),"center"===this.config.position){var n=(e-i)/2;n=0<=n?n:0,this.element.style.marginTop=n+"px"}this.element.style.display=t},s.prototype.toggle=function(t){return void 0===t&&(t=!this.visible),t!==this.visible&&(!r.animated(this.element)&&(!(!t&&!this.config.closable)&&(this.visible=t,this.setCustomBoxStyling(),n.trigger("box."+(t?"show":"hide"),[this]),"center"===this.config.position&&(this.overlay.classList.toggle("boxzilla-"+this.id+"-overlay"),r.toggle(this.overlay,"fade")),r.toggle(this.element,this.config.animation,function(){this.visible||(this.contentElement.innerHTML=this.contentElement.innerHTML)}.bind(this)),!0)))},s.prototype.show=function(){return this.toggle(!0)},s.prototype.hide=function(){return this.toggle(!1)},s.prototype.calculateTriggerHeight=function(){var t,e,i=0;if(this.config.trigger)if("element"===this.config.trigger.method){var n=document.body.querySelector(this.config.trigger.value);if(n)i=n.getBoundingClientRect().top}else"percentage"===this.config.trigger.method&&(i=this.config.trigger.value/100*(t=document.body,e=document.documentElement,Math.max(t.scrollHeight,t.offsetHeight,e.clientHeight,e.scrollHeight,e.offsetHeight)));return i},s.prototype.fits=function(){if(!this.config.screenWidthCondition||!this.config.screenWidthCondition.value)return!0;switch(this.config.screenWidthCondition.condition){case"larger":return window.innerWidth>this.config.screenWidthCondition.value;case"smaller":return window.innerWidth<this.config.screenWidthCondition.value}return!0},s.prototype.onResize=function(){this.triggerHeight=this.calculateTriggerHeight(),this.setCustomBoxStyling()},s.prototype.mayAutoShow=function(){return!this.dismissed&&(!!this.fits()&&(!!this.config.trigger&&!this.cookieSet))},s.prototype.mayRehide=function(){return this.config.rehide&&this.triggered},s.prototype.isCookieSet=function(){return!(this.config.testMode||!this.config.trigger)&&(!(!this.config.cookie||!this.config.cookie.triggered&&!this.config.cookie.dismissed)&&"true"===document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*boxzilla_box_"+this.id+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))},s.prototype.setCookie=function(t){var e=new Date;e.setHours(e.getHours()+t),document.cookie="boxzilla_box_"+this.id+"=true; expires="+e.toUTCString()+"; path=/"},s.prototype.trigger=function(){this.show()&&(this.triggered=!0,this.config.cookie&&this.config.cookie.triggered&&this.setCookie(this.config.cookie.triggered))},s.prototype.dismiss=function(t){return t&&t.preventDefault(),!!this.visible&&(this.hide(),this.config.cookie&&this.config.cookie.dismissed&&this.setCookie(this.config.cookie.dismissed),this.dismissed=!0,n.trigger("box.dismiss",[this]),!0)},e.exports=function(t){return n=t,s}},{"./animator.js":3}],5:[function(i,t,e){"use strict";var n,o,r,s,l,a,c=i("wolfy87-eventemitter"),d=Object.create(c.prototype),h=i("./box.js")(d),f=i("./timer.js"),u=[],g=window;function m(n,o,r){var s,l;return o||(o=250),function(){var t=r||this,e=+new Date,i=arguments;s&&e<s+o?(clearTimeout(l),l=setTimeout(function(){s=e,n.apply(t,i)},o)):(s=e,n.apply(t,i))}}function p(t){27==t.keyCode&&d.dismiss()}function v(){L()||u.forEach(function(t){t.mayAutoShow()&&"pageviews"===t.config.trigger.method&&a>=t.config.trigger.value&&t.trigger()})}function b(){L()||u.forEach(function(t){t.mayAutoShow()&&("time_on_site"===t.config.trigger.method&&s.time>=t.config.trigger.value&&t.trigger(),"time_on_page"===t.config.trigger.method&&l.time>=t.config.trigger.value&&t.trigger())})}function y(){var e=g.hasOwnProperty("pageYOffset")?g.pageYOffset:g.scrollTop;e+=.9*window.innerHeight,u.forEach(function(t){if(t.mayAutoShow()&&!(t.triggerHeight<=0)){if(e>t.triggerHeight){if(L())return;t.trigger()}t.mayRehide()&&e<t.triggerHeight-5&&t.hide()}})}function w(){u.forEach(function(t){t.onResize()})}function x(t){var i=t.offsetX,n=t.offsetY;u.forEach(function(t){var e=t.element.getBoundingClientRect();(i<e.left-40||i>e.right+40||n<e.top-40||n>e.bottom+40)&&t.dismiss()})}function E(){r||L()||(u.forEach(function(t){t.mayAutoShow()&&"exit_intent"===t.config.trigger.method&&t.trigger()}),r=!0)}function z(t){t.clientY<=0&&(o=window.setTimeout(E,400))}function L(){for(var t=0;t<u.length;t++){if(u[t].visible)return!0}return!1}function _(){o&&(window.clearInterval(o),o=null)}function C(t){for(var e=t.target||t.srcElement,i=0;i<=3&&(e&&"A"!==e.tagName);i++)e=e.parentElement;if(e&&"A"===e.tagName&&e.getAttribute("href")&&0===e.getAttribute("href").toLowerCase().indexOf("#boxzilla-")){var n=e.getAttribute("href").toLowerCase().substring("#boxzilla-".length);d.toggle(n)}}var k=function(){try{var t=sessionStorage.getItem("boxzilla_timer");t&&(s.time=t)}catch(t){}s.start(),l.start()},S=function(){sessionStorage.setItem("boxzilla_timer",s.time),s.stop(),l.stop()};d.init=function(){document.body.addEventListener("click",C,!0);try{a=sessionStorage.getItem("boxzilla_pageviews")||0}catch(t){a=0}s=new f(0),l=new f(0);var t=i("./styles.js"),e=document.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),(n=document.createElement("div")).style.display="none",n.id="boxzilla-overlay",document.body.appendChild(n),g.addEventListener("touchstart",m(y),!0),g.addEventListener("scroll",m(y),!0),window.addEventListener("resize",m(w)),window.addEventListener("load",w),n.addEventListener("click",x),window.setInterval(b,1e3),window.setTimeout(v,1e3),document.documentElement.addEventListener("mouseleave",z),document.documentElement.addEventListener("mouseenter",_),document.addEventListener("keyup",p),k(),window.addEventListener("focus",k),window.addEventListener("beforeunload",function(){S(),sessionStorage.setItem("boxzilla_pageviews",++a)}),window.addEventListener("blur",S),d.trigger("ready")},d.create=function(t,e){void 0!==e.minimumScreenWidth&&(e.screenWidthCondition={condition:"larger",value:e.minimumScreenWidth});var i=new h(t,e);return u.push(i),i},d.get=function(t){for(var e=0;e<u.length;e++){var i=u[e];if(i.id==t)return i}throw new Error("No box exists with ID "+t)},d.dismiss=function(t){void 0===t?u.forEach(function(t){t.dismiss()}):d.get(t).dismiss()},d.hide=function(t){void 0===t?u.forEach(function(t){t.hide()}):d.get(t).hide()},d.show=function(t){void 0===t?u.forEach(function(t){t.show()}):d.get(t).show()},d.toggle=function(t){void 0===t?u.forEach(function(t){t.toggle()}):d.get(t).toggle()},d.boxes=u,window.Boxzilla=d,void 0!==t&&t.exports&&(t.exports=d)},{"./box.js":4,"./styles.js":6,"./timer.js":7,"wolfy87-eventemitter":2}],6:[function(t,e,i){"use strict";e.exports="#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}"},{}],7:[function(t,e,i){"use strict";var n=function(t){this.time=t,this.interval=0};n.prototype.tick=function(){this.time++},n.prototype.start=function(){this.interval||(this.interval=window.setInterval(this.tick.bind(this),1e3))},n.prototype.stop=function(){this.interval&&(window.clearInterval(this.interval),this.interval=0)},e.exports=n},{}]},{},[1])}();
2
  //# sourceMappingURL=script.min.js.map
assets/js/script.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["script.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","_typeof","Symbol","iterator","obj","constructor","prototype","css","element","styles","background_color","style","background","color","border_color","borderColor","border_width","borderWidth","parseInt","border_style","borderStyle","width","maxWidth","Boxzilla","options","window","boxzilla_options","isLoggedIn","document","body","className","indexOf","testMode","console","log","init","addEventListener","inited","key","boxes","boxOpts","boxContentElement","getElementById","id","content","box","create","post","slug","firstChild","lastChild","fits","location","hash","elementId","substring","test","querySelector","locationHashRefersBox","show","trigger","mc4wp_forms_config","submitted_form","selector","element_id","boxId","hasOwnProperty","maybeOpenMailChimpForWordPressBox","boxzilla","2","EventEmitter","indexOfListener","listeners","listener","alias","name","this","apply","arguments","proto","originalGlobalValue","getListeners","evt","response","events","_getEvents","RegExp","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","listenerIsWrapped","once","on","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","remove","value","single","multiple","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd","3","property","animate","targetStyles","fn","last","Date","initialStyles","getComputedStyle","currentStyles","propSteps","parseFloat","to","current","duration","tick","step","increment","newValue","timeSinceLastTick","done","suffix","requestAnimationFrame","setTimeout","toggle","animation","callbackFn","nowVisible","display","offsetLeft","clone","cloneNode","cleanup","removeAttribute","setAttribute","getAttribute","hiddenStyles","visibleStyles","properties","newObject","initObjectProperties","object","copyObjectProperties","isFinite","height","clientRect","getBoundingClientRect","overflowY","opacity","animated","4","defaults","rehide","cookie","icon","screenWidthCondition","position","closable","Animator","Box","config","obj1","obj2","obj3","attrname","merge","overlay","visible","dismissed","triggered","triggerHeight","calculateTriggerHeight","cookieSet","isCookieSet","contentElement","closeIcon","dom","dismiss","bind","target","tagName","setCookie","wrapper","createElement","appendChild","innerHTML","setCustomBoxStyling","origDisplay","maxHeight","windowHeight","innerHeight","boxHeight","clientHeight","newTopMargin","marginTop","classList","hide","method","triggerElement","top","html","documentElement","Math","max","scrollHeight","offsetHeight","getDocumentHeight","condition","innerWidth","onResize","mayAutoShow","mayRehide","replace","hours","expiryDate","setHours","getHours","toUTCString","preventDefault","_Boxzilla","./animator.js","5","throttle","threshhold","scope","deferTimer","context","now","clearTimeout","onKeyUp","keyCode","checkPageViewsCriteria","isAnyBoxVisible","forEach","pageViews","checkTimeCriteria","siteTimer","time","pageTimer","checkHeightCriteria","scrollY","scrollElement","pageYOffset","scrollTop","recalculateHeights","onOverlayClick","x","offsetX","y","offsetY","rect","left","right","bottom","triggerExitIntent","exitIntentTriggered","onMouseLeave","clientY","exitIntentDelayTimer","onMouseEnter","clearInterval","onElementClick","el","srcElement","parentElement","toLowerCase","Object","Timer","timers","sessionTime","sessionStorage","getItem","start","setItem","stop","styleElement","head","setInterval","opts","minimumScreenWidth","get","./box.js","./styles.js","./timer.js","wolfy87-eventemitter","6","7","interval"],"mappings":"CAAA,WAAe,IAAIA,OAAUC,EAAgEC,OAASD,GAAW,WAAY,SAASE,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAkB,mBAATV,GAAqBA,EAAQ,IAAIS,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EAAEG,IAAIQ,YAAYZ,EAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,IAAIE,EAAED,EAAEI,GAAG,GAAGL,GAAG,OAAOI,EAAEF,GAAIF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGQ,QAAkD,IAAI,IAA1CL,EAAkB,mBAATX,GAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAAE,OAAOJ,EAA3c,EAAA,EAAkdgB,GAAG,SAASnB,EAAQoB,EAAOJ,GA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AW,GAGpBpB,EAAM9R,UAAUsI,KAAO,WACnBhE,KAAK0L,QAGT8B,EAAM9R,UAAUmS,MAAQ,WACf7N,KAAK4O,WACN5O,KAAK4O,SAAW/R,OAAOqR,YAAYlO,KAAKgE,KAAK+D,KAAK/H,MAAO,OAIjEwN,EAAM9R,UAAUqS,KAAO,WACf/N,KAAK4O,WACL/R,OAAOoQ,cAAcjN,KAAK4O,UAC1B5O,KAAK4O,SAAW,IAIxBxT,EAAOJ,QAAUwS,YAEN,IAx/CX","file":"script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){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}return e})()({1:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n(function () {\n 'use strict';\n\n var Boxzilla = require('boxzilla');\n var options = window.boxzilla_options;\n\n // expose Boxzilla object to window\n window.Boxzilla = Boxzilla;\n\n // helper function for setting CSS styles\n function css(element, styles) {\n if (styles.background_color) {\n element.style.background = styles.background_color;\n }\n\n if (styles.color) {\n element.style.color = styles.color;\n }\n\n if (styles.border_color) {\n element.style.borderColor = styles.border_color;\n }\n\n if (styles.border_width) {\n element.style.borderWidth = parseInt(styles.border_width) + \"px\";\n }\n\n if (styles.border_style) {\n element.style.borderStyle = styles.border_style;\n }\n\n if (styles.width) {\n element.style.maxWidth = parseInt(styles.width) + \"px\";\n }\n }\n\n function createBoxesFromConfig() {\n\n // failsafe against including script twice.\n if (options.inited) {\n return;\n }\n\n // create boxes from options\n for (var key in options.boxes) {\n\n // get opts\n var boxOpts = options.boxes[key];\n boxOpts.testMode = isLoggedIn && options.testMode;\n\n // find box content element, bail if not found\n var boxContentElement = document.getElementById('boxzilla-box-' + boxOpts.id + '-content');\n if (!boxContentElement) {\n continue;\n }\n\n // use element as content option\n boxOpts.content = boxContentElement;\n\n // create box\n var box = Boxzilla.create(boxOpts.id, boxOpts);\n\n // add box slug to box element as classname\n box.element.className = box.element.className + ' boxzilla-' + boxOpts.post.slug;\n\n // add custom css to box\n css(box.element, boxOpts.css);\n\n box.element.firstChild.firstChild.className += \" first-child\";\n box.element.firstChild.lastChild.className += \" last-child\";\n\n // maybe show box right away\n if (box.fits() && locationHashRefersBox(box)) {\n box.show();\n }\n }\n\n // set flag to prevent initialising twice\n options.inited = true;\n\n // trigger \"done\" event.\n Boxzilla.trigger('done');\n\n // maybe open box with MC4WP form in it\n maybeOpenMailChimpForWordPressBox();\n }\n\n function locationHashRefersBox(box) {\n if (!window.location.hash || 0 === window.location.hash.length) {\n return false;\n }\n\n var elementId = window.location.hash.substring(1);\n\n // only attempt on strings looking like an ID \n var regex = /^[a-zA-Z\\-\\_0-9]+$/;\n if (!regex.test(elementId)) {\n return false;\n }\n\n if (elementId === box.element.id) {\n return true;\n } else if (box.element.querySelector('#' + elementId)) {\n return true;\n }\n\n return false;\n }\n\n function maybeOpenMailChimpForWordPressBox() {\n if (_typeof(window.mc4wp_forms_config) !== \"object\" || !window.mc4wp_forms_config.submitted_form) {\n return;\n }\n\n var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;\n var boxes = Boxzilla.boxes;\n for (var boxId in boxes) {\n if (!boxes.hasOwnProperty(boxId)) {\n continue;\n }\n var box = boxes[boxId];\n if (box.element.querySelector(selector)) {\n box.show();\n return;\n }\n }\n }\n\n // print message when test mode is enabled\n var isLoggedIn = document.body.className.indexOf('logged-in') > -1;\n if (isLoggedIn && options.testMode) {\n console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\\'re done testing.');\n }\n\n // init boxzilla\n Boxzilla.init();\n\n // on window.load, create DOM elements for boxes\n window.addEventListener('load', createBoxesFromConfig);\n})();\n\n},{\"boxzilla\":5}],2:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar duration = 320;\n\nfunction css(element, styles) {\n for (var property in styles) {\n element.style[property] = styles[property];\n }\n}\n\nfunction initObjectProperties(properties, value) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = value;\n }\n return newObject;\n}\n\nfunction copyObjectProperties(properties, object) {\n var newObject = {};\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = object[properties[i]];\n }\n return newObject;\n}\n\n/**\n * Checks if the given element is currently being animated.\n *\n * @param element\n * @returns {boolean}\n */\nfunction animated(element) {\n return !!element.getAttribute('data-animated');\n}\n\n/**\n * Toggles the element using the given animation.\n *\n * @param element\n * @param animation Either \"fade\" or \"slide\"\n */\nfunction toggle(element, animation, callbackFn) {\n var nowVisible = element.style.display != 'none' || element.offsetLeft > 0;\n\n // create clone for reference\n var clone = element.cloneNode(true);\n var cleanup = function cleanup() {\n element.removeAttribute('data-animated');\n element.setAttribute('style', clone.getAttribute('style'));\n element.style.display = nowVisible ? 'none' : '';\n if (callbackFn) {\n callbackFn();\n }\n };\n\n // store attribute so everyone knows we're animating this element\n element.setAttribute('data-animated', \"true\");\n\n // toggle element visiblity right away if we're making something visible\n if (!nowVisible) {\n element.style.display = '';\n }\n\n var hiddenStyles, visibleStyles;\n\n // animate properties\n if (animation === 'slide') {\n hiddenStyles = initObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], 0);\n visibleStyles = {};\n\n if (!nowVisible) {\n var computedStyles = window.getComputedStyle(element);\n visibleStyles = copyObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], computedStyles);\n\n // in some browsers, getComputedStyle returns \"auto\" value. this falls back to getBoundingClientRect() in those browsers since we need an actual height.\n if (!isFinite(visibleStyles.height)) {\n var clientRect = element.getBoundingClientRect();\n visibleStyles.height = clientRect.height;\n }\n css(element, hiddenStyles);\n }\n\n // don't show a scrollbar during animation\n element.style.overflowY = 'hidden';\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n } else {\n hiddenStyles = { opacity: 0 };\n visibleStyles = { opacity: 1 };\n if (!nowVisible) {\n css(element, hiddenStyles);\n }\n\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n }\n}\n\nfunction animate(element, targetStyles, fn) {\n var last = +new Date();\n var initialStyles = window.getComputedStyle(element);\n var currentStyles = {};\n var propSteps = {};\n\n for (var property in targetStyles) {\n // make sure we have an object filled with floats\n targetStyles[property] = parseFloat(targetStyles[property]);\n\n // calculate step size & current value\n var to = targetStyles[property];\n var current = parseFloat(initialStyles[property]);\n\n // is there something to do?\n if (current == to) {\n delete targetStyles[property];\n continue;\n }\n\n propSteps[property] = (to - current) / duration; // points per second\n currentStyles[property] = current;\n }\n\n var tick = function tick() {\n var now = +new Date();\n var timeSinceLastTick = now - last;\n var done = true;\n\n var step, to, increment, newValue;\n for (var property in targetStyles) {\n step = propSteps[property];\n to = targetStyles[property];\n increment = step * timeSinceLastTick;\n newValue = currentStyles[property] + increment;\n\n if (step > 0 && newValue >= to || step < 0 && newValue <= to) {\n newValue = to;\n } else {\n done = false;\n }\n\n // store new value\n currentStyles[property] = newValue;\n\n var suffix = property !== \"opacity\" ? \"px\" : \"\";\n element.style[property] = newValue + suffix;\n }\n\n last = +new Date();\n\n // keep going until we're done for all props\n if (!done) {\n window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);\n } else {\n // call callback\n fn && fn();\n }\n };\n\n tick();\n}\n\nmodule.exports = {\n 'toggle': toggle,\n 'animate': animate,\n 'animated': animated\n};\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar defaults = {\n 'animation': 'fade',\n 'rehide': false,\n 'content': '',\n 'cookie': null,\n 'icon': '&times',\n 'screenWidthCondition': null,\n 'position': 'center',\n 'testMode': false,\n 'trigger': false,\n 'closable': true\n},\n Boxzilla,\n Animator = require('./animator.js');\n\n/**\n* Merge 2 objects, values of the latter overwriting the former.\n*\n* @param obj1\n* @param obj2\n* @returns {*}\n*/\nfunction merge(obj1, obj2) {\n var obj3 = {};\n for (var attrname in obj1) {\n obj3[attrname] = obj1[attrname];\n }\n for (var attrname in obj2) {\n obj3[attrname] = obj2[attrname];\n }\n return obj3;\n}\n\n/**\n* Get the real height of entire document.\n* @returns {number}\n*/\nfunction getDocumentHeight() {\n var body = document.body,\n html = document.documentElement;\n\n var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n\n return height;\n}\n\n// Box Object\nvar Box = function Box(id, config) {\n this.id = id;\n\n // store config values\n this.config = merge(defaults, config);\n\n // store ref to overlay\n this.overlay = document.getElementById('boxzilla-overlay');\n\n // state\n this.visible = false;\n this.dismissed = false;\n this.triggered = false;\n this.triggerHeight = this.calculateTriggerHeight();\n this.cookieSet = this.isCookieSet();\n this.element = null;\n this.contentElement = null;\n this.closeIcon = null;\n\n // create dom elements for this box\n this.dom();\n\n // further initialise the box\n this.events();\n};\n\n// initialise the box\nBox.prototype.events = function () {\n var box = this;\n\n // attach event to \"close\" icon inside box\n if (this.closeIcon) {\n this.closeIcon.addEventListener('click', this.dismiss.bind(this));\n }\n\n this.element.addEventListener('click', function (e) {\n if (e.target.tagName === 'A') {\n Boxzilla.trigger('box.interactions.link', [box, e.target]);\n }\n }, false);\n\n this.element.addEventListener('submit', function (e) {\n box.setCookie();\n Boxzilla.trigger('box.interactions.form', [box, e.target]);\n }, false);\n};\n\n// generate dom elements for this box\nBox.prototype.dom = function () {\n var wrapper = document.createElement('div');\n wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';\n\n var box = document.createElement('div');\n box.setAttribute('id', 'boxzilla-' + this.id);\n box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;\n box.style.display = 'none';\n wrapper.appendChild(box);\n\n var content;\n if (typeof this.config.content === \"string\") {\n content = document.createElement('div');\n content.innerHTML = this.config.content;\n } else {\n content = this.config.content;\n\n // make sure element is visible\n content.style.display = '';\n }\n content.className = 'boxzilla-content';\n box.appendChild(content);\n\n if (this.config.closable && this.config.icon) {\n var closeIcon = document.createElement('span');\n closeIcon.className = \"boxzilla-close-icon\";\n closeIcon.innerHTML = this.config.icon;\n box.appendChild(closeIcon);\n this.closeIcon = closeIcon;\n }\n\n document.body.appendChild(wrapper);\n this.contentElement = content;\n this.element = box;\n};\n\n// set (calculate) custom box styling depending on box options\nBox.prototype.setCustomBoxStyling = function () {\n\n // reset element to its initial state\n var origDisplay = this.element.style.display;\n this.element.style.display = '';\n this.element.style.overflowY = 'auto';\n this.element.style.maxHeight = 'none';\n\n // get new dimensions\n var windowHeight = window.innerHeight;\n var boxHeight = this.element.clientHeight;\n\n // add scrollbar to box and limit height\n if (boxHeight > windowHeight) {\n this.element.style.maxHeight = windowHeight + \"px\";\n this.element.style.overflowY = 'scroll';\n }\n\n // set new top margin for boxes which are centered\n if (this.config.position === 'center') {\n var newTopMargin = (windowHeight - boxHeight) / 2;\n newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;\n this.element.style.marginTop = newTopMargin + \"px\";\n }\n\n this.element.style.display = origDisplay;\n};\n\n// toggle visibility of the box\nBox.prototype.toggle = function (show) {\n\n // revert visibility if no explicit argument is given\n if (typeof show === \"undefined\") {\n show = !this.visible;\n }\n\n // is box already at desired visibility?\n if (show === this.visible) {\n return false;\n }\n\n // is box being animated?\n if (Animator.animated(this.element)) {\n return false;\n }\n\n // if box should be hidden but is not closable, bail.\n if (!show && !this.config.closable) {\n return false;\n }\n\n // set new visibility status\n this.visible = show;\n\n // calculate new styling rules\n this.setCustomBoxStyling();\n\n // trigger event\n Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]);\n\n // show or hide box using selected animation\n if (this.config.position === 'center') {\n this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');\n Animator.toggle(this.overlay, \"fade\");\n }\n\n Animator.toggle(this.element, this.config.animation, function () {\n if (this.visible) {\n return;\n }\n this.contentElement.innerHTML = this.contentElement.innerHTML;\n }.bind(this));\n\n return true;\n};\n\n// show the box\nBox.prototype.show = function () {\n return this.toggle(true);\n};\n\n// hide the box\nBox.prototype.hide = function () {\n return this.toggle(false);\n};\n\n// calculate trigger height\nBox.prototype.calculateTriggerHeight = function () {\n var triggerHeight = 0;\n\n if (this.config.trigger) {\n if (this.config.trigger.method === 'element') {\n var triggerElement = document.body.querySelector(this.config.trigger.value);\n if (triggerElement) {\n var offset = triggerElement.getBoundingClientRect();\n triggerHeight = offset.top;\n }\n } else if (this.config.trigger.method === 'percentage') {\n triggerHeight = this.config.trigger.value / 100 * getDocumentHeight();\n }\n }\n\n return triggerHeight;\n};\n\nBox.prototype.fits = function () {\n if (!this.config.screenWidthCondition || !this.config.screenWidthCondition.value) {\n return true;\n }\n\n switch (this.config.screenWidthCondition.condition) {\n case \"larger\":\n return window.innerWidth > this.config.screenWidthCondition.value;\n case \"smaller\":\n return window.innerWidth < this.config.screenWidthCondition.value;\n }\n\n // meh.. condition should be \"smaller\" or \"larger\", just return true.\n return true;\n};\n\nBox.prototype.onResize = function () {\n this.triggerHeight = this.calculateTriggerHeight();\n this.setCustomBoxStyling();\n};\n\n// is this box enabled?\nBox.prototype.mayAutoShow = function () {\n\n if (this.dismissed) {\n return false;\n }\n\n // check if box fits on given minimum screen width\n if (!this.fits()) {\n return false;\n }\n\n // if trigger empty or error in calculating triggerHeight, return false\n if (!this.config.trigger) {\n return false;\n }\n\n // rely on cookie value (show if not set, don't show if set)\n return !this.cookieSet;\n};\n\nBox.prototype.mayRehide = function () {\n return this.config.rehide && this.triggered;\n};\n\nBox.prototype.isCookieSet = function () {\n // always show on test mode or when no auto-trigger is configured\n if (this.config.testMode || !this.config.trigger) {\n return false;\n }\n\n // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.\n if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {\n return false;\n }\n\n var cookieSet = document.cookie.replace(new RegExp(\"(?:(?:^|.*;)\\\\s*\" + 'boxzilla_box_' + this.id + \"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"), \"$1\") === \"true\";\n return cookieSet;\n};\n\n// set cookie that disables automatically showing the box\nBox.prototype.setCookie = function (hours) {\n var expiryDate = new Date();\n expiryDate.setHours(expiryDate.getHours() + hours);\n document.cookie = 'boxzilla_box_' + this.id + '=true; expires=' + expiryDate.toUTCString() + '; path=/';\n};\n\nBox.prototype.trigger = function () {\n var shown = this.show();\n if (!shown) {\n return;\n }\n\n this.triggered = true;\n if (this.config.cookie && this.config.cookie.triggered) {\n this.setCookie(this.config.cookie.triggered);\n }\n};\n\n/**\n* Dismisses the box and optionally sets a cookie.\n*\n* @param e The event that triggered this dismissal.\n* @returns {boolean}\n*/\nBox.prototype.dismiss = function (e) {\n // prevent default action\n e && e.preventDefault();\n\n // only dismiss box if it's currently open.\n if (!this.visible) {\n return false;\n }\n\n // hide box element\n this.hide();\n\n // set cookie\n if (this.config.cookie && this.config.cookie.dismissed) {\n this.setCookie(this.config.cookie.dismissed);\n }\n\n this.dismissed = true;\n Boxzilla.trigger('box.dismiss', [this]);\n return true;\n};\n\nmodule.exports = function (_Boxzilla) {\n Boxzilla = _Boxzilla;\n return Box;\n};\n\n},{\"./animator.js\":3}],5:[function(require,module,exports){\n'use strict';\n\nvar EventEmitter = require('wolfy87-eventemitter'),\n Boxzilla = Object.create(EventEmitter.prototype),\n Box = require('./box.js')(Boxzilla),\n Timer = require('./timer.js'),\n boxes = [],\n overlay,\n scrollElement = window,\n exitIntentDelayTimer,\n exitIntentTriggered,\n siteTimer,\n pageTimer,\n pageViews;\n\nfunction throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n var last, deferTimer;\n return function () {\n var context = scope || this;\n\n var now = +new Date(),\n args = arguments;\n if (last && now < last + threshhold) {\n // hold on to it\n clearTimeout(deferTimer);\n deferTimer = setTimeout(function () {\n last = now;\n fn.apply(context, args);\n }, threshhold);\n } else {\n last = now;\n fn.apply(context, args);\n }\n };\n}\n\n// \"keyup\" listener\nfunction onKeyUp(e) {\n if (e.keyCode == 27) {\n Boxzilla.dismiss();\n }\n}\n\n// check \"pageviews\" criteria for each box\nfunction checkPageViewsCriteria() {\n\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {\n box.trigger();\n }\n });\n}\n\n// check time trigger criteria for each box\nfunction checkTimeCriteria() {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n // check \"time on site\" trigger\n if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n\n // check \"time on page\" trigger\n if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n });\n}\n\n// check triggerHeight criteria for all boxes\nfunction checkHeightCriteria() {\n\n var scrollY = scrollElement.hasOwnProperty('pageYOffset') ? scrollElement.pageYOffset : scrollElement.scrollTop;\n scrollY = scrollY + window.innerHeight * 0.9;\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow() || box.triggerHeight <= 0) {\n return;\n }\n\n if (scrollY > box.triggerHeight) {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n // trigger box\n box.trigger();\n } else if (box.mayRehide()) {\n box.hide();\n }\n });\n}\n\n// recalculate heights and variables based on height\nfunction recalculateHeights() {\n boxes.forEach(function (box) {\n box.onResize();\n });\n}\n\nfunction onOverlayClick(e) {\n var x = e.offsetX;\n var y = e.offsetY;\n\n // calculate if click was less than 40px outside box to avoid closing it by accident\n boxes.forEach(function (box) {\n var rect = box.element.getBoundingClientRect();\n var margin = 40;\n\n // if click was not anywhere near box, dismiss it.\n if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {\n box.dismiss();\n }\n });\n}\n\nfunction triggerExitIntent() {\n // do nothing if already triggered OR another box is visible.\n if (exitIntentTriggered || isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {\n box.trigger();\n }\n });\n\n exitIntentTriggered = true;\n}\n\nfunction onMouseLeave(e) {\n var delay = 400;\n\n // did mouse leave at top of window?\n if (e.clientY <= 0) {\n exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);\n }\n}\n\nfunction isAnyBoxVisible() {\n\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n\n if (box.visible) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction onMouseEnter() {\n if (exitIntentDelayTimer) {\n window.clearInterval(exitIntentDelayTimer);\n exitIntentDelayTimer = null;\n }\n}\n\nfunction onElementClick(e) {\n // find <a> element in up to 3 parent elements\n var el = e.target || e.srcElement;\n var depth = 3;\n for (var i = 0; i <= depth; i++) {\n if (!el || el.tagName === 'A') {\n break;\n }\n\n el = el.parentElement;\n }\n\n if (!el || el.tagName !== 'A' || !el.getAttribute('href')) {\n return;\n }\n\n if (el.getAttribute('href').toLowerCase().indexOf('#boxzilla-') === 0) {\n var boxId = el.getAttribute('href').toLowerCase().substring(\"#boxzilla-\".length);\n Boxzilla.toggle(boxId);\n }\n}\n\nvar timers = {\n start: function start() {\n try {\n var sessionTime = sessionStorage.getItem('boxzilla_timer');\n if (sessionTime) siteTimer.time = sessionTime;\n } catch (e) {}\n siteTimer.start();\n pageTimer.start();\n },\n stop: function stop() {\n sessionStorage.setItem('boxzilla_timer', siteTimer.time);\n siteTimer.stop();\n pageTimer.stop();\n }\n};\n\n// initialise & add event listeners\nBoxzilla.init = function () {\n document.body.addEventListener('click', onElementClick, true);\n\n try {\n pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;\n } catch (e) {\n pageViews = 0;\n }\n\n siteTimer = new Timer(0);\n pageTimer = new Timer(0);\n\n // insert styles into DOM\n var styles = require('./styles.js');\n var styleElement = document.createElement('style');\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = styles;\n document.head.appendChild(styleElement);\n\n // add overlay element to dom\n overlay = document.createElement('div');\n overlay.style.display = 'none';\n overlay.id = 'boxzilla-overlay';\n document.body.appendChild(overlay);\n\n // event binds\n scrollElement.addEventListener('touchstart', throttle(checkHeightCriteria), true);\n scrollElement.addEventListener('scroll', throttle(checkHeightCriteria), true);\n window.addEventListener('resize', throttle(recalculateHeights));\n window.addEventListener('load', recalculateHeights);\n overlay.addEventListener('click', onOverlayClick);\n window.setInterval(checkTimeCriteria, 1000);\n window.setTimeout(checkPageViewsCriteria, 1000);\n document.documentElement.addEventListener('mouseleave', onMouseLeave);\n document.documentElement.addEventListener('mouseenter', onMouseEnter);\n document.addEventListener('keyup', onKeyUp);\n\n timers.start();\n window.addEventListener('focus', timers.start);\n window.addEventListener('beforeunload', function () {\n timers.stop();\n sessionStorage.setItem('boxzilla_pageviews', ++pageViews);\n });\n window.addEventListener('blur', timers.stop);\n\n Boxzilla.trigger('ready');\n};\n\n/**\n * Create a new Box\n *\n * @param string id\n * @param object opts\n *\n * @returns Box\n */\nBoxzilla.create = function (id, opts) {\n\n // preserve backwards compat for minimumScreenWidth option\n if (typeof opts.minimumScreenWidth !== \"undefined\") {\n opts.screenWidthCondition = {\n condition: \"larger\",\n value: opts.minimumScreenWidth\n };\n }\n\n var box = new Box(id, opts);\n boxes.push(box);\n return box;\n};\n\nBoxzilla.get = function (id) {\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n if (box.id == id) {\n return box;\n }\n }\n\n throw new Error(\"No box exists with ID \" + id);\n};\n\n// dismiss a single box (or all by omitting id param)\nBoxzilla.dismiss = function (id) {\n // if no id given, dismiss all current open boxes\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.dismiss();\n });\n } else {\n Boxzilla.get(id).dismiss();\n }\n};\n\nBoxzilla.hide = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.hide();\n });\n } else {\n Boxzilla.get(id).hide();\n }\n};\n\nBoxzilla.show = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.show();\n });\n } else {\n Boxzilla.get(id).show();\n }\n};\n\nBoxzilla.toggle = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.toggle();\n });\n } else {\n Boxzilla.get(id).toggle();\n }\n};\n\n// expose each individual box.\nBoxzilla.boxes = boxes;\n\n// expose boxzilla object\nwindow.Boxzilla = Boxzilla;\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = Boxzilla;\n}\n\n},{\"./box.js\":4,\"./styles.js\":6,\"./timer.js\":7,\"wolfy87-eventemitter\":2}],6:[function(require,module,exports){\n\"use strict\";\n\nvar styles = \"#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}\";\nmodule.exports = styles;\n\n},{}],7:[function(require,module,exports){\n'use strict';\n\nvar Timer = function Timer(start) {\n this.time = start;\n this.interval = 0;\n};\n\nTimer.prototype.tick = function () {\n this.time++;\n};\n\nTimer.prototype.start = function () {\n if (!this.interval) {\n this.interval = window.setInterval(this.tick.bind(this), 1000);\n }\n};\n\nTimer.prototype.stop = function () {\n if (this.interval) {\n window.clearInterval(this.interval);\n this.interval = 0;\n }\n};\n\nmodule.exports = Timer;\n\n},{}]},{},[1]);\n; })();"]}
1
+ {"version":3,"sources":["script.js"],"names":["define","undefined","r","e","n","t","o","i","f","c","u","a","Error","code","p","exports","call","length","1","require","module","_typeof","obj","Symbol","iterator","constructor","prototype","Boxzilla","options","window","boxzilla_options","locationHashRefersBox","box","location","hash","elementId","substring","test","element","id","querySelector","isLoggedIn","document","body","className","indexOf","testMode","console","log","init","addEventListener","inited","key","boxes","boxOpts","boxContentElement","getElementById","content","create","post","slug","styles","css","background_color","style","background","color","border_color","borderColor","border_width","borderWidth","parseInt","border_style","borderStyle","width","maxWidth","firstChild","lastChild","fits","show","trigger","mc4wp_forms_config","submitted_form","selector","element_id","boxId","hasOwnProperty","maybeOpenMailChimpForWordPressBox","boxzilla","2","EventEmitter","proto","this","originalGlobalValue","indexOfListener","listeners","listener","alias","name","apply","arguments","getListeners","evt","response","events","_getEvents","RegExp","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","listenerIsWrapped","once","on","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","remove","value","single","multiple","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd","3","duration","property","animate","targetStyles","fn","last","Date","initialStyles","getComputedStyle","currentStyles","propSteps","parseFloat","to","current","tick","step","increment","newValue","timeSinceLastTick","done","suffix","requestAnimationFrame","setTimeout","toggle","animation","callbackFn","hiddenStyles","visibleStyles","nowVisible","display","offsetLeft","clone","cloneNode","cleanup","removeAttribute","setAttribute","getAttribute","properties","newObject","initObjectProperties","object","copyObjectProperties","isFinite","height","clientRect","getBoundingClientRect","overflowY","opacity","animated","4","defaults","rehide","cookie","icon","screenWidthCondition","position","closable","Animator","Box","config","obj1","obj2","obj3","attrname","merge","overlay","visible","dismissed","triggered","triggerHeight","calculateTriggerHeight","cookieSet","isCookieSet","contentElement","closeIcon","dom","dismiss","bind","target","tagName","setCookie","wrapper","createElement","appendChild","innerHTML","setCustomBoxStyling","origDisplay","maxHeight","windowHeight","innerHeight","boxHeight","clientHeight","newTopMargin","marginTop","classList","hide","html","method","triggerElement","top","documentElement","Math","max","scrollHeight","offsetHeight","condition","innerWidth","onResize","mayAutoShow","mayRehide","replace","hours","expiryDate","setHours","getHours","toUTCString","preventDefault","_Boxzilla","./animator.js","5","exitIntentDelayTimer","exitIntentTriggered","siteTimer","pageTimer","pageViews","Object","Timer","scrollElement","throttle","threshhold","scope","deferTimer","context","now","clearTimeout","onKeyUp","keyCode","checkPageViewsCriteria","isAnyBoxVisible","forEach","checkTimeCriteria","time","checkHeightCriteria","scrollY","pageYOffset","scrollTop","recalculateHeights","onOverlayClick","x","offsetX","y","offsetY","rect","left","right","bottom","triggerExitIntent","onMouseLeave","clientY","onMouseEnter","clearInterval","onElementClick","el","srcElement","parentElement","toLowerCase","timers","sessionTime","sessionStorage","getItem","start","setItem","stop","styleElement","head","setInterval","opts","minimumScreenWidth","get","./box.js","./styles.js","./timer.js","wolfy87-eventemitter","6","7","interval"],"mappings":"CAAA,WAAe,IAA8EA,OAASC,GAAuB,SAASC,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,GAAE,EAAoC,IAAID,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE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BA,EAAIiN,SAGNtN,EAASyS,IAAI7R,GAAI0M,QAIrBtN,EAASoD,KAAO,SAAUxC,QACN,IAAPA,EACTc,EAAMwO,QAAQ,SAAU7P,GACtBA,EAAI+C,SAGNpD,EAASyS,IAAI7R,GAAIwC,QAIrBpD,EAAS8I,OAAS,SAAUlI,QACR,IAAPA,EACTc,EAAMwO,QAAQ,SAAU7P,GACtBA,EAAIyI,WAGN9I,EAASyS,IAAI7R,GAAIkI,UAKrB9I,EAAS0B,MAAQA,EAEjBxB,OAAOF,SAAWA,OAEI,IAAXP,GAA0BA,EAAOL,UAC1CK,EAAOL,QAAUY,IAGjB,CAAC0S,WAAW,EAAEC,cAAc,EAAEC,aAAa,EAAEC,uBAAuB,IAAIC,EAAE,CAAC,SAAStT,EAAQC,EAAOL,GACrG,aAGAK,EAAOL,QADM,0hCAGX,IAAI2T,EAAE,CAAC,SAASvT,EAAQC,EAAOL,GACjC,aAEA,IAAIiQ,EAAQ,SAAe4C,GACzBhO,KAAKmM,KAAO6B,EACZhO,KAAK+O,SAAW,GAGlB3D,EAAMtP,UAAUsI,KAAO,WACrBpE,KAAKmM,QAGPf,EAAMtP,UAAUkS,MAAQ,WACjBhO,KAAK+O,WACR/O,KAAK+O,SAAW9S,OAAOoS,YAAYrO,KAAKoE,KAAK+D,KAAKnI,MAAO,OAI7DoL,EAAMtP,UAAUoS,KAAO,WACjBlO,KAAK+O,WACP9S,OAAOqR,cAActN,KAAK+O,UAC1B/O,KAAK+O,SAAW,IAIpBvT,EAAOL,QAAUiQ,GAEf,KAAK,GAAG,CAAC,IAt+CX","file":"script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n\"use strict\";\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n(function () {\n 'use strict';\n\n var Boxzilla = require('boxzilla');\n\n var options = window.boxzilla_options; // expose Boxzilla object to window\n\n window.Boxzilla = Boxzilla; // helper function for setting CSS styles\n\n function css(element, styles) {\n if (styles.background_color) {\n element.style.background = styles.background_color;\n }\n\n if (styles.color) {\n element.style.color = styles.color;\n }\n\n if (styles.border_color) {\n element.style.borderColor = styles.border_color;\n }\n\n if (styles.border_width) {\n element.style.borderWidth = parseInt(styles.border_width) + \"px\";\n }\n\n if (styles.border_style) {\n element.style.borderStyle = styles.border_style;\n }\n\n if (styles.width) {\n element.style.maxWidth = parseInt(styles.width) + \"px\";\n }\n }\n\n function createBoxesFromConfig() {\n // failsafe against including script twice.\n if (options.inited) {\n return;\n } // create boxes from options\n\n\n for (var key in options.boxes) {\n // get opts\n var boxOpts = options.boxes[key];\n boxOpts.testMode = isLoggedIn && options.testMode; // find box content element, bail if not found\n\n var boxContentElement = document.getElementById('boxzilla-box-' + boxOpts.id + '-content');\n\n if (!boxContentElement) {\n continue;\n } // use element as content option\n\n\n boxOpts.content = boxContentElement; // create box\n\n var box = Boxzilla.create(boxOpts.id, boxOpts); // add box slug to box element as classname\n\n box.element.className = box.element.className + ' boxzilla-' + boxOpts.post.slug; // add custom css to box\n\n css(box.element, boxOpts.css);\n box.element.firstChild.firstChild.className += \" first-child\";\n box.element.firstChild.lastChild.className += \" last-child\"; // maybe show box right away\n\n if (box.fits() && locationHashRefersBox(box)) {\n box.show();\n }\n } // set flag to prevent initialising twice\n\n\n options.inited = true; // trigger \"done\" event.\n\n Boxzilla.trigger('done'); // maybe open box with MC4WP form in it\n\n maybeOpenMailChimpForWordPressBox();\n }\n\n function locationHashRefersBox(box) {\n if (!window.location.hash || 0 === window.location.hash.length) {\n return false;\n }\n\n var elementId = window.location.hash.substring(1); // only attempt on strings looking like an ID \n\n var regex = /^[a-zA-Z\\-\\_0-9]+$/;\n\n if (!regex.test(elementId)) {\n return false;\n }\n\n if (elementId === box.element.id) {\n return true;\n } else if (box.element.querySelector('#' + elementId)) {\n return true;\n }\n\n return false;\n }\n\n function maybeOpenMailChimpForWordPressBox() {\n if (_typeof(window.mc4wp_forms_config) !== \"object\" || !window.mc4wp_forms_config.submitted_form) {\n return;\n }\n\n var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;\n var boxes = Boxzilla.boxes;\n\n for (var boxId in boxes) {\n if (!boxes.hasOwnProperty(boxId)) {\n continue;\n }\n\n var box = boxes[boxId];\n\n if (box.element.querySelector(selector)) {\n box.show();\n return;\n }\n }\n } // print message when test mode is enabled\n\n\n var isLoggedIn = document.body.className.indexOf('logged-in') > -1;\n\n if (isLoggedIn && options.testMode) {\n console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\\'re done testing.');\n } // init boxzilla\n\n\n Boxzilla.init(); // on window.load, create DOM elements for boxes\n\n window.addEventListener('load', createBoxesFromConfig);\n})();\n\n},{\"boxzilla\":5}],2:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}],3:[function(require,module,exports){\n\"use strict\";\n\nvar duration = 320;\n\nfunction css(element, styles) {\n for (var property in styles) {\n element.style[property] = styles[property];\n }\n}\n\nfunction initObjectProperties(properties, value) {\n var newObject = {};\n\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = value;\n }\n\n return newObject;\n}\n\nfunction copyObjectProperties(properties, object) {\n var newObject = {};\n\n for (var i = 0; i < properties.length; i++) {\n newObject[properties[i]] = object[properties[i]];\n }\n\n return newObject;\n}\n/**\n * Checks if the given element is currently being animated.\n *\n * @param element\n * @returns {boolean}\n */\n\n\nfunction animated(element) {\n return !!element.getAttribute('data-animated');\n}\n/**\n * Toggles the element using the given animation.\n *\n * @param element\n * @param animation Either \"fade\" or \"slide\"\n */\n\n\nfunction toggle(element, animation, callbackFn) {\n var nowVisible = element.style.display != 'none' || element.offsetLeft > 0; // create clone for reference\n\n var clone = element.cloneNode(true);\n\n var cleanup = function cleanup() {\n element.removeAttribute('data-animated');\n element.setAttribute('style', clone.getAttribute('style'));\n element.style.display = nowVisible ? 'none' : '';\n\n if (callbackFn) {\n callbackFn();\n }\n }; // store attribute so everyone knows we're animating this element\n\n\n element.setAttribute('data-animated', \"true\"); // toggle element visiblity right away if we're making something visible\n\n if (!nowVisible) {\n element.style.display = '';\n }\n\n var hiddenStyles, visibleStyles; // animate properties\n\n if (animation === 'slide') {\n hiddenStyles = initObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], 0);\n visibleStyles = {};\n\n if (!nowVisible) {\n var computedStyles = window.getComputedStyle(element);\n visibleStyles = copyObjectProperties([\"height\", \"borderTopWidth\", \"borderBottomWidth\", \"paddingTop\", \"paddingBottom\"], computedStyles); // in some browsers, getComputedStyle returns \"auto\" value. this falls back to getBoundingClientRect() in those browsers since we need an actual height.\n\n if (!isFinite(visibleStyles.height)) {\n var clientRect = element.getBoundingClientRect();\n visibleStyles.height = clientRect.height;\n }\n\n css(element, hiddenStyles);\n } // don't show a scrollbar during animation\n\n\n element.style.overflowY = 'hidden';\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n } else {\n hiddenStyles = {\n opacity: 0\n };\n visibleStyles = {\n opacity: 1\n };\n\n if (!nowVisible) {\n css(element, hiddenStyles);\n }\n\n animate(element, nowVisible ? hiddenStyles : visibleStyles, cleanup);\n }\n}\n\nfunction animate(element, targetStyles, fn) {\n var last = +new Date();\n var initialStyles = window.getComputedStyle(element);\n var currentStyles = {};\n var propSteps = {};\n\n for (var property in targetStyles) {\n // make sure we have an object filled with floats\n targetStyles[property] = parseFloat(targetStyles[property]); // calculate step size & current value\n\n var to = targetStyles[property];\n var current = parseFloat(initialStyles[property]); // is there something to do?\n\n if (current == to) {\n delete targetStyles[property];\n continue;\n }\n\n propSteps[property] = (to - current) / duration; // points per second\n\n currentStyles[property] = current;\n }\n\n var tick = function tick() {\n var now = +new Date();\n var timeSinceLastTick = now - last;\n var done = true;\n var step, to, increment, newValue;\n\n for (var property in targetStyles) {\n step = propSteps[property];\n to = targetStyles[property];\n increment = step * timeSinceLastTick;\n newValue = currentStyles[property] + increment;\n\n if (step > 0 && newValue >= to || step < 0 && newValue <= to) {\n newValue = to;\n } else {\n done = false;\n } // store new value\n\n\n currentStyles[property] = newValue;\n var suffix = property !== \"opacity\" ? \"px\" : \"\";\n element.style[property] = newValue + suffix;\n }\n\n last = +new Date(); // keep going until we're done for all props\n\n if (!done) {\n window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);\n } else {\n // call callback\n fn && fn();\n }\n };\n\n tick();\n}\n\nmodule.exports = {\n 'toggle': toggle,\n 'animate': animate,\n 'animated': animated\n};\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar defaults = {\n 'animation': 'fade',\n 'rehide': false,\n 'content': '',\n 'cookie': null,\n 'icon': '&times',\n 'screenWidthCondition': null,\n 'position': 'center',\n 'testMode': false,\n 'trigger': false,\n 'closable': true\n},\n Boxzilla,\n Animator = require('./animator.js');\n/**\n* Merge 2 objects, values of the latter overwriting the former.\n*\n* @param obj1\n* @param obj2\n* @returns {*}\n*/\n\n\nfunction merge(obj1, obj2) {\n var obj3 = {};\n\n for (var attrname in obj1) {\n obj3[attrname] = obj1[attrname];\n }\n\n for (var attrname in obj2) {\n obj3[attrname] = obj2[attrname];\n }\n\n return obj3;\n}\n/**\n* Get the real height of entire document.\n* @returns {number}\n*/\n\n\nfunction getDocumentHeight() {\n var body = document.body,\n html = document.documentElement;\n var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);\n return height;\n} // Box Object\n\n\nvar Box = function Box(id, config) {\n this.id = id; // store config values\n\n this.config = merge(defaults, config); // store ref to overlay\n\n this.overlay = document.getElementById('boxzilla-overlay'); // state\n\n this.visible = false;\n this.dismissed = false;\n this.triggered = false;\n this.triggerHeight = this.calculateTriggerHeight();\n this.cookieSet = this.isCookieSet();\n this.element = null;\n this.contentElement = null;\n this.closeIcon = null; // create dom elements for this box\n\n this.dom(); // further initialise the box\n\n this.events();\n}; // initialise the box\n\n\nBox.prototype.events = function () {\n var box = this; // attach event to \"close\" icon inside box\n\n if (this.closeIcon) {\n this.closeIcon.addEventListener('click', this.dismiss.bind(this));\n }\n\n this.element.addEventListener('click', function (e) {\n if (e.target.tagName === 'A') {\n Boxzilla.trigger('box.interactions.link', [box, e.target]);\n }\n }, false);\n this.element.addEventListener('submit', function (e) {\n box.setCookie();\n Boxzilla.trigger('box.interactions.form', [box, e.target]);\n }, false);\n}; // generate dom elements for this box\n\n\nBox.prototype.dom = function () {\n var wrapper = document.createElement('div');\n wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';\n var box = document.createElement('div');\n box.setAttribute('id', 'boxzilla-' + this.id);\n box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;\n box.style.display = 'none';\n wrapper.appendChild(box);\n var content;\n\n if (typeof this.config.content === \"string\") {\n content = document.createElement('div');\n content.innerHTML = this.config.content;\n } else {\n content = this.config.content; // make sure element is visible\n\n content.style.display = '';\n }\n\n content.className = 'boxzilla-content';\n box.appendChild(content);\n\n if (this.config.closable && this.config.icon) {\n var closeIcon = document.createElement('span');\n closeIcon.className = \"boxzilla-close-icon\";\n closeIcon.innerHTML = this.config.icon;\n box.appendChild(closeIcon);\n this.closeIcon = closeIcon;\n }\n\n document.body.appendChild(wrapper);\n this.contentElement = content;\n this.element = box;\n}; // set (calculate) custom box styling depending on box options\n\n\nBox.prototype.setCustomBoxStyling = function () {\n // reset element to its initial state\n var origDisplay = this.element.style.display;\n this.element.style.display = '';\n this.element.style.overflowY = 'auto';\n this.element.style.maxHeight = 'none'; // get new dimensions\n\n var windowHeight = window.innerHeight;\n var boxHeight = this.element.clientHeight; // add scrollbar to box and limit height\n\n if (boxHeight > windowHeight) {\n this.element.style.maxHeight = windowHeight + \"px\";\n this.element.style.overflowY = 'scroll';\n } // set new top margin for boxes which are centered\n\n\n if (this.config.position === 'center') {\n var newTopMargin = (windowHeight - boxHeight) / 2;\n newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;\n this.element.style.marginTop = newTopMargin + \"px\";\n }\n\n this.element.style.display = origDisplay;\n}; // toggle visibility of the box\n\n\nBox.prototype.toggle = function (show) {\n // revert visibility if no explicit argument is given\n if (typeof show === \"undefined\") {\n show = !this.visible;\n } // is box already at desired visibility?\n\n\n if (show === this.visible) {\n return false;\n } // is box being animated?\n\n\n if (Animator.animated(this.element)) {\n return false;\n } // if box should be hidden but is not closable, bail.\n\n\n if (!show && !this.config.closable) {\n return false;\n } // set new visibility status\n\n\n this.visible = show; // calculate new styling rules\n\n this.setCustomBoxStyling(); // trigger event\n\n Boxzilla.trigger('box.' + (show ? 'show' : 'hide'), [this]); // show or hide box using selected animation\n\n if (this.config.position === 'center') {\n this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');\n Animator.toggle(this.overlay, \"fade\");\n }\n\n Animator.toggle(this.element, this.config.animation, function () {\n if (this.visible) {\n return;\n }\n\n this.contentElement.innerHTML = this.contentElement.innerHTML;\n }.bind(this));\n return true;\n}; // show the box\n\n\nBox.prototype.show = function () {\n return this.toggle(true);\n}; // hide the box\n\n\nBox.prototype.hide = function () {\n return this.toggle(false);\n}; // calculate trigger height\n\n\nBox.prototype.calculateTriggerHeight = function () {\n var triggerHeight = 0;\n\n if (this.config.trigger) {\n if (this.config.trigger.method === 'element') {\n var triggerElement = document.body.querySelector(this.config.trigger.value);\n\n if (triggerElement) {\n var offset = triggerElement.getBoundingClientRect();\n triggerHeight = offset.top;\n }\n } else if (this.config.trigger.method === 'percentage') {\n triggerHeight = this.config.trigger.value / 100 * getDocumentHeight();\n }\n }\n\n return triggerHeight;\n};\n\nBox.prototype.fits = function () {\n if (!this.config.screenWidthCondition || !this.config.screenWidthCondition.value) {\n return true;\n }\n\n switch (this.config.screenWidthCondition.condition) {\n case \"larger\":\n return window.innerWidth > this.config.screenWidthCondition.value;\n\n case \"smaller\":\n return window.innerWidth < this.config.screenWidthCondition.value;\n } // meh.. condition should be \"smaller\" or \"larger\", just return true.\n\n\n return true;\n};\n\nBox.prototype.onResize = function () {\n this.triggerHeight = this.calculateTriggerHeight();\n this.setCustomBoxStyling();\n}; // is this box enabled?\n\n\nBox.prototype.mayAutoShow = function () {\n if (this.dismissed) {\n return false;\n } // check if box fits on given minimum screen width\n\n\n if (!this.fits()) {\n return false;\n } // if trigger empty or error in calculating triggerHeight, return false\n\n\n if (!this.config.trigger) {\n return false;\n } // rely on cookie value (show if not set, don't show if set)\n\n\n return !this.cookieSet;\n};\n\nBox.prototype.mayRehide = function () {\n return this.config.rehide && this.triggered;\n};\n\nBox.prototype.isCookieSet = function () {\n // always show on test mode or when no auto-trigger is configured\n if (this.config.testMode || !this.config.trigger) {\n return false;\n } // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.\n\n\n if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {\n return false;\n }\n\n var cookieSet = document.cookie.replace(new RegExp(\"(?:(?:^|.*;)\\\\s*\" + 'boxzilla_box_' + this.id + \"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"), \"$1\") === \"true\";\n return cookieSet;\n}; // set cookie that disables automatically showing the box\n\n\nBox.prototype.setCookie = function (hours) {\n var expiryDate = new Date();\n expiryDate.setHours(expiryDate.getHours() + hours);\n document.cookie = 'boxzilla_box_' + this.id + '=true; expires=' + expiryDate.toUTCString() + '; path=/';\n};\n\nBox.prototype.trigger = function () {\n var shown = this.show();\n\n if (!shown) {\n return;\n }\n\n this.triggered = true;\n\n if (this.config.cookie && this.config.cookie.triggered) {\n this.setCookie(this.config.cookie.triggered);\n }\n};\n/**\n* Dismisses the box and optionally sets a cookie.\n*\n* @param e The event that triggered this dismissal.\n* @returns {boolean}\n*/\n\n\nBox.prototype.dismiss = function (e) {\n // prevent default action\n e && e.preventDefault(); // only dismiss box if it's currently open.\n\n if (!this.visible) {\n return false;\n } // hide box element\n\n\n this.hide(); // set cookie\n\n if (this.config.cookie && this.config.cookie.dismissed) {\n this.setCookie(this.config.cookie.dismissed);\n }\n\n this.dismissed = true;\n Boxzilla.trigger('box.dismiss', [this]);\n return true;\n};\n\nmodule.exports = function (_Boxzilla) {\n Boxzilla = _Boxzilla;\n return Box;\n};\n\n},{\"./animator.js\":3}],5:[function(require,module,exports){\n'use strict';\n\nvar EventEmitter = require('wolfy87-eventemitter'),\n Boxzilla = Object.create(EventEmitter.prototype),\n Box = require('./box.js')(Boxzilla),\n Timer = require('./timer.js'),\n boxes = [],\n overlay,\n scrollElement = window,\n exitIntentDelayTimer,\n exitIntentTriggered,\n siteTimer,\n pageTimer,\n pageViews;\n\nfunction throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n var last, deferTimer;\n return function () {\n var context = scope || this;\n var now = +new Date(),\n args = arguments;\n\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} // \"keyup\" listener\n\n\nfunction onKeyUp(e) {\n if (e.keyCode == 27) {\n Boxzilla.dismiss();\n }\n} // check \"pageviews\" criteria for each box\n\n\nfunction checkPageViewsCriteria() {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n }\n\n if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {\n box.trigger();\n }\n });\n} // check time trigger criteria for each box\n\n\nfunction checkTimeCriteria() {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (!box.mayAutoShow()) {\n return;\n } // check \"time on site\" trigger\n\n\n if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {\n box.trigger();\n } // check \"time on page\" trigger\n\n\n if (box.config.trigger.method === 'time_on_page' && pageTimer.time >= box.config.trigger.value) {\n box.trigger();\n }\n });\n} // check triggerHeight criteria for all boxes\n\n\nfunction checkHeightCriteria() {\n var scrollY = scrollElement.hasOwnProperty('pageYOffset') ? scrollElement.pageYOffset : scrollElement.scrollTop;\n scrollY = scrollY + window.innerHeight * 0.9;\n boxes.forEach(function (box) {\n if (!box.mayAutoShow() || box.triggerHeight <= 0) {\n return;\n }\n\n if (scrollY > box.triggerHeight) {\n // don't bother if another box is currently open\n if (isAnyBoxVisible()) {\n return;\n } // trigger box\n\n\n box.trigger();\n } // if box may auto-hide and scrollY is less than triggerHeight (with small margin of error), hide box\n\n\n if (box.mayRehide() && scrollY < box.triggerHeight - 5) {\n box.hide();\n }\n });\n} // recalculate heights and variables based on height\n\n\nfunction recalculateHeights() {\n boxes.forEach(function (box) {\n box.onResize();\n });\n}\n\nfunction onOverlayClick(e) {\n var x = e.offsetX;\n var y = e.offsetY; // calculate if click was less than 40px outside box to avoid closing it by accident\n\n boxes.forEach(function (box) {\n var rect = box.element.getBoundingClientRect();\n var margin = 40; // if click was not anywhere near box, dismiss it.\n\n if (x < rect.left - margin || x > rect.right + margin || y < rect.top - margin || y > rect.bottom + margin) {\n box.dismiss();\n }\n });\n}\n\nfunction triggerExitIntent() {\n // do nothing if already triggered OR another box is visible.\n if (exitIntentTriggered || isAnyBoxVisible()) {\n return;\n }\n\n boxes.forEach(function (box) {\n if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {\n box.trigger();\n }\n });\n exitIntentTriggered = true;\n}\n\nfunction onMouseLeave(e) {\n var delay = 400; // did mouse leave at top of window?\n\n if (e.clientY <= 0) {\n exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);\n }\n}\n\nfunction isAnyBoxVisible() {\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n\n if (box.visible) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction onMouseEnter() {\n if (exitIntentDelayTimer) {\n window.clearInterval(exitIntentDelayTimer);\n exitIntentDelayTimer = null;\n }\n}\n\nfunction onElementClick(e) {\n // find <a> element in up to 3 parent elements\n var el = e.target || e.srcElement;\n var depth = 3;\n\n for (var i = 0; i <= depth; i++) {\n if (!el || el.tagName === 'A') {\n break;\n }\n\n el = el.parentElement;\n }\n\n if (!el || el.tagName !== 'A' || !el.getAttribute('href')) {\n return;\n }\n\n if (el.getAttribute('href').toLowerCase().indexOf('#boxzilla-') === 0) {\n var boxId = el.getAttribute('href').toLowerCase().substring(\"#boxzilla-\".length);\n Boxzilla.toggle(boxId);\n }\n}\n\nvar timers = {\n start: function start() {\n try {\n var sessionTime = sessionStorage.getItem('boxzilla_timer');\n if (sessionTime) siteTimer.time = sessionTime;\n } catch (e) {}\n\n siteTimer.start();\n pageTimer.start();\n },\n stop: function stop() {\n sessionStorage.setItem('boxzilla_timer', siteTimer.time);\n siteTimer.stop();\n pageTimer.stop();\n }\n}; // initialise & add event listeners\n\nBoxzilla.init = function () {\n document.body.addEventListener('click', onElementClick, true);\n\n try {\n pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;\n } catch (e) {\n pageViews = 0;\n }\n\n siteTimer = new Timer(0);\n pageTimer = new Timer(0); // insert styles into DOM\n\n var styles = require('./styles.js');\n\n var styleElement = document.createElement('style');\n styleElement.setAttribute(\"type\", \"text/css\");\n styleElement.innerHTML = styles;\n document.head.appendChild(styleElement); // add overlay element to dom\n\n overlay = document.createElement('div');\n overlay.style.display = 'none';\n overlay.id = 'boxzilla-overlay';\n document.body.appendChild(overlay); // event binds\n\n scrollElement.addEventListener('touchstart', throttle(checkHeightCriteria), true);\n scrollElement.addEventListener('scroll', throttle(checkHeightCriteria), true);\n window.addEventListener('resize', throttle(recalculateHeights));\n window.addEventListener('load', recalculateHeights);\n overlay.addEventListener('click', onOverlayClick);\n window.setInterval(checkTimeCriteria, 1000);\n window.setTimeout(checkPageViewsCriteria, 1000);\n document.documentElement.addEventListener('mouseleave', onMouseLeave);\n document.documentElement.addEventListener('mouseenter', onMouseEnter);\n document.addEventListener('keyup', onKeyUp);\n timers.start();\n window.addEventListener('focus', timers.start);\n window.addEventListener('beforeunload', function () {\n timers.stop();\n sessionStorage.setItem('boxzilla_pageviews', ++pageViews);\n });\n window.addEventListener('blur', timers.stop);\n Boxzilla.trigger('ready');\n};\n/**\n * Create a new Box\n *\n * @param string id\n * @param object opts\n *\n * @returns Box\n */\n\n\nBoxzilla.create = function (id, opts) {\n // preserve backwards compat for minimumScreenWidth option\n if (typeof opts.minimumScreenWidth !== \"undefined\") {\n opts.screenWidthCondition = {\n condition: \"larger\",\n value: opts.minimumScreenWidth\n };\n }\n\n var box = new Box(id, opts);\n boxes.push(box);\n return box;\n};\n\nBoxzilla.get = function (id) {\n for (var i = 0; i < boxes.length; i++) {\n var box = boxes[i];\n\n if (box.id == id) {\n return box;\n }\n }\n\n throw new Error(\"No box exists with ID \" + id);\n}; // dismiss a single box (or all by omitting id param)\n\n\nBoxzilla.dismiss = function (id) {\n // if no id given, dismiss all current open boxes\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.dismiss();\n });\n } else {\n Boxzilla.get(id).dismiss();\n }\n};\n\nBoxzilla.hide = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.hide();\n });\n } else {\n Boxzilla.get(id).hide();\n }\n};\n\nBoxzilla.show = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.show();\n });\n } else {\n Boxzilla.get(id).show();\n }\n};\n\nBoxzilla.toggle = function (id) {\n if (typeof id === \"undefined\") {\n boxes.forEach(function (box) {\n box.toggle();\n });\n } else {\n Boxzilla.get(id).toggle();\n }\n}; // expose each individual box.\n\n\nBoxzilla.boxes = boxes; // expose boxzilla object\n\nwindow.Boxzilla = Boxzilla;\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = Boxzilla;\n}\n\n},{\"./box.js\":4,\"./styles.js\":6,\"./timer.js\":7,\"wolfy87-eventemitter\":2}],6:[function(require,module,exports){\n\"use strict\";\n\nvar styles = \"#boxzilla-overlay{position:fixed;background:rgba(0,0,0,.65);width:100%;height:100%;left:0;top:0;z-index:99999}.boxzilla-center-container{position:fixed;top:0;left:0;right:0;height:0;text-align:center;z-index:999999;line-height:0}.boxzilla-center-container .boxzilla{display:inline-block;text-align:left;position:relative;line-height:normal}.boxzilla{position:fixed;z-index:999999;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;padding:25px}.boxzilla.boxzilla-top-left{top:0;left:0}.boxzilla.boxzilla-top-right{top:0;right:0}.boxzilla.boxzilla-bottom-left{bottom:0;left:0}.boxzilla.boxzilla-bottom-right{bottom:0;right:0}.boxzilla-content>:first-child{margin-top:0;padding-top:0}.boxzilla-content>:last-child{margin-bottom:0;padding-bottom:0}.boxzilla-close-icon{position:absolute;right:0;top:0;text-align:center;padding:6px;cursor:pointer;-webkit-appearance:none;font-size:28px;font-weight:700;line-height:20px;color:#000;opacity:.5}.boxzilla-close-icon:focus,.boxzilla-close-icon:hover{opacity:.8}\";\nmodule.exports = styles;\n\n},{}],7:[function(require,module,exports){\n'use strict';\n\nvar Timer = function Timer(start) {\n this.time = start;\n this.interval = 0;\n};\n\nTimer.prototype.tick = function () {\n this.time++;\n};\n\nTimer.prototype.start = function () {\n if (!this.interval) {\n this.interval = window.setInterval(this.tick.bind(this), 1000);\n }\n};\n\nTimer.prototype.stop = function () {\n if (this.interval) {\n window.clearInterval(this.interval);\n this.interval = 0;\n }\n};\n\nmodule.exports = Timer;\n\n},{}]},{},[1]);\n; })();"]}
assets/scss/admin-styles.scss DELETED
@@ -1,181 +0,0 @@
1
- /* first row can't be deleted */
2
- .boxzilla-rule-row-0 .boxzilla-close{
3
- visibility: hidden;
4
- }
5
-
6
- .column-box_id {
7
- width: 80px;
8
- }
9
-
10
- .boxzilla-sm {
11
- width:150px;
12
- }
13
-
14
- .boxzilla-xsm {
15
- width: 15px;
16
- }
17
-
18
- .boxzilla-title{
19
- margin-top:2em !important;
20
- }
21
-
22
- .boxzilla-label{
23
- display:block;
24
- font-weight: bold;
25
- margin-bottom:6px;
26
- }
27
-
28
- .boxzilla-close{
29
- padding: 0;
30
- cursor: pointer;
31
- background: transparent;
32
- border: 0;
33
- -webkit-appearance: none;
34
- font-size: 21px;
35
- font-weight: bold;
36
- line-height: 26px;
37
- text-shadow: 0 1px 0 #fff;
38
- opacity: .3;
39
- filter: alpha(opacity=30);
40
-
41
- &:hover,
42
- &:focus {
43
- color: #000;
44
- text-decoration: none;
45
- cursor: pointer;
46
- opacity: .6;
47
- filter: alpha(opacity=60);
48
- }
49
- }
50
-
51
- .post-type-boxzilla-box {
52
- .form-table{
53
- table-layout:fixed;
54
- }
55
-
56
- .window-positions {
57
- border: 1px solid #EEE;
58
-
59
- td {
60
- padding: 3px;
61
- margin-bottom: 0;
62
- }
63
- }
64
-
65
- .wp-picker-container{
66
- white-space: nowrap;
67
- }
68
-
69
- .wp-picker-clear,
70
- .wp-picker-holder,
71
- .wp-picker-input-wrap {
72
- background:white;
73
- z-index: 999 !important;
74
- position: absolute !important;
75
- }
76
- }
77
-
78
- #boxzilla-admin {
79
- .status {
80
- display: inline-block;
81
- padding: 3px 6px;
82
- color: white;
83
- text-transform: uppercase;
84
- font-weight: bold;
85
-
86
- &.positive{
87
- background-color: limeGreen;
88
- }
89
-
90
- &.negative {
91
- background: #c3c3c3;
92
- }
93
- }
94
- }
95
- .boxzilla-muted {
96
- color: #888;
97
- }
98
-
99
- .boxzilla-no-vpadding {
100
- padding-top: 0 !important;
101
- padding-bottom: 0 !important;
102
- }
103
-
104
- .boxzilla-is-dismissible {
105
- padding-right: 38px;
106
- position: relative;
107
- }
108
-
109
- /* Radio Switches */
110
- .radio-label {
111
- font-weight: normal;
112
-
113
- > input {
114
- margin-top: 0 !important;
115
- }
116
- }
117
-
118
- /** Grid */
119
- .boxzilla-row{
120
- margin: 0 -20px;
121
- }
122
-
123
- .boxzilla-col-one-third,
124
- .boxzilla-col-two-third {
125
- float: left;
126
- -webkit-box-sizing: border-box;
127
- box-sizing: border-box;
128
- padding: 0 20px;
129
- }
130
-
131
- .boxzilla-col-two-third {
132
- width: 66.66%;
133
- }
134
-
135
- .boxzilla-col-one-third{
136
- width: 33.33%;
137
- }
138
-
139
-
140
- /* admin sidebar */
141
- .boxzilla-sidebar{
142
- margin-top: 10px;
143
- }
144
-
145
- .boxzilla-box {
146
- background: white;
147
- padding: 20px;
148
- margin-bottom: 20px;
149
- border: 1px solid #ccc;
150
-
151
- h3,
152
- :first-child {
153
- margin-top: 0;
154
- }
155
-
156
- :last-child {
157
- margin-bottom: 0;
158
- }
159
- }
160
-
161
- .boxzilla-sidebar form label {
162
- display: block;
163
- font-weight: bold;
164
- margin-bottom: 6px;
165
- }
166
-
167
- @media( max-width: 920px ) {
168
- .boxzilla-row {
169
- margin: 0;
170
- }
171
- .boxzilla-col-one-third,
172
- .boxzilla-col-two-third {
173
- float: none;
174
- padding: 0;
175
- width: auto;
176
- }
177
-
178
- .boxzilla-sidebar {
179
- margin-top: 40px;
180
- }
181
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
boxzilla.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Boxzilla
4
- Version: 3.2.7
5
  Plugin URI: https://boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page
6
  Description: Call-To-Action Boxes that display after visitors scroll down far enough. Unobtrusive, but highly conversing!
7
  Author: ibericode
@@ -41,7 +41,7 @@ if ( ! defined( 'ABSPATH' ) ) {
41
  function _load_boxzilla() {
42
 
43
  define( 'BOXZILLA_FILE', __FILE__ );
44
- define( 'BOXZILLA_VERSION', '3.2.7' );
45
 
46
  require __DIR__ . '/bootstrap.php';
47
  }
1
  <?php
2
  /*
3
  Plugin Name: Boxzilla
4
+ Version: 3.2.9
5
  Plugin URI: https://boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=boxzilla&utm_campaign=plugins-page
6
  Description: Call-To-Action Boxes that display after visitors scroll down far enough. Unobtrusive, but highly conversing!
7
  Author: ibericode
41
  function _load_boxzilla() {
42
 
43
  define( 'BOXZILLA_FILE', __FILE__ );
44
+ define( 'BOXZILLA_VERSION', '3.2.9' );
45
 
46
  require __DIR__ . '/bootstrap.php';
47
  }
languages/boxzilla.pot CHANGED
@@ -173,35 +173,35 @@ msgstr ""
173
  msgid "Warning! You are <u>not</u> receiving plugin updates for the following plugin(s):"
174
  msgstr ""
175
 
176
- #: src/licensing/views/license-form.php:33
177
  msgid "License Key"
178
  msgstr ""
179
 
180
- #: src/licensing/views/license-form.php:35
181
  msgid "Enter your license key.."
182
  msgstr ""
183
 
184
- #: src/licensing/views/license-form.php:38
185
  msgid "The license key received when purchasing your premium Boxzilla plan. <a href=\"%s\">You can find it here</a>."
186
  msgstr ""
187
 
188
- #: src/licensing/views/license-form.php:43
189
  msgid "License Status"
190
  msgstr ""
191
 
192
- #: src/licensing/views/license-form.php:47
193
  msgid "ACTIVE"
194
  msgstr ""
195
 
196
- #: src/licensing/views/license-form.php:47
197
  msgid "you are receiving plugin updates"
198
  msgstr ""
199
 
200
- #: src/licensing/views/license-form.php:49
201
  msgid "INACTIVE"
202
  msgstr ""
203
 
204
- #: src/licensing/views/license-form.php:49
205
  msgid "you are <strong>not</strong> receiving plugin updates"
206
  msgstr ""
207
 
173
  msgid "Warning! You are <u>not</u> receiving plugin updates for the following plugin(s):"
174
  msgstr ""
175
 
176
+ #: src/licensing/views/license-form.php:37
177
  msgid "License Key"
178
  msgstr ""
179
 
180
+ #: src/licensing/views/license-form.php:39
181
  msgid "Enter your license key.."
182
  msgstr ""
183
 
184
+ #: src/licensing/views/license-form.php:42
185
  msgid "The license key received when purchasing your premium Boxzilla plan. <a href=\"%s\">You can find it here</a>."
186
  msgstr ""
187
 
188
+ #: src/licensing/views/license-form.php:47
189
  msgid "License Status"
190
  msgstr ""
191
 
192
+ #: src/licensing/views/license-form.php:51
193
  msgid "ACTIVE"
194
  msgstr ""
195
 
196
+ #: src/licensing/views/license-form.php:51
197
  msgid "you are receiving plugin updates"
198
  msgstr ""
199
 
200
+ #: src/licensing/views/license-form.php:53
201
  msgid "INACTIVE"
202
  msgstr ""
203
 
204
+ #: src/licensing/views/license-form.php:53
205
  msgid "you are <strong>not</strong> receiving plugin updates"
206
  msgstr ""
207
 
readme.txt CHANGED
@@ -3,24 +3,24 @@ Contributors: Ibericode, DvanKooten, hchouhan, lapzor
3
  Donate link: https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=donate-link
4
  Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media, mc4wp, ibericode
5
  Requires at least: 4.1
6
- Tested up to: 4.9.7
7
- Stable tag: 3.2.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Requires PHP: 5.3
11
 
12
- Flexible call to action boxes, popping up or sliding in at just the right time.
13
 
14
  == Description ==
15
 
16
  ### Boxzilla for WordPress
17
 
18
- Boxzilla is a *lightweight* plugin for adding flexible call-to-actions to your WordPress site. Boxes can slide or fade in at any point and can contain whatever content you like.
19
 
20
  #### Some of Boxzilla's features
21
 
22
  - Boxes can contain _any_ content you like.
23
- - Various box triggers:
24
  - Scroll percentage
25
  - Reaching a certain page element
26
  - X amount of time on the page
@@ -36,74 +36,60 @@ Boxzilla is a *lightweight* plugin for adding flexible call-to-actions to your W
36
 
37
  [Read more about Boxzilla](https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
38
 
39
- > This is the successor of the old [Scroll Triggered Boxes](https://wordpress.org/plugins/scroll-triggered-boxes/) plugin.
 
 
 
 
40
 
41
  #### Documentation
42
 
43
- Please have a look at the [Boxzilla KB](https://kb.boxzillaplugin.com/).
44
 
45
  #### Demo
46
 
47
- There's a [Boxzilla demo](https://demo.boxzillaplugin.com#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description) with some examples.
48
-
49
- #### Add-on plugins
50
-
51
- The core Boxzilla plugin is and always will be free. Additional advanced functionality is available through several add-ons. Not only do they extend the core functionality of the plugin, they also help to fund further development of the core (free) plugin.
52
-
53
- [Browse available add-ons for Boxzilla](https://boxzillaplugin.com/add-ons/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
54
-
55
- #### Contributing and reporting bugs=
56
-
57
- You can contribute to [Boxzilla on GitHub](https://github.com/ibericode/boxzilla).
58
 
59
  #### Support
60
 
61
- Please use the [WordPress.org plugin support forums](https://wordpress.org/support/plugin/boxzilla) for community support where we try to help all users.
62
 
63
- If you think you've found a bug, please [report it on GitHub](https://github.com/ibericode/boxzilla/issues).
64
-
65
- If you're on [one of the available premium plans](https://boxzillaplugin.com/pricing#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description), please use the support email for a faster reply.
66
 
67
  == Frequently Asked Questions ==
68
 
69
  = What does this plugin do? =
70
 
71
- Have a look at the [Boxzilla demo site](https://demo.boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
72
 
73
  = How to display a form in the box? =
74
 
75
- Boxzilla will work with any plugin that offers shortcodes, like [MailChimp for WordPress](https://wordpress.org/plugins/mailchimp-for-wp/).
76
 
77
  = Can I have a box open after clicking a certain link or button? =
78
 
79
- Sure, by linking to the box element.
80
 
81
- *Example (box ID is 94 in this example)*
82
  `
83
  <a href="#boxzilla-94">Open Box</a>
84
  `
85
 
86
- = Can I have a box to open right after opening a page? =
87
-
88
- Sure, just include `boxzilla-` followed by the box ID in the URL.
89
 
90
- *Example (box ID is 94 in this example)*
91
- `
92
- http://your-wordpress-site.com/some-page/#boxzilla-94
93
- `
94
 
95
  = Can I customize the appearance of a box =
96
 
97
- Boxzilla comes with a simple interface for customizing most box colors & borders. You can apply your own CSS by utilizing any of the following element selectors.
98
 
99
  `
100
  .boxzilla { } /* all boxes */
101
- .boxzilla-5 { } /* box with ID 5 */
102
  `
103
 
104
  = I want to disable auto-paragraphs in the box content =
105
 
106
- All default WordPress filters are added to the `stb_content` filter hook. If you want to remove any of them, add the respectable line to your theme its `functions.php` file.
107
 
108
  `
109
  remove_filter( 'boxzilla_box_content', 'wptexturize') ;
@@ -114,13 +100,6 @@ remove_filter( 'boxzilla_box_content', 'do_shortcode' );
114
  remove_filter( 'boxzilla_box_content', 'shortcode_unautop' );
115
  `
116
 
117
- = I want to make it impossible to close a box =
118
- `
119
- add_filter( 'boxzilla_box_options', function( $opts, $box ) {
120
- $opts['closable'] = false;
121
- return $opts;
122
- }, 10, 2 );
123
- `
124
 
125
  == Installation ==
126
 
@@ -129,6 +108,7 @@ add_filter( 'boxzilla_box_options', function( $opts, $box ) {
129
  1. In your WordPress admin panel, go to *Plugins > New Plugin*, search for *Boxzilla* and click "Install now"
130
  1. Alternatively, download the plugin and upload the contents of `boxzilla.zip` to your plugins directory, which usually is `/wp-content/plugins/`.
131
  1. Activate the plugin.
 
132
 
133
  = Creating a Boxzilla box =
134
 
@@ -142,14 +122,22 @@ Have a look at the [frequently asked questions](https://wordpress.org/plugins/bo
142
 
143
  == Screenshots ==
144
 
145
- 1. A scroll triggered box with a newsletter sign-up form.
146
- 2. Another scroll triggered box, this time with social media sharing options.
147
- 3. A differently styled social triggered box.
148
- 4. Configuring and customizing your boxes is easy.
149
 
150
  == Changelog ==
151
 
152
 
 
 
 
 
 
 
 
 
153
  #### 3.2.7 - July 31, 2018
154
 
155
  **Fixes**
3
  Donate link: https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=donate-link
4
  Tags: scroll triggered box, cta, social, pop-up, newsletter, call to action, mailchimp, contact form 7, social media, mc4wp, ibericode
5
  Requires at least: 4.1
6
+ Tested up to: 5.0.2
7
+ Stable tag: 3.2.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Requires PHP: 5.3
11
 
12
+ Flexible pop-ups or slide-ins, showing up at just the right time.
13
 
14
  == Description ==
15
 
16
  ### Boxzilla for WordPress
17
 
18
+ Boxzilla is a plugin that allows you to add powerful call-to-actions via pop-up or slide-in boxes to your WordPress site. Boxes can slide or fade in at any point and can contain whatever content you like.
19
 
20
  #### Some of Boxzilla's features
21
 
22
  - Boxes can contain _any_ content you like.
23
+ - You can set-up various box triggers:
24
  - Scroll percentage
25
  - Reaching a certain page element
26
  - X amount of time on the page
36
 
37
  [Read more about Boxzilla](https://boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
38
 
39
+ > #### Premium add-ons for Boxzilla
40
+ >
41
+ > The Boxzilla plugin itself is entirely free. Advanced functionality is available through several paid add-ons. Not only do they extend the core functionality of the plugin, they also help to fund further development of the core (free) plugin.
42
+ >
43
+ > [Browse available add-ons for Boxzilla](https://boxzillaplugin.com/add-ons/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
44
 
45
  #### Documentation
46
 
47
+ Please have a look at the [Boxzilla Knowledge Base](https://kb.boxzillaplugin.com/).
48
 
49
  #### Demo
50
 
51
+ There's a [Boxzilla demo site](https://demo.boxzillaplugin.com#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description) with some examples.
 
 
 
 
 
 
 
 
 
 
52
 
53
  #### Support
54
 
55
+ Please use the [WordPress.org plugin support forums](https://wordpress.org/support/plugin/boxzilla) for community support.
56
 
57
+ If you're a [Boxzilla Premium customer](https://boxzillaplugin.com/pricing#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description), please use our support email for a faster reply.
 
 
58
 
59
  == Frequently Asked Questions ==
60
 
61
  = What does this plugin do? =
62
 
63
+ Pop-ups. Have a look at the [Boxzilla demo site](https://demo.boxzillaplugin.com/#utm_source=wp-plugin-repo&utm_medium=boxzilla&utm_campaign=description).
64
 
65
  = How to display a form in the box? =
66
 
67
+ Boxzilla will work with any plugin that allows for shortcodes, like [MailChimp for WordPress](https://wordpress.org/plugins/mailchimp-for-wp/) or [HTML Forms](https://wordpress.org/plugins/html-forms/).
68
 
69
  = Can I have a box open after clicking a certain link or button? =
70
 
71
+ Yes, you can create a link that refers the box ID. For example, if your box has an ID of 94.
72
 
 
73
  `
74
  <a href="#boxzilla-94">Open Box</a>
75
  `
76
 
77
+ = Can I have a box open right after loading a page? =
 
 
78
 
79
+ You can configure this in the box settings. Or you can add `#boxzilla-13` to your URL, where 13 is the ID of the box you want to show.
 
 
 
80
 
81
  = Can I customize the appearance of a box =
82
 
83
+ Boxzilla comes with a simple interface for customizing the pop-up appearance. But you can also use your own custom CSS if needed.
84
 
85
  `
86
  .boxzilla { } /* all boxes */
87
+ .boxzilla-5 { } /* only the box with ID 5 */
88
  `
89
 
90
  = I want to disable auto-paragraphs in the box content =
91
 
92
+ All default WordPress filters are added to the `boxzilla_box_content` filter hook. The example below shows how to remove them.
93
 
94
  `
95
  remove_filter( 'boxzilla_box_content', 'wptexturize') ;
100
  remove_filter( 'boxzilla_box_content', 'shortcode_unautop' );
101
  `
102
 
 
 
 
 
 
 
 
103
 
104
  == Installation ==
105
 
108
  1. In your WordPress admin panel, go to *Plugins > New Plugin*, search for *Boxzilla* and click "Install now"
109
  1. Alternatively, download the plugin and upload the contents of `boxzilla.zip` to your plugins directory, which usually is `/wp-content/plugins/`.
110
  1. Activate the plugin.
111
+ 1. (Optional) Install some [add-on plugins for Boxzilla](https://boxzillaplugin.com/add-ons/)
112
 
113
  = Creating a Boxzilla box =
114
 
122
 
123
  == Screenshots ==
124
 
125
+ 1. A Boxzilla pop-up with a newsletter sign-up form.
126
+ 3. Another Boxzilla pop-up, with different styles.
127
+ 4. Screenshot of the page to manage a Boxzilla pop-up.
128
+
129
 
130
  == Changelog ==
131
 
132
 
133
+ #### 3.2.9 - December 5, 2018
134
+
135
+ **Improvements**
136
+
137
+ - Make sure preview updates with correct color values when applying box styles.
138
+ - Use small margin of error to prevent iOS scroll bounce from closing box again.
139
+
140
+
141
  #### 3.2.7 - July 31, 2018
142
 
143
  **Fixes**
src/licensing/class-update-manager.php CHANGED
@@ -178,10 +178,16 @@ class UpdateManager {
178
  // find new versions
179
  foreach( $remote_plugins as $remote_plugin ) {
180
 
 
181
  if( ! isset( $this->extensions[ $remote_plugin->sid ] ) ) {
182
  continue;
183
  }
184
 
 
 
 
 
 
185
  // find corresponding local plugin
186
  /** @var Plugin $local_plugin */
187
  $local_plugin = $this->extensions[ $remote_plugin->sid ];
178
  // find new versions
179
  foreach( $remote_plugins as $remote_plugin ) {
180
 
181
+ // only act on update info of our own plugins
182
  if( ! isset( $this->extensions[ $remote_plugin->sid ] ) ) {
183
  continue;
184
  }
185
 
186
+ // sanity check
187
+ if ( ! isset( $remote_plugin->new_version ) ) {
188
+ continue;
189
+ }
190
+
191
  // find corresponding local plugin
192
  /** @var Plugin $local_plugin */
193
  $local_plugin = $this->extensions[ $remote_plugin->sid ];
vendor/composer/ClassLoader.php CHANGED
@@ -279,7 +279,7 @@ class ClassLoader
279
  */
280
  public function setApcuPrefix($apcuPrefix)
281
  {
282
- $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
  }
284
 
285
  /**
@@ -377,11 +377,11 @@ class ClassLoader
377
  $subPath = $class;
378
  while (false !== $lastPos = strrpos($subPath, '\\')) {
379
  $subPath = substr($subPath, 0, $lastPos);
380
- $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
 
382
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
383
- $length = $this->prefixLengthsPsr4[$first][$search];
384
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
385
  return $file;
386
  }
387
  }
279
  */
280
  public function setApcuPrefix($apcuPrefix)
281
  {
282
+ $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283
  }
284
 
285
  /**
377
  $subPath = $class;
378
  while (false !== $lastPos = strrpos($subPath, '\\')) {
379
  $subPath = substr($subPath, 0, $lastPos);
380
+ $search = $subPath . '\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
 
385
  return $file;
386
  }
387
  }
vendor/composer/autoload_classmap.php CHANGED
@@ -16,7 +16,6 @@ return array(
16
  'Boxzilla\\BoxLoader' => $baseDir . '/src/class-loader.php',
17
  'Boxzilla\\Boxzilla' => $baseDir . '/src/class-boxzilla.php',
18
  'Boxzilla\\BoxzillaServiceProvider' => $baseDir . '/src/class-boxzilla-service-provider.php',
19
- 'Boxzilla\\Collection' => $baseDir . '/src/class-collection.php',
20
  'Boxzilla\\DI\\Container' => $baseDir . '/src/di/class-container.php',
21
  'Boxzilla\\DI\\ContainerWithPropertyAccess' => $baseDir . '/src/di/class-container-with-property-access.php',
22
  'Boxzilla\\DI\\ServiceProviderInterface' => $baseDir . '/src/di/interface-service-provider.php',
16
  'Boxzilla\\BoxLoader' => $baseDir . '/src/class-loader.php',
17
  'Boxzilla\\Boxzilla' => $baseDir . '/src/class-boxzilla.php',
18
  'Boxzilla\\BoxzillaServiceProvider' => $baseDir . '/src/class-boxzilla-service-provider.php',
 
19
  'Boxzilla\\DI\\Container' => $baseDir . '/src/di/class-container.php',
20
  'Boxzilla\\DI\\ContainerWithPropertyAccess' => $baseDir . '/src/di/class-container-with-property-access.php',
21
  'Boxzilla\\DI\\ServiceProviderInterface' => $baseDir . '/src/di/interface-service-provider.php',
vendor/composer/autoload_static.php CHANGED
@@ -21,7 +21,6 @@ class ComposerStaticInit38e5bd5c00bdfd9a6ae58e314c6ae5ae
21
  'Boxzilla\\BoxLoader' => __DIR__ . '/../..' . '/src/class-loader.php',
22
  'Boxzilla\\Boxzilla' => __DIR__ . '/../..' . '/src/class-boxzilla.php',
23
  'Boxzilla\\BoxzillaServiceProvider' => __DIR__ . '/../..' . '/src/class-boxzilla-service-provider.php',
24
- 'Boxzilla\\Collection' => __DIR__ . '/../..' . '/src/class-collection.php',
25
  'Boxzilla\\DI\\Container' => __DIR__ . '/../..' . '/src/di/class-container.php',
26
  'Boxzilla\\DI\\ContainerWithPropertyAccess' => __DIR__ . '/../..' . '/src/di/class-container-with-property-access.php',
27
  'Boxzilla\\DI\\ServiceProviderInterface' => __DIR__ . '/../..' . '/src/di/interface-service-provider.php',
21
  'Boxzilla\\BoxLoader' => __DIR__ . '/../..' . '/src/class-loader.php',
22
  'Boxzilla\\Boxzilla' => __DIR__ . '/../..' . '/src/class-boxzilla.php',
23
  'Boxzilla\\BoxzillaServiceProvider' => __DIR__ . '/../..' . '/src/class-boxzilla-service-provider.php',
 
24
  'Boxzilla\\DI\\Container' => __DIR__ . '/../..' . '/src/di/class-container.php',
25
  'Boxzilla\\DI\\ContainerWithPropertyAccess' => __DIR__ . '/../..' . '/src/di/class-container-with-property-access.php',
26
  'Boxzilla\\DI\\ServiceProviderInterface' => __DIR__ . '/../..' . '/src/di/interface-service-provider.php',