Boxzilla - Version 3.1.8

Version Description

Download this release

Release Info

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

Code changes from version 3.1.7 to 3.1.8

Files changed (86) hide show
  1. assets/browserify/admin/_admin.js +119 -117
  2. assets/browserify/script.js +79 -71
  3. assets/js/admin-script.js +157 -142
  4. assets/js/admin-script.min.js +1 -1
  5. assets/js/admin-script.min.js.map +1 -1
  6. assets/js/script.js +268 -236
  7. assets/js/script.min.js +1 -1
  8. assets/js/script.min.js.map +1 -1
  9. boxzilla.php +2 -2
  10. readme.txt +10 -2
  11. trunk/LICENSE +0 -339
  12. trunk/assets/browserify/admin-script.js +0 -1
  13. trunk/assets/browserify/admin/_admin.js +0 -123
  14. trunk/assets/browserify/admin/_designer.js +0 -109
  15. trunk/assets/browserify/admin/_option.js +0 -56
  16. trunk/assets/browserify/script.js +0 -93
  17. trunk/assets/css/admin-styles.css +0 -127
  18. trunk/assets/css/admin-styles.min.css +0 -1
  19. trunk/assets/css/index.php +0 -7
  20. trunk/assets/img/index.php +0 -6
  21. trunk/assets/img/menu-icon.jpg +0 -0
  22. trunk/assets/img/menu-icon.png +0 -0
  23. trunk/assets/index.php +0 -6
  24. trunk/assets/js/admin-script.js +0 -785
  25. trunk/assets/js/admin-script.min.js +0 -2
  26. trunk/assets/js/admin-script.min.js.map +0 -1
  27. trunk/assets/js/index.php +0 -6
  28. trunk/assets/js/script.js +0 -1458
  29. trunk/assets/js/script.min.js +0 -2
  30. trunk/assets/js/script.min.js.map +0 -1
  31. trunk/assets/scss/admin-styles.scss +0 -173
  32. trunk/bootstrap.php +0 -51
  33. trunk/boxzilla.php +0 -68
  34. trunk/languages/boxzilla-es_ES.mo +0 -0
  35. trunk/languages/boxzilla-es_ES.po +0 -212
  36. trunk/languages/boxzilla-fr_FR.mo +0 -0
  37. trunk/languages/boxzilla-fr_FR.po +0 -211
  38. trunk/languages/boxzilla-nl_NL.mo +0 -0
  39. trunk/languages/boxzilla-nl_NL.po +0 -209
  40. trunk/languages/boxzilla.pot +0 -407
  41. trunk/readme.txt +0 -286
  42. trunk/src/admin/class-admin.php +0 -764
  43. trunk/src/admin/class-autocomplete.php +0 -95
  44. trunk/src/admin/class-installer.php +0 -93
  45. trunk/src/admin/class-migrations.php +0 -96
  46. trunk/src/admin/class-notices.php +0 -42
  47. trunk/src/admin/class-review-notice.php +0 -96
  48. trunk/src/admin/migrations/3.1-cookie-option.php +0 -24
  49. trunk/src/admin/views/extensions.php +0 -60
  50. trunk/src/admin/views/metaboxes/box-appearance-controls.php +0 -46
  51. trunk/src/admin/views/metaboxes/box-option-controls.php +0 -218
  52. trunk/src/admin/views/metaboxes/email-optin.php +0 -23
  53. trunk/src/admin/views/metaboxes/need-help.php +0 -8
  54. trunk/src/admin/views/settings.php +0 -56
  55. trunk/src/class-bootstrapper.php +0 -103
  56. trunk/src/class-box.php +0 -231
  57. trunk/src/class-boxzilla-service-provider.php +0 -69
  58. trunk/src/class-boxzilla.php +0 -20
  59. trunk/src/class-collection.php +0 -154
  60. trunk/src/class-loader.php +0 -299
  61. trunk/src/class-php-fallback.php +0 -62
  62. trunk/src/class-plugin.php +0 -109
  63. trunk/src/default-actions.php +0 -33
  64. trunk/src/default-filters.php +0 -10
  65. trunk/src/di/class-container-with-property-access.php +0 -54
  66. trunk/src/di/class-container.php +0 -281
  67. trunk/src/di/interface-service-provider.php +0 -46
  68. trunk/src/functions.php +0 -17
  69. trunk/src/licensing/class-api-exception.php +0 -33
  70. trunk/src/licensing/class-api.php +0 -174
  71. trunk/src/licensing/class-license-manager.php +0 -166
  72. trunk/src/licensing/class-license-service-provider.php +0 -39
  73. trunk/src/licensing/class-license.php +0 -114
  74. trunk/src/licensing/class-poller.php +0 -67
  75. trunk/src/licensing/class-update-manager.php +0 -226
  76. trunk/src/licensing/views/license-form.php +0 -57
  77. trunk/vendor/autoload.php +0 -7
  78. trunk/vendor/composer/ClassLoader.php +0 -415
  79. trunk/vendor/composer/LICENSE +0 -21
  80. trunk/vendor/composer/autoload_classmap.php +0 -33
  81. trunk/vendor/composer/autoload_files.php +0 -10
  82. trunk/vendor/composer/autoload_namespaces.php +0 -9
  83. trunk/vendor/composer/autoload_psr4.php +0 -9
  84. trunk/vendor/composer/autoload_real.php +0 -70
  85. trunk/vendor/composer/autoload_static.php +0 -47
  86. trunk/vendor/composer/installed.json +0 -1
assets/browserify/admin/_admin.js CHANGED
@@ -1,121 +1,123 @@
1
- 'use strict';
2
-
3
- var $ = window.jQuery;
4
- var Option = require('./_option.js');
5
- var optionControls = document.getElementById('boxzilla-box-options-controls');
6
- var $optionControls = $(optionControls);
7
-
8
- // sanity check, are we on the correct page?
9
- if( $optionControls.length === 0 ) {
10
- return;
11
- }
12
-
13
- var EventEmitter = require('wolfy87-eventemitter');
14
- var events = new EventEmitter();
15
- var Designer = require('./_designer.js')($, Option, events);
16
- var rowTemplate = wp.template('rule-row-template');
17
- var i18n = boxzilla_i18n;
18
-
19
- // events
20
- $optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
21
- $optionControls.on('click', ".boxzilla-remove-rule", removeRule);
22
- $optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
23
- $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions );
24
-
25
- $(window).load(function() {
26
- if( typeof(window.tinyMCE) === "undefined" ) {
27
- document.getElementById('notice-notinymce').style.display = '';
28
  }
29
- });
30
-
31
- // call contextual helper method for each row
32
- $('.boxzilla-rule-row').each(setContextualHelpers);
33
-
34
- function toggleTriggerOptions() {
35
- $optionControls.find('.boxzilla-trigger-options').toggle( this.value !== '' );
36
- }
37
-
38
- function removeRule() {
39
- $(this).parents('tr').remove();
40
- }
41
-
42
- function setContextualHelpers() {
43
-
44
- var context = ( this.tagName.toLowerCase() === "tr" ) ? this : $(this).parents('tr').get(0);
45
- var condition = context.querySelector('.boxzilla-rule-condition').value;
46
- var valueInput = context.querySelector('.boxzilla-rule-value');
47
- var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
48
- var betterInput = valueInput.cloneNode(true);
49
- var $betterInput = $(betterInput);
50
-
51
- // remove previously added helpers
52
- $(context.querySelectorAll('.boxzilla-helper')).remove();
53
-
54
- // prepare better input
55
- betterInput.removeAttribute('name');
56
- betterInput.className = betterInput.className + ' boxzilla-helper';
57
- valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
58
- $betterInput.change(function() { valueInput.value = this.value; });
59
-
60
- betterInput.style.display = '';
61
- valueInput.style.display = 'none';
62
- qualifierInput.style.display = '';
63
-
64
- // change placeholder for textual help
65
- switch(condition) {
66
- default:
67
- betterInput.placeholder = i18n.enterCommaSeparatedValues;
68
- break;
69
-
70
- case '':
71
- case 'everywhere':
72
- qualifierInput.value = '1';
73
- valueInput.value = '';
74
- betterInput.style.display = 'none';
75
- qualifierInput.style.display = 'none';
76
- break;
77
-
78
- case 'is_single':
79
- case 'is_post':
80
- betterInput.placeholder = i18n.enterCommaSeparatedPosts;
81
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", {multiple:true, multipleSep: ","});
82
- break;
83
-
84
- case 'is_page':
85
- betterInput.placeholder = i18n.enterCommaSeparatedPages;
86
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {multiple:true, multipleSep: ","});
87
- break;
88
-
89
- case 'is_post_type':
90
- betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
91
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", {multiple:true, multipleSep: ","});
92
- break;
93
-
94
- case 'is_url':
95
- betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
96
- break;
97
-
98
- case 'is_post_in_category':
99
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {multiple:true, multipleSep: ","});
100
- break;
101
-
102
- case 'is_post_with_tag':
103
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {multiple:true, multipleSep: ","});
104
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
- }
107
 
108
- function addRuleFields() {
109
- var data = {
110
- 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length
 
111
  };
112
- var html = rowTemplate(data);
113
- $(document.getElementById('boxzilla-box-rules')).after(html);
114
- return false;
115
- }
116
-
117
- module.exports = {
118
- 'Designer': Designer,
119
- 'Option': Option,
120
- 'events': events
121
- };
1
+ (function() {
2
+ 'use strict';
3
+
4
+ var $ = window.jQuery;
5
+ var Option = require('./_option.js');
6
+ var optionControls = document.getElementById('boxzilla-box-options-controls');
7
+ var $optionControls = $(optionControls);
8
+
9
+ // sanity check, are we on the correct page?
10
+ if( $optionControls.length === 0 ) {
11
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  }
13
+
14
+ var EventEmitter = require('wolfy87-eventemitter');
15
+ var events = new EventEmitter();
16
+ var Designer = require('./_designer.js')($, Option, events);
17
+ var rowTemplate = wp.template('rule-row-template');
18
+ var i18n = boxzilla_i18n;
19
+
20
+ // events
21
+ $optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
22
+ $optionControls.on('click', ".boxzilla-remove-rule", removeRule);
23
+ $optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
24
+ $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions );
25
+
26
+ $(window).load(function() {
27
+ if( typeof(window.tinyMCE) === "undefined" ) {
28
+ document.getElementById('notice-notinymce').style.display = '';
29
+ }
30
+ });
31
+
32
+ // call contextual helper method for each row
33
+ $('.boxzilla-rule-row').each(setContextualHelpers);
34
+
35
+ function toggleTriggerOptions() {
36
+ $optionControls.find('.boxzilla-trigger-options').toggle( this.value !== '' );
37
+ }
38
+
39
+ function removeRule() {
40
+ $(this).parents('tr').remove();
41
+ }
42
+
43
+ function setContextualHelpers() {
44
+
45
+ var context = ( this.tagName.toLowerCase() === "tr" ) ? this : $(this).parents('tr').get(0);
46
+ var condition = context.querySelector('.boxzilla-rule-condition').value;
47
+ var valueInput = context.querySelector('.boxzilla-rule-value');
48
+ var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
49
+ var betterInput = valueInput.cloneNode(true);
50
+ var $betterInput = $(betterInput);
51
+
52
+ // remove previously added helpers
53
+ $(context.querySelectorAll('.boxzilla-helper')).remove();
54
+
55
+ // prepare better input
56
+ betterInput.removeAttribute('name');
57
+ betterInput.className = betterInput.className + ' boxzilla-helper';
58
+ valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
59
+ $betterInput.change(function() { valueInput.value = this.value; });
60
+
61
+ betterInput.style.display = '';
62
+ valueInput.style.display = 'none';
63
+ qualifierInput.style.display = '';
64
+
65
+ // change placeholder for textual help
66
+ switch(condition) {
67
+ default:
68
+ betterInput.placeholder = i18n.enterCommaSeparatedValues;
69
+ break;
70
+
71
+ case '':
72
+ case 'everywhere':
73
+ qualifierInput.value = '1';
74
+ valueInput.value = '';
75
+ betterInput.style.display = 'none';
76
+ qualifierInput.style.display = 'none';
77
+ break;
78
+
79
+ case 'is_single':
80
+ case 'is_post':
81
+ betterInput.placeholder = i18n.enterCommaSeparatedPosts;
82
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", {multiple:true, multipleSep: ","});
83
+ break;
84
+
85
+ case 'is_page':
86
+ betterInput.placeholder = i18n.enterCommaSeparatedPages;
87
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {multiple:true, multipleSep: ","});
88
+ break;
89
+
90
+ case 'is_post_type':
91
+ betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
92
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", {multiple:true, multipleSep: ","});
93
+ break;
94
+
95
+ case 'is_url':
96
+ betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
97
+ break;
98
+
99
+ case 'is_post_in_category':
100
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {multiple:true, multipleSep: ","});
101
+ break;
102
+
103
+ case 'is_post_with_tag':
104
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {multiple:true, multipleSep: ","});
105
+ break;
106
+ }
107
+ }
108
+
109
+ function addRuleFields() {
110
+ var data = {
111
+ 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length
112
+ };
113
+ var html = rowTemplate(data);
114
+ $(document.getElementById('boxzilla-box-rules')).after(html);
115
+ return false;
116
  }
 
117
 
118
+ module.exports = {
119
+ 'Designer': Designer,
120
+ 'Option': Option,
121
+ 'events': events
122
  };
123
+ })();
 
 
 
 
 
 
 
 
 
assets/browserify/script.js CHANGED
@@ -1,85 +1,93 @@
1
- 'use strict';
2
-
3
- var Boxzilla = require('boxzilla');
4
- var options = window.boxzilla_options;
5
- var isLoggedIn = document.body.className.indexOf('logged-in') > -1;
6
-
7
- // print message when test mode is enabled
8
- if( isLoggedIn && options.testMode ) {
9
- console.log( 'Boxzilla: Test mode is enabled. Please disable test mode if you\'re done testing.' );
10
- }
11
-
12
- // init boxzilla
13
- Boxzilla.init();
14
-
15
- // create boxes from options
16
- for( var i=0; i < options.boxes.length; i++ ) {
17
- // get opts
18
- var boxOpts = options.boxes[i];
19
- boxOpts.testMode = isLoggedIn && options.testMode;
20
-
21
- // fix http:// links in box content....
22
- if( window.location.protocol === "https:" && window.location.host ) {
23
- var o = "http://" + window.location.host;
24
- var n = old.replace('http://', 'https://');
25
- boxOpts.content = boxOpts.content.replace(o, n);
26
- }
27
-
28
- // create box
29
- var box = Boxzilla.create( boxOpts.id, boxOpts);
30
-
31
- // add custom css to box
32
- css(box.element, boxOpts.css);
33
 
34
- box.element.firstChild.firstChild.className += " first-child";
35
- box.element.firstChild.lastChild.className += " last-child";
36
- }
37
 
38
- // helper function for setting CSS styles
39
- function css(element, styles) {
40
- if( styles.background_color ) {
41
- element.style.background = styles.background_color;
42
  }
43
 
44
- if( styles.color ) {
45
- element.style.color = styles.color;
 
46
  }
47
 
48
- if( styles.border_color ) {
49
- element.style.borderColor = styles.border_color;
50
- }
51
 
52
- if( styles.border_width ) {
53
- element.style.borderWidth = parseInt(styles.border_width) + "px";
54
- }
 
 
 
 
 
 
 
 
 
55
 
56
- if( styles.border_style ) {
57
- element.style.borderStyle = styles.border_style;
 
 
 
 
 
 
58
  }
59
 
60
- if( styles.width ) {
61
- element.style.maxWidth = parseInt(styles.width) + "px";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
- }
64
-
65
- /**
66
- * If a MailChimp for WordPress form was submitted, open the box containing that form (if any)
67
- *
68
- * TODO: Just set location hash from MailChimp for WP?
69
- */
70
- window.addEventListener('load', function() {
71
- if( typeof(window.mc4wp_forms_config) === "object" && window.mc4wp_forms_config.submitted_form ) {
72
- var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;
73
- var boxes = Boxzilla.boxes;
74
- for( var boxId in boxes ) {
75
- if(!boxes.hasOwnProperty(boxId)) { continue; }
76
- var box = boxes[boxId];
77
- if( box.element.querySelector(selector)) {
78
- box.show();
79
- return;
80
  }
81
  }
82
- }
83
- });
84
 
85
- window.Boxzilla = Boxzilla;
 
 
1
+ (function() {
2
+ 'use strict';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
+ var Boxzilla = require('boxzilla');
5
+ var options = window.boxzilla_options;
6
+ var isLoggedIn = document.body.className.indexOf('logged-in') > -1;
7
 
8
+ // failsafe against including script twice.
9
+ if( options.inited ) {
10
+ return;
 
11
  }
12
 
13
+ // print message when test mode is enabled
14
+ if( isLoggedIn && options.testMode ) {
15
+ console.log( 'Boxzilla: Test mode is enabled. Please disable test mode if you\'re done testing.' );
16
  }
17
 
18
+ // init boxzilla
19
+ Boxzilla.init();
 
20
 
21
+ // create boxes from options
22
+ for( var i=0; i < options.boxes.length; i++ ) {
23
+ // get opts
24
+ var boxOpts = options.boxes[i];
25
+ boxOpts.testMode = isLoggedIn && options.testMode;
26
+
27
+ // fix http:// links in box content....
28
+ if( window.location.protocol === "https:" && window.location.host ) {
29
+ var o = "http://" + window.location.host;
30
+ var n = o.replace('http://', 'https://');
31
+ boxOpts.content = boxOpts.content.replace(o, n);
32
+ }
33
 
34
+ // create box
35
+ var box = Boxzilla.create( boxOpts.id, boxOpts);
36
+
37
+ // add custom css to box
38
+ css(box.element, boxOpts.css);
39
+
40
+ box.element.firstChild.firstChild.className += " first-child";
41
+ box.element.firstChild.lastChild.className += " last-child";
42
  }
43
 
44
+ // helper function for setting CSS styles
45
+ function css(element, styles) {
46
+ if( styles.background_color ) {
47
+ element.style.background = styles.background_color;
48
+ }
49
+
50
+ if( styles.color ) {
51
+ element.style.color = styles.color;
52
+ }
53
+
54
+ if( styles.border_color ) {
55
+ element.style.borderColor = styles.border_color;
56
+ }
57
+
58
+ if( styles.border_width ) {
59
+ element.style.borderWidth = parseInt(styles.border_width) + "px";
60
+ }
61
+
62
+ if( styles.border_style ) {
63
+ element.style.borderStyle = styles.border_style;
64
+ }
65
+
66
+ if( styles.width ) {
67
+ element.style.maxWidth = parseInt(styles.width) + "px";
68
+ }
69
  }
70
+
71
+ /**
72
+ * If a MailChimp for WordPress form was submitted, open the box containing that form (if any)
73
+ *
74
+ * TODO: Just set location hash from MailChimp for WP?
75
+ */
76
+ window.addEventListener('load', function() {
77
+ if( typeof(window.mc4wp_forms_config) === "object" && window.mc4wp_forms_config.submitted_form ) {
78
+ var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;
79
+ var boxes = Boxzilla.boxes;
80
+ for( var boxId in boxes ) {
81
+ if(!boxes.hasOwnProperty(boxId)) { continue; }
82
+ var box = boxes[boxId];
83
+ if( box.element.querySelector(selector)) {
84
+ box.show();
85
+ return;
86
+ }
87
  }
88
  }
89
+ });
 
90
 
91
+ options.inited = true;
92
+ window.Boxzilla = Boxzilla;
93
+ })();
assets/js/admin-script.js CHANGED
@@ -1,137 +1,151 @@
1
  (function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
 
 
2
  window.Boxzilla_Admin = require('./admin/_admin.js');
 
3
  },{"./admin/_admin.js":2}],2:[function(require,module,exports){
4
  'use strict';
5
 
6
- var $ = window.jQuery;
7
- var Option = require('./_option.js');
8
- var optionControls = document.getElementById('boxzilla-box-options-controls');
9
- var $optionControls = $(optionControls);
10
-
11
- // sanity check, are we on the correct page?
12
- if( $optionControls.length === 0 ) {
13
- return;
14
- }
15
-
16
- var EventEmitter = require('wolfy87-eventemitter');
17
- var events = new EventEmitter();
18
- var Designer = require('./_designer.js')($, Option, events);
19
- var rowTemplate = wp.template('rule-row-template');
20
- var i18n = boxzilla_i18n;
21
-
22
- // events
23
- $optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
24
- $optionControls.on('click', ".boxzilla-remove-rule", removeRule);
25
- $optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
26
- $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions );
27
-
28
- $(window).load(function() {
29
- if( typeof(window.tinyMCE) === "undefined" ) {
30
- document.getElementById('notice-notinymce').style.display = '';
31
  }
32
- });
33
-
34
- // call contextual helper method for each row
35
- $('.boxzilla-rule-row').each(setContextualHelpers);
36
-
37
- function toggleTriggerOptions() {
38
- $optionControls.find('.boxzilla-trigger-options').toggle( this.value !== '' );
39
- }
40
-
41
- function removeRule() {
42
- $(this).parents('tr').remove();
43
- }
44
-
45
- function setContextualHelpers() {
46
-
47
- var context = ( this.tagName.toLowerCase() === "tr" ) ? this : $(this).parents('tr').get(0);
48
- var condition = context.querySelector('.boxzilla-rule-condition').value;
49
- var valueInput = context.querySelector('.boxzilla-rule-value');
50
- var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
51
- var betterInput = valueInput.cloneNode(true);
52
- var $betterInput = $(betterInput);
53
-
54
- // remove previously added helpers
55
- $(context.querySelectorAll('.boxzilla-helper')).remove();
56
-
57
- // prepare better input
58
- betterInput.removeAttribute('name');
59
- betterInput.className = betterInput.className + ' boxzilla-helper';
60
- valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
61
- $betterInput.change(function() { valueInput.value = this.value; });
62
-
63
- betterInput.style.display = '';
64
- valueInput.style.display = 'none';
65
- qualifierInput.style.display = '';
66
-
67
- // change placeholder for textual help
68
- switch(condition) {
69
- default:
70
- betterInput.placeholder = i18n.enterCommaSeparatedValues;
71
- break;
72
-
73
- case '':
74
- case 'everywhere':
75
- qualifierInput.value = '1';
76
- valueInput.value = '';
77
- betterInput.style.display = 'none';
78
- qualifierInput.style.display = 'none';
79
- break;
80
-
81
- case 'is_single':
82
- case 'is_post':
83
- betterInput.placeholder = i18n.enterCommaSeparatedPosts;
84
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", {multiple:true, multipleSep: ","});
85
- break;
86
-
87
- case 'is_page':
88
- betterInput.placeholder = i18n.enterCommaSeparatedPages;
89
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {multiple:true, multipleSep: ","});
90
- break;
91
-
92
- case 'is_post_type':
93
- betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
94
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", {multiple:true, multipleSep: ","});
95
- break;
96
-
97
- case 'is_url':
98
- betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
99
- break;
100
-
101
- case 'is_post_in_category':
102
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {multiple:true, multipleSep: ","});
103
- break;
104
-
105
- case 'is_post_with_tag':
106
- $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {multiple:true, multipleSep: ","});
107
- break;
108
  }
109
- }
110
 
111
- function addRuleFields() {
112
- var data = {
113
- 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  };
115
- var html = rowTemplate(data);
116
- $(document.getElementById('boxzilla-box-rules')).after(html);
117
- return false;
118
- }
119
-
120
- module.exports = {
121
- 'Designer': Designer,
122
- 'Option': Option,
123
- 'events': events
124
- };
125
 
126
  },{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(require,module,exports){
127
- var Designer = function($, Option, events) {
 
 
 
 
128
 
129
  // vars
130
  var boxId = document.getElementById('post_ID').value || 0,
131
- $editor, $editorFrame,
132
- $innerEditor,
133
- options = {},
134
- visualEditorInitialised = false;
 
135
 
136
  var $appearanceControls = $("#boxzilla-box-appearance-controls");
137
 
@@ -147,7 +161,7 @@ var Designer = function($, Option, events) {
147
  function init() {
148
 
149
  // Only run if TinyMCE has actually inited
150
- if( typeof( window.tinyMCE ) !== "object" || tinyMCE.get('content') === null ) {
151
  return;
152
  }
153
 
@@ -178,13 +192,13 @@ var Designer = function($, Option, events) {
178
  }
179
 
180
  /**
181
- * Applies the styles from the options to the TinyMCE Editor
182
- *
183
- * @return bool
184
- */
185
  function applyStyles() {
186
 
187
- if( ! visualEditorInitialised ) {
188
  return false;
189
  }
190
 
@@ -205,8 +219,8 @@ var Designer = function($, Option, events) {
205
  }
206
 
207
  function resetStyles() {
208
- for( var key in options ) {
209
- if( key.substring(0,5) === 'theme' ) {
210
  continue;
211
  }
212
 
@@ -229,32 +243,32 @@ var Designer = function($, Option, events) {
229
  'resetStyles': resetStyles,
230
  'options': options
231
  };
232
-
233
  };
234
 
235
  module.exports = Designer;
 
236
  },{}],4:[function(require,module,exports){
237
  'use strict';
238
 
239
  var $ = window.jQuery;
240
 
241
- var Option = function( element ) {
242
 
243
  // find corresponding element
244
- if( typeof(element) == "string" ) {
245
  element = document.getElementById('boxzilla-' + element);
246
  }
247
 
248
- if( ! element ) {
249
  console.error("Unable to find option element.");
250
  }
251
 
252
  this.element = element;
253
  };
254
 
255
- Option.prototype.getColorValue = function() {
256
- if( this.element.value.length > 0 ) {
257
- if( $(this.element).hasClass('wp-color-field')) {
258
  return $(this.element).wpColorPicker('color');
259
  } else {
260
  return this.element.value;
@@ -264,32 +278,33 @@ Option.prototype.getColorValue = function() {
264
  return '';
265
  };
266
 
267
- Option.prototype.getPxValue = function( fallbackValue ) {
268
- if( this.element.value.length > 0 ) {
269
- return parseInt( this.element.value ) + "px";
270
  }
271
 
272
  return fallbackValue || '';
273
  };
274
 
275
- Option.prototype.getValue = function( fallbackValue ) {
276
 
277
- if( this.element.value.length > 0 ) {
278
  return this.element.value;
279
  }
280
 
281
  return fallbackValue || '';
282
  };
283
 
284
- Option.prototype.clear = function() {
285
  this.element.value = '';
286
  };
287
 
288
- Option.prototype.setValue = function(value) {
289
  this.element.value = value;
290
  };
291
 
292
  module.exports = Option;
 
293
  },{}],5:[function(require,module,exports){
294
  /*!
295
  * EventEmitter v4.2.11 - git.io/ee
1
  (function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
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
+
17
+ // sanity check, are we on the correct page?
18
+ if ($optionControls.length === 0) {
19
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
+
22
+ var EventEmitter = require('wolfy87-eventemitter');
23
+ var events = new EventEmitter();
24
+ var Designer = require('./_designer.js')($, Option, events);
25
+ var rowTemplate = wp.template('rule-row-template');
26
+ var i18n = boxzilla_i18n;
27
+
28
+ // events
29
+ $optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
30
+ $optionControls.on('click', ".boxzilla-remove-rule", removeRule);
31
+ $optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
32
+ $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);
33
+
34
+ $(window).load(function () {
35
+ if (typeof window.tinyMCE === "undefined") {
36
+ document.getElementById('notice-notinymce').style.display = '';
37
+ }
38
+ });
39
+
40
+ // call contextual helper method for each row
41
+ $('.boxzilla-rule-row').each(setContextualHelpers);
42
+
43
+ function toggleTriggerOptions() {
44
+ $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');
45
+ }
46
+
47
+ function removeRule() {
48
+ $(this).parents('tr').remove();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
 
50
 
51
+ function setContextualHelpers() {
52
+
53
+ var context = this.tagName.toLowerCase() === "tr" ? this : $(this).parents('tr').get(0);
54
+ var condition = context.querySelector('.boxzilla-rule-condition').value;
55
+ var valueInput = context.querySelector('.boxzilla-rule-value');
56
+ var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
57
+ var betterInput = valueInput.cloneNode(true);
58
+ var $betterInput = $(betterInput);
59
+
60
+ // remove previously added helpers
61
+ $(context.querySelectorAll('.boxzilla-helper')).remove();
62
+
63
+ // prepare better input
64
+ betterInput.removeAttribute('name');
65
+ betterInput.className = betterInput.className + ' boxzilla-helper';
66
+ valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
67
+ $betterInput.change(function () {
68
+ valueInput.value = this.value;
69
+ });
70
+
71
+ betterInput.style.display = '';
72
+ valueInput.style.display = 'none';
73
+ qualifierInput.style.display = '';
74
+
75
+ // change placeholder for textual help
76
+ switch (condition) {
77
+ default:
78
+ betterInput.placeholder = i18n.enterCommaSeparatedValues;
79
+ break;
80
+
81
+ case '':
82
+ case 'everywhere':
83
+ qualifierInput.value = '1';
84
+ valueInput.value = '';
85
+ betterInput.style.display = 'none';
86
+ qualifierInput.style.display = 'none';
87
+ break;
88
+
89
+ case 'is_single':
90
+ case 'is_post':
91
+ betterInput.placeholder = i18n.enterCommaSeparatedPosts;
92
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", { multiple: true, multipleSep: "," });
93
+ break;
94
+
95
+ case 'is_page':
96
+ betterInput.placeholder = i18n.enterCommaSeparatedPages;
97
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", { multiple: true, multipleSep: "," });
98
+ break;
99
+
100
+ case 'is_post_type':
101
+ betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
102
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", { multiple: true, multipleSep: "," });
103
+ break;
104
+
105
+ case 'is_url':
106
+ betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
107
+ break;
108
+
109
+ case 'is_post_in_category':
110
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", { multiple: true, multipleSep: "," });
111
+ break;
112
+
113
+ case 'is_post_with_tag':
114
+ $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", { multiple: true, multipleSep: "," });
115
+ break;
116
+ }
117
+ }
118
+
119
+ function addRuleFields() {
120
+ var data = {
121
+ 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length
122
+ };
123
+ var html = rowTemplate(data);
124
+ $(document.getElementById('boxzilla-box-rules')).after(html);
125
+ return false;
126
+ }
127
+
128
+ module.exports = {
129
+ 'Designer': Designer,
130
+ 'Option': Option,
131
+ 'events': events
132
  };
133
+ })();
 
 
 
 
 
 
 
 
 
134
 
135
  },{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(require,module,exports){
136
+ 'use strict';
137
+
138
+ 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; };
139
+
140
+ var Designer = function Designer($, Option, events) {
141
 
142
  // vars
143
  var boxId = document.getElementById('post_ID').value || 0,
144
+ $editor,
145
+ $editorFrame,
146
+ $innerEditor,
147
+ options = {},
148
+ visualEditorInitialised = false;
149
 
150
  var $appearanceControls = $("#boxzilla-box-appearance-controls");
151
 
161
  function init() {
162
 
163
  // Only run if TinyMCE has actually inited
164
+ if (_typeof(window.tinyMCE) !== "object" || tinyMCE.get('content') === null) {
165
  return;
166
  }
167
 
192
  }
193
 
194
  /**
195
+ * Applies the styles from the options to the TinyMCE Editor
196
+ *
197
+ * @return bool
198
+ */
199
  function applyStyles() {
200
 
201
+ if (!visualEditorInitialised) {
202
  return false;
203
  }
204
 
219
  }
220
 
221
  function resetStyles() {
222
+ for (var key in options) {
223
+ if (key.substring(0, 5) === 'theme') {
224
  continue;
225
  }
226
 
243
  'resetStyles': resetStyles,
244
  'options': options
245
  };
 
246
  };
247
 
248
  module.exports = Designer;
249
+
250
  },{}],4:[function(require,module,exports){
251
  'use strict';
252
 
253
  var $ = window.jQuery;
254
 
255
+ var Option = function Option(element) {
256
 
257
  // find corresponding element
258
+ if (typeof element == "string") {
259
  element = document.getElementById('boxzilla-' + element);
260
  }
261
 
262
+ if (!element) {
263
  console.error("Unable to find option element.");
264
  }
265
 
266
  this.element = element;
267
  };
268
 
269
+ Option.prototype.getColorValue = function () {
270
+ if (this.element.value.length > 0) {
271
+ if ($(this.element).hasClass('wp-color-field')) {
272
  return $(this.element).wpColorPicker('color');
273
  } else {
274
  return this.element.value;
278
  return '';
279
  };
280
 
281
+ Option.prototype.getPxValue = function (fallbackValue) {
282
+ if (this.element.value.length > 0) {
283
+ return parseInt(this.element.value) + "px";
284
  }
285
 
286
  return fallbackValue || '';
287
  };
288
 
289
+ Option.prototype.getValue = function (fallbackValue) {
290
 
291
+ if (this.element.value.length > 0) {
292
  return this.element.value;
293
  }
294
 
295
  return fallbackValue || '';
296
  };
297
 
298
+ Option.prototype.clear = function () {
299
  this.element.value = '';
300
  };
301
 
302
+ Option.prototype.setValue = function (value) {
303
  this.element.value = value;
304
  };
305
 
306
  module.exports = Option;
307
+
308
  },{}],5:[function(require,module,exports){
309
  /*!
310
  * EventEmitter v4.2.11 - git.io/ee
assets/js/admin-script.min.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){var e=void 0,t=void 0;!function n(t,o,r){function i(s,a){if(!o[s]){if(!t[s]){var u="function"==typeof e&&e;if(!a&&u)return u(s,!0);if(l)return l(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var p=o[s]={exports:{}};t[s][0].call(p.exports,function(e){var n=t[s][1][e];return i(n?n:e)},p,p.exports,n,t,o,r)}return o[s].exports}for(var l="function"==typeof e&&e,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(e,t,n){function o(){c.find(".boxzilla-trigger-options").toggle(""!==this.value)}function r(){s(this).parents("tr").remove()}function i(){var e="tr"===this.tagName.toLowerCase()?this:s(this).parents("tr").get(0),t=e.querySelector(".boxzilla-rule-condition").value,n=e.querySelector(".boxzilla-rule-value"),o=e.querySelector(".boxzilla-rule-qualifier"),r=n.cloneNode(!0),i=s(r);switch(s(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="",t){default:r.placeholder=m.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=m.enterCommaSeparatedPosts,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":r.placeholder=m.enterCommaSeparatedPages,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":r.placeholder=m.enterCommaSeparatedPostTypes,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":r.placeholder=m.enterCommaSeparatedRelativeUrls;break;case"is_post_in_category":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=category",{multiple:!0,multipleSep:","});break;case"is_post_with_tag":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_tag",{multiple:!0,multipleSep:","})}}function l(){var e={key:u.querySelectorAll(".boxzilla-rule-row").length},t=h(e);return s(document.getElementById("boxzilla-box-rules")).after(t),!1}var s=window.jQuery,a=e("./_option.js"),u=document.getElementById("boxzilla-box-options-controls"),c=s(u);if(0!==c.length){var p=e("wolfy87-eventemitter"),d=new p,f=e("./_designer.js")(s,a,d),h=wp.template("rule-row-template"),m=boxzilla_i18n;c.on("click",".boxzilla-add-rule",l),c.on("click",".boxzilla-remove-rule",r),c.on("change",".boxzilla-rule-condition",i),c.find(".boxzilla-auto-show-trigger").on("change",o),s(window).load(function(){"undefined"==typeof window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),s(".boxzilla-rule-row").each(i),t.exports={Designer:f,Option:a,events:d}}},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){var o=function(e,t,n){function o(){"object"===_typeof(window.tinyMCE)&&null!==tinyMCE.get("content")&&(s=e("#content_ifr"),l=s.contents().find("html"),l.css({background:"white"}),a=l.find("#tinymce"),a.addClass("boxzilla boxzilla-"+u),a.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),a.get(0).style.cssText+=";padding: 25px !important;",p=!0,n.trigger("editor.init"))}function r(){return!!p&&(a.css({"border-color":c.borderColor.getColorValue(),"border-width":c.borderWidth.getPxValue(),"border-style":c.borderStyle.getValue(),"background-color":c.backgroundColor.getColorValue(),width:c.width.getPxValue(),color:c.color.getColorValue()}),n.trigger("editor.styles.apply"),!0)}function i(){for(var e in c)"theme"!==e.substring(0,5)&&c[e].clear();r(),n.trigger("editor.styles.reset")}var l,s,a,u=document.getElementById("post_ID").value||0,c={},p=!1,d=e("#boxzilla-box-appearance-controls");return c.borderColor=new t("border-color"),c.borderWidth=new t("border-width"),c.borderStyle=new t("border-style"),c.backgroundColor=new t("background-color"),c.width=new t("width"),c.color=new t("color"),d.find("input.boxzilla-color-field").wpColorPicker({change:r,clear:r}),d.find(":input").not(".boxzilla-color-field").change(r),n.on("editor.init",r),{init:o,resetStyles:i,options:c}};t.exports=o},{}],4:[function(e,t,n){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(){function e(){}function o(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)}}var i=e.prototype,l=this,s=l.EventEmitter;i.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},i.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,t){var n,r=this.getListenersAsObject(e),i="object"===("undefined"==typeof t?"undefined":_typeof(t));for(n in r)r.hasOwnProperty(n)&&o(r[n],t)===-1&&r[n].push(i?t:{listener:t,once:!1});return this},i.on=r("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=r("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,t){var n,r,i=this.getListenersAsObject(e);for(r in i)i.hasOwnProperty(r)&&(n=o(i[r],t),n!==-1&&i[r].splice(n,1));return this},i.off=r("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var o,r,i=e?this.removeListener:this.addListener,l=e?this.removeListeners:this.addListeners;if("object"!==("undefined"==typeof t?"undefined":_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},i.removeEvent=function(e){var t,n="undefined"==typeof e?"undefined":_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},i.removeAllListeners=r("removeEvent"),i.emitEvent=function(e,t){var n,o,r,i,l,s=this.getListenersAsObject(e);for(i in s)if(s.hasOwnProperty(i))for(n=s[i].slice(0),r=n.length;r--;)o=n[r],o.once===!0&&this.removeListener(e,o.listener),l=o.listener.apply(this,t||[]),l===this._getOnceReturnValue()&&this.removeListener(e,o.listener);return this},i.trigger=r("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return l.EventEmitter=s,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"===("undefined"==typeof n?"undefined":_typeof(n))&&n.exports?n.exports=e:l.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=admin-script.min.js.map
1
+ !function(){var e=void 0,t=void 0;!function n(t,r,o){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof e&&e;if(!a&&u)return u(s,!0);if(l)return l(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var p=r[s]={exports:{}};t[s][0].call(p.exports,function(e){var n=t[s][1][e];return i(n?n:e)},p,p.exports,n,t,r,o)}return r[s].exports}for(var l="function"==typeof e&&e,s=0;s<o.length;s++)i(o[s]);return i}({1:[function(e,t,n){"use strict";window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(e,t,n){"use strict";!function(){function n(){u.find(".boxzilla-trigger-options").toggle(""!==this.value)}function r(){l(this).parents("tr").remove()}function o(){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"),r=e.querySelector(".boxzilla-rule-qualifier"),o=n.cloneNode(!0),i=l(o);switch(l(e.querySelectorAll(".boxzilla-helper")).remove(),o.removeAttribute("name"),o.className=o.className+" boxzilla-helper",n.parentNode.insertBefore(o,n.nextSibling),i.change(function(){n.value=this.value}),o.style.display="",n.style.display="none",r.style.display="",t){default:o.placeholder=h.enterCommaSeparatedValues;break;case"":case"everywhere":r.value="1",n.value="",o.style.display="none",r.style.display="none";break;case"is_single":case"is_post":o.placeholder=h.enterCommaSeparatedPosts,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":o.placeholder=h.enterCommaSeparatedPages,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":o.placeholder=h.enterCommaSeparatedPostTypes,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":o.placeholder=h.enterCommaSeparatedRelativeUrls;break;case"is_post_in_category":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=category",{multiple:!0,multipleSep:","});break;case"is_post_with_tag":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_tag",{multiple:!0,multipleSep:","})}}function i(){var e={key:a.querySelectorAll(".boxzilla-rule-row").length},t=d(e);return l(document.getElementById("boxzilla-box-rules")).after(t),!1}var l=window.jQuery,s=e("./_option.js"),a=document.getElementById("boxzilla-box-options-controls"),u=l(a);if(0!==u.length){var c=e("wolfy87-eventemitter"),p=new c,f=e("./_designer.js")(l,s,p),d=wp.template("rule-row-template"),h=boxzilla_i18n;u.on("click",".boxzilla-add-rule",i),u.on("click",".boxzilla-remove-rule",r),u.on("change",".boxzilla-rule-condition",o),u.find(".boxzilla-auto-show-trigger").on("change",n),l(window).load(function(){"undefined"==typeof window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),l(".boxzilla-rule-row").each(o),t.exports={Designer:f,Option:s,events:p}}}()},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t,n){function o(){"object"===r(window.tinyMCE)&&null!==tinyMCE.get("content")&&(a=e("#content_ifr"),s=a.contents().find("html"),s.css({background:"white"}),u=s.find("#tinymce"),u.addClass("boxzilla boxzilla-"+c),u.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),u.get(0).style.cssText+=";padding: 25px !important;",f=!0,n.trigger("editor.init"))}function i(){return!!f&&(u.css({"border-color":p.borderColor.getColorValue(),"border-width":p.borderWidth.getPxValue(),"border-style":p.borderStyle.getValue(),"background-color":p.backgroundColor.getColorValue(),width:p.width.getPxValue(),color:p.color.getColorValue()}),n.trigger("editor.styles.apply"),!0)}function l(){for(var e in p)"theme"!==e.substring(0,5)&&p[e].clear();i(),n.trigger("editor.styles.reset")}var s,a,u,c=document.getElementById("post_ID").value||0,p={},f=!1,d=e("#boxzilla-box-appearance-controls");return p.borderColor=new t("border-color"),p.borderWidth=new t("border-width"),p.borderStyle=new t("border-style"),p.backgroundColor=new t("background-color"),p.width=new t("width"),p.color=new t("color"),d.find("input.boxzilla-color-field").wpColorPicker({change:i,clear:i}),d.find(":input").not(".boxzilla-color-field").change(i),n.on("editor.init",i),{init:o,resetStyles:l,options:p}};t.exports=o},{}],4:[function(e,t,n){"use strict";var r=window.jQuery,o=function(e){"string"==typeof e&&(e=document.getElementById("boxzilla-"+e)),e||console.error("Unable to find option element."),this.element=e};o.prototype.getColorValue=function(){return this.element.value.length>0?r(this.element).hasClass("wp-color-field")?r(this.element).wpColorPicker("color"):this.element.value:""},o.prototype.getPxValue=function(e){return this.element.value.length>0?parseInt(this.element.value)+"px":e||""},o.prototype.getValue=function(e){return this.element.value.length>0?this.element.value:e||""},o.prototype.clear=function(){this.element.value=""},o.prototype.setValue=function(e){this.element.value=e},t.exports=o},{}],5:[function(e,n,r){(function(){"use strict";function e(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,l=this,s=l.EventEmitter;i.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,t){var n,o=this.getListenersAsObject(e),i="object"==typeof t;for(n in o)o.hasOwnProperty(n)&&r(o[n],t)===-1&&o[n].push(i?t:{listener:t,once:!1});return this},i.on=o("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=o("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,t){var n,o,i=this.getListenersAsObject(e);for(o in i)i.hasOwnProperty(o)&&(n=r(i[o],t),n!==-1&&i[o].splice(n,1));return this},i.off=o("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var r,o,i=e?this.removeListener:this.addListener,l=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)i.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(o=t[r])&&("function"==typeof o?i.call(this,r,o):l.call(this,r,o));return this},i.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},i.removeAllListeners=o("removeEvent"),i.emitEvent=function(e,t){var n,r,o,i,l,s=this.getListenersAsObject(e);for(i in s)if(s.hasOwnProperty(i))for(n=s[i].slice(0),o=n.length;o--;)r=n[o],r.once===!0&&this.removeListener(e,r.listener),l=r.listener.apply(this,t||[]),l===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},i.trigger=o("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return l.EventEmitter=s,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:l.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=admin-script.min.js.map
assets/js/admin-script.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["admin-script.js"],"names":["_typeof","Symbol","iterator","obj","constructor","prototype","require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","window","Boxzilla_Admin","./admin/_admin.js","2","toggleTriggerOptions","$optionControls","find","toggle","this","value","removeRule","$","parents","remove","setContextualHelpers","context","tagName","toLowerCase","get","condition","querySelector","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","querySelectorAll","removeAttribute","className","parentNode","insertBefore","nextSibling","change","style","display","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","addRuleFields","data","key","optionControls","html","rowTemplate","document","getElementById","after","jQuery","Option","EventEmitter","events","Designer","wp","template","boxzilla_i18n","on","load","tinyMCE","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","init","$editorFrame","$editor","contents","css","background","$innerEditor","addClass","boxId","margin","width","min-width","position","cssText","visualEditorInitialised","trigger","applyStyles","border-color","options","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","color","resetStyles","substring","clear","$appearanceControls","wpColorPicker","not","4","element","console","error","hasClass","fallbackValue","parseInt","setValue","5","indexOfListener","listeners","listener","alias","name","apply","arguments","proto","originalGlobalValue","getListeners","evt","response","_getEvents","RegExp","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"AAAA,YAEA,IAAIA,SAA4B,kBAAXC,SAAoD,gBAApBA,QAAOC,SAAwB,SAAUC,GAAO,aAAcA,IAAS,SAAUA,GAAO,MAAOA,IAAyB,kBAAXF,SAAyBE,EAAIC,cAAgBH,QAAUE,IAAQF,OAAOI,UAAY,eAAkBF,KAEtQ,WACE,GAAIG,GAAUC,OAA6DC,EAASD,QAAU,QAAUE,GAAEC,EAAGC,EAAGC,GAC9G,QAASC,GAAEC,EAAGC,GACZ,IAAKJ,EAAEG,GAAI,CACT,IAAKJ,EAAEI,GAAI,CACT,GAAIE,GAAsB,kBAAXV,IAAyBA,CAAQ,KAAKS,GAAKC,EAAG,MAAOA,GAAEF,GAAG,EAAI,IAAIG,EAAG,MAAOA,GAAEH,GAAG,EAAI,IAAII,GAAI,GAAIC,OAAM,uBAAyBL,EAAI,IAAK,MAAMI,GAAEE,KAAO,mBAAoBF,EAC5L,GAAIG,GAAIV,EAAEG,IAAOQ,WAAcZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAS,SAAUb,G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KkJ,aAQ/BjG,EAAa2G,WAAa,WAExB,MADAzK,GAAQ8D,aAAemE,EAChBnE,GAIa,kBAAX5E,IAAyBA,EAAOwL,IACzCxL,EAAO,WACL,MAAO4E,KAEoE,YAAjD,mBAAX1D,GAAyB,YAAc1B,QAAQ0B,KAAyBA,EAAOJ,QAChGI,EAAOJ,QAAU8D,EAEjB9D,EAAQ8D,aAAeA,IAExB7D,KAAKY,gBACK","file":"admin-script.min.js","sourcesContent":["\"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 var require = undefined;var module = undefined;var exports = undefined;var define = undefined;(function e(t, n, r) {\n function s(o, u) {\n if (!n[o]) {\n if (!t[o]) {\n 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;\n }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {\n var n = t[o][1][e];return s(n ? n : e);\n }, l, l.exports, e, t, n, r);\n }return n[o].exports;\n }var i = typeof require == \"function\" && require;for (var o = 0; o < r.length; o++) {\n s(r[o]);\n }return s;\n })({ 1: [function (require, module, exports) {\n window.Boxzilla_Admin = require('./admin/_admin.js');\n }, { \"./admin/_admin.js\": 2 }], 2: [function (require, module, exports) {\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\n // sanity check, are we on the correct page?\n if ($optionControls.length === 0) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter');\n var events = new EventEmitter();\n var Designer = require('./_designer.js')($, Option, events);\n var rowTemplate = wp.template('rule-row-template');\n var i18n = boxzilla_i18n;\n\n // events\n $optionControls.on('click', \".boxzilla-add-rule\", addRuleFields);\n $optionControls.on('click', \".boxzilla-remove-rule\", removeRule);\n $optionControls.on('change', \".boxzilla-rule-condition\", setContextualHelpers);\n $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);\n\n $(window).load(function () {\n if (typeof window.tinyMCE === \"undefined\") {\n document.getElementById('notice-notinymce').style.display = '';\n }\n });\n\n // call contextual helper method for each row\n $('.boxzilla-rule-row').each(setContextualHelpers);\n\n function toggleTriggerOptions() {\n $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n }\n\n function removeRule() {\n $(this).parents('tr').remove();\n }\n\n function setContextualHelpers() {\n\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\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\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_page':\n betterInput.placeholder = i18n.enterCommaSeparatedPages;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_post_type':\n betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_url':\n betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n break;\n\n case 'is_post_in_category':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", { multiple: true, multipleSep: \",\" });\n break;\n\n case 'is_post_with_tag':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", { multiple: true, multipleSep: \",\" });\n break;\n }\n }\n\n function addRuleFields() {\n var data = {\n 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length\n };\n var html = rowTemplate(data);\n $(document.getElementById('boxzilla-box-rules')).after(html);\n return false;\n }\n\n module.exports = {\n 'Designer': Designer,\n 'Option': Option,\n 'events': events\n };\n }, { \"./_designer.js\": 3, \"./_option.js\": 4, \"wolfy87-eventemitter\": 5 }], 3: [function (require, module, exports) {\n var Designer = function Designer($, Option, events) {\n\n // vars\n var boxId = document.getElementById('post_ID').value || 0,\n $editor,\n $editorFrame,\n $innerEditor,\n options = {},\n visualEditorInitialised = false;\n\n var $appearanceControls = $(\"#boxzilla-box-appearance-controls\");\n\n // create Option objects\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');\n\n // functions\n function init() {\n\n // Only run if TinyMCE has actually inited\n if (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n return;\n }\n\n // add classes to TinyMCE <html>\n $editorFrame = $(\"#content_ifr\");\n $editor = $editorFrame.contents().find('html');\n $editor.css({\n 'background': 'white'\n });\n\n // add content class and padding to TinyMCE <body>\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\n visualEditorInitialised = true;\n\n /* @since 2.0.3 */\n events.trigger('editor.init');\n }\n\n /**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n function applyStyles() {\n\n if (!visualEditorInitialised) {\n return false;\n }\n\n // apply styles from CSS editor\n $innerEditor.css({\n 'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),\n 'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),\n 'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),\n 'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),\n 'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),\n 'color': options.color.getColorValue() // getColorValue( 'color', '' )\n });\n\n /* @since 2.0.3 */\n events.trigger('editor.styles.apply');\n\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 applyStyles();\n\n /* @since 2.0.3 */\n events.trigger('editor.styles.reset');\n }\n\n // event binders\n $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });\n $appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n events.on('editor.init', applyStyles);\n\n // public methods\n return {\n 'init': init,\n 'resetStyles': resetStyles,\n 'options': options\n };\n };\n\n module.exports = Designer;\n }, {}], 4: [function (require, module, exports) {\n 'use strict';\n\n var $ = window.jQuery;\n\n var Option = function Option(element) {\n\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\n Option.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\n Option.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\n Option.prototype.getValue = function (fallbackValue) {\n\n if (this.element.value.length > 0) {\n return this.element.value;\n }\n\n return fallbackValue || '';\n };\n\n Option.prototype.clear = function () {\n this.element.value = '';\n };\n\n Option.prototype.setValue = function (value) {\n this.element.value = value;\n };\n\n module.exports = Option;\n }, {}], 5: [function (require, module, exports) {\n /*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n ;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n\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 } 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 === \"undefined\" ? \"undefined\" : _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 === \"undefined\" ? \"undefined\" : _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 } else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\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 === \"undefined\" ? \"undefined\" : _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 } 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 } 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 } 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 } else if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) === 'object' && module.exports) {\n module.exports = EventEmitter;\n } else {\n exports.EventEmitter = EventEmitter;\n }\n }).call(this);\n }, {}] }, {}, [1]);\n ;\n})();"]}
1
+ {"version":3,"sources":["admin-script.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","window","Boxzilla_Admin","./admin/_admin.js","2","toggleTriggerOptions","$optionControls","find","toggle","this","value","removeRule","$","parents","remove","setContextualHelpers","context","tagName","toLowerCase","get","condition","querySelector","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","querySelectorAll","removeAttribute","className","parentNode","insertBefore","nextSibling","change","style","display","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","addRuleFields","data","key","optionControls","html","rowTemplate","document","getElementById","after","jQuery","Option","EventEmitter","events","Designer","wp","template","boxzilla_i18n","on","load","tinyMCE","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","_typeof","Symbol","iterator","obj","constructor","prototype","init","$editorFrame","$editor","contents","css","background","$innerEditor","addClass","boxId","margin","width","min-width","position","cssText","visualEditorInitialised","trigger","applyStyles","border-color","options","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","color","resetStyles","substring","clear","$appearanceControls","wpColorPicker","not","4","element","console","error","hasClass","fallbackValue","parseInt","setValue","5","indexOfListener","listeners","listener","alias","name","apply","arguments","proto","originalGlobalValue","getListeners","evt","response","_getEvents","RegExp","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAgEC,EAASD,QAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATV,IAAqBA,CAAQ,KAAIS,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGG,EAAE,MAAOA,GAAEH,GAAE,EAAI,IAAII,GAAE,GAAIC,OAAM,uBAAuBL,EAAE,IAAK,MAAMI,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEV,EAAEG,IAAIQ,WAAYZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGQ,QAAkD,IAAI,GAA1CL,GAAkB,kBAATX,IAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKY,GAAG,SAASnB,EAAQoB,EAAOJ,GACxkB,YAEAK,QAAOC,eAAiBtB,EAAQ,uBAE7BuB,oBAAoB,IAAIC,GAAG,SAASxB,EAAQoB,EAAOJ,GACtD,cAEA,WAkCC,QAASS,KACRC,EAAgBC,KAAK,6BAA6BC,OAAsB,KAAfC,KAAKC,OAG/D,QAASC,KACRC,EAAEH,MAAMI,QAAQ,MAAMC,SAGvB,QAASC,KAER,GAAIC,GAAyC,OAA/BP,KAAKQ,QAAQC,cAAyBT,KA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J,KAAKqI,qBAAqBT,EAO7C,KAAKpF,IAAOoH,GACR,GAAIA,EAAa5B,eAAexF,GAI5B,IAHA2E,EAAYyC,EAAapH,GAAKqH,MAAM,GACpC/K,EAAIqI,EAAU9H,OAEPP,KAGHsI,EAAWD,EAAUrI,GAEjBsI,EAASqB,QAAS,GAClBzI,KAAK8I,eAAelB,EAAKR,EAASA,UAGtCS,EAAWT,EAASA,SAASG,MAAMvH,KAAM2J,OAErC9B,IAAa7H,KAAK8J,uBAClB9J,KAAK8I,eAAelB,EAAKR,EAASA,SAMlD,OAAOpH,OAMXyH,EAAMrC,QAAUiC,EAAM,aAUtBI,EAAMsC,KAAO,SAAcnC,GACvB,GAAI+B,GAAOrB,MAAMlE,UAAUyF,MAAMzK,KAAKoI,UAAW,EACjD,OAAOxH,MAAK0J,UAAU9B,EAAK+B,IAW/BlC,EAAMuC,mBAAqB,SAA4B/J,GAEnD,MADAD,MAAKiK,iBAAmBhK,EACjBD,MAWXyH,EAAMqC,oBAAsB,WACxB,OAAI9J,KAAKgI,eAAe,qBACbhI,KAAKiK,kBAapBxC,EAAMK,WAAa,WACf,MAAO9H,MAAKwJ,UAAYxJ,KAAKwJ,aAQjCvG,EAAaiH,WAAa,WAEtB,MADA/K,GAAQ8D,aAAeyE,EAChBzE,GAIW,kBAAX5E,IAAyBA,EAAO8L,IACvC9L,EAAO,WACH,MAAO4E,KAGY,gBAAX1D,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAU8D,EAGjB9D,EAAQ8D,aAAeA,IAE7B7D,KAAKY,gBAEI","file":"admin-script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\nwindow.Boxzilla_Admin = require('./admin/_admin.js');\n\n},{\"./admin/_admin.js\":2}],2:[function(require,module,exports){\n'use strict';\n\n(function () {\n\t'use strict';\n\n\tvar $ = window.jQuery;\n\tvar Option = require('./_option.js');\n\tvar optionControls = document.getElementById('boxzilla-box-options-controls');\n\tvar $optionControls = $(optionControls);\n\n\t// sanity check, are we on the correct page?\n\tif ($optionControls.length === 0) {\n\t\treturn;\n\t}\n\n\tvar EventEmitter = require('wolfy87-eventemitter');\n\tvar events = new EventEmitter();\n\tvar Designer = require('./_designer.js')($, Option, events);\n\tvar rowTemplate = wp.template('rule-row-template');\n\tvar i18n = boxzilla_i18n;\n\n\t// events\n\t$optionControls.on('click', \".boxzilla-add-rule\", addRuleFields);\n\t$optionControls.on('click', \".boxzilla-remove-rule\", removeRule);\n\t$optionControls.on('change', \".boxzilla-rule-condition\", setContextualHelpers);\n\t$optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);\n\n\t$(window).load(function () {\n\t\tif (typeof window.tinyMCE === \"undefined\") {\n\t\t\tdocument.getElementById('notice-notinymce').style.display = '';\n\t\t}\n\t});\n\n\t// call contextual helper method for each row\n\t$('.boxzilla-rule-row').each(setContextualHelpers);\n\n\tfunction toggleTriggerOptions() {\n\t\t$optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n\t}\n\n\tfunction removeRule() {\n\t\t$(this).parents('tr').remove();\n\t}\n\n\tfunction setContextualHelpers() {\n\n\t\tvar context = this.tagName.toLowerCase() === \"tr\" ? this : $(this).parents('tr').get(0);\n\t\tvar condition = context.querySelector('.boxzilla-rule-condition').value;\n\t\tvar valueInput = context.querySelector('.boxzilla-rule-value');\n\t\tvar qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n\t\tvar betterInput = valueInput.cloneNode(true);\n\t\tvar $betterInput = $(betterInput);\n\n\t\t// remove previously added helpers\n\t\t$(context.querySelectorAll('.boxzilla-helper')).remove();\n\n\t\t// prepare better input\n\t\tbetterInput.removeAttribute('name');\n\t\tbetterInput.className = betterInput.className + ' boxzilla-helper';\n\t\tvalueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n\t\t$betterInput.change(function () {\n\t\t\tvalueInput.value = this.value;\n\t\t});\n\n\t\tbetterInput.style.display = '';\n\t\tvalueInput.style.display = 'none';\n\t\tqualifierInput.style.display = '';\n\n\t\t// change placeholder for textual help\n\t\tswitch (condition) {\n\t\t\tdefault:\n\t\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedValues;\n\t\t\t\tbreak;\n\n\t\t\tcase '':\n\t\t\tcase 'everywhere':\n\t\t\t\tqualifierInput.value = '1';\n\t\t\t\tvalueInput.value = '';\n\t\t\t\tbetterInput.style.display = 'none';\n\t\t\t\tqualifierInput.style.display = 'none';\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_single':\n\t\t\tcase 'is_post':\n\t\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPosts;\n\t\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", { multiple: true, multipleSep: \",\" });\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_page':\n\t\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPages;\n\t\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", { multiple: true, multipleSep: \",\" });\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_post_type':\n\t\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n\t\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", { multiple: true, multipleSep: \",\" });\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_url':\n\t\t\t\tbetterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_post_in_category':\n\t\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", { multiple: true, multipleSep: \",\" });\n\t\t\t\tbreak;\n\n\t\t\tcase 'is_post_with_tag':\n\t\t\t\t$betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", { multiple: true, multipleSep: \",\" });\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tfunction addRuleFields() {\n\t\tvar data = {\n\t\t\t'key': optionControls.querySelectorAll('.boxzilla-rule-row').length\n\t\t};\n\t\tvar html = rowTemplate(data);\n\t\t$(document.getElementById('boxzilla-box-rules')).after(html);\n\t\treturn false;\n\t}\n\n\tmodule.exports = {\n\t\t'Designer': Designer,\n\t\t'Option': Option,\n\t\t'events': events\n\t};\n})();\n\n},{\"./_designer.js\":3,\"./_option.js\":4,\"wolfy87-eventemitter\":5}],3:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar Designer = function Designer($, Option, events) {\n\n\t// vars\n\tvar boxId = document.getElementById('post_ID').value || 0,\n\t $editor,\n\t $editorFrame,\n\t $innerEditor,\n\t options = {},\n\t visualEditorInitialised = false;\n\n\tvar $appearanceControls = $(\"#boxzilla-box-appearance-controls\");\n\n\t// create Option objects\n\toptions.borderColor = new Option('border-color');\n\toptions.borderWidth = new Option('border-width');\n\toptions.borderStyle = new Option('border-style');\n\toptions.backgroundColor = new Option('background-color');\n\toptions.width = new Option('width');\n\toptions.color = new Option('color');\n\n\t// functions\n\tfunction init() {\n\n\t\t// Only run if TinyMCE has actually inited\n\t\tif (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// add classes to TinyMCE <html>\n\t\t$editorFrame = $(\"#content_ifr\");\n\t\t$editor = $editorFrame.contents().find('html');\n\t\t$editor.css({\n\t\t\t'background': 'white'\n\t\t});\n\n\t\t// add content class and padding to TinyMCE <body>\n\t\t$innerEditor = $editor.find('#tinymce');\n\t\t$innerEditor.addClass('boxzilla boxzilla-' + boxId);\n\t\t$innerEditor.css({\n\t\t\t'margin': 0,\n\t\t\t'background': 'white',\n\t\t\t'display': 'inline-block',\n\t\t\t'width': 'auto',\n\t\t\t'min-width': '240px',\n\t\t\t'position': 'relative'\n\t\t});\n\t\t$innerEditor.get(0).style.cssText += ';padding: 25px !important;';\n\n\t\tvisualEditorInitialised = true;\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.init');\n\t}\n\n\t/**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n\tfunction applyStyles() {\n\n\t\tif (!visualEditorInitialised) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// apply styles from CSS editor\n\t\t$innerEditor.css({\n\t\t\t'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),\n\t\t\t'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),\n\t\t\t'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),\n\t\t\t'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),\n\t\t\t'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),\n\t\t\t'color': options.color.getColorValue() // getColorValue( 'color', '' )\n\t\t});\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.apply');\n\n\t\treturn true;\n\t}\n\n\tfunction resetStyles() {\n\t\tfor (var key in options) {\n\t\t\tif (key.substring(0, 5) === 'theme') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toptions[key].clear();\n\t\t}\n\t\tapplyStyles();\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.reset');\n\t}\n\n\t// event binders\n\t$appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });\n\t$appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n\tevents.on('editor.init', applyStyles);\n\n\t// public methods\n\treturn {\n\t\t'init': init,\n\t\t'resetStyles': resetStyles,\n\t\t'options': options\n\t};\n};\n\nmodule.exports = Designer;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\n\nvar Option = function Option(element) {\n\n\t// find corresponding element\n\tif (typeof element == \"string\") {\n\t\telement = document.getElementById('boxzilla-' + element);\n\t}\n\n\tif (!element) {\n\t\tconsole.error(\"Unable to find option element.\");\n\t}\n\n\tthis.element = element;\n};\n\nOption.prototype.getColorValue = function () {\n\tif (this.element.value.length > 0) {\n\t\tif ($(this.element).hasClass('wp-color-field')) {\n\t\t\treturn $(this.element).wpColorPicker('color');\n\t\t} else {\n\t\t\treturn this.element.value;\n\t\t}\n\t}\n\n\treturn '';\n};\n\nOption.prototype.getPxValue = function (fallbackValue) {\n\tif (this.element.value.length > 0) {\n\t\treturn parseInt(this.element.value) + \"px\";\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.getValue = function (fallbackValue) {\n\n\tif (this.element.value.length > 0) {\n\t\treturn this.element.value;\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.clear = function () {\n\tthis.element.value = '';\n};\n\nOption.prototype.setValue = function (value) {\n\tthis.element.value = value;\n};\n\nmodule.exports = Option;\n\n},{}],5:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var exports = this;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n i = listeners.length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}.call(this));\n\n},{}]},{},[1]);\n; })();"]}
assets/js/script.js CHANGED
@@ -1,109 +1,126 @@
1
  (function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
  'use strict';
3
 
4
- var Boxzilla = require('boxzilla');
5
- var options = window.boxzilla_options;
6
- var isLoggedIn = document.body.className.indexOf('logged-in') > -1;
7
 
8
- // print message when test mode is enabled
9
- if( isLoggedIn && options.testMode ) {
10
- console.log( 'Boxzilla: Test mode is enabled. Please disable test mode if you\'re done testing.' );
11
- }
12
 
13
- // init boxzilla
14
- Boxzilla.init();
 
15
 
16
- // create boxes from options
17
- for( var i=0; i < options.boxes.length; i++ ) {
18
- // get opts
19
- var boxOpts = options.boxes[i];
20
- boxOpts.testMode = isLoggedIn && options.testMode;
21
 
22
- // fix http:// links in box content....
23
- if( window.location.protocol === "https:" && window.location.host ) {
24
- var o = "http://" + window.location.host;
25
- var n = old.replace('http://', 'https://');
26
- boxOpts.content = boxOpts.content.replace(o, n);
27
  }
28
 
29
- // create box
30
- var box = Boxzilla.create( boxOpts.id, boxOpts);
31
-
32
- // add custom css to box
33
- css(box.element, boxOpts.css);
34
 
35
- box.element.firstChild.firstChild.className += " first-child";
36
- box.element.firstChild.lastChild.className += " last-child";
37
- }
 
 
38
 
39
- // helper function for setting CSS styles
40
- function css(element, styles) {
41
- if( styles.background_color ) {
42
- element.style.background = styles.background_color;
43
- }
 
44
 
45
- if( styles.color ) {
46
- element.style.color = styles.color;
47
- }
48
 
49
- if( styles.border_color ) {
50
- element.style.borderColor = styles.border_color;
51
- }
52
 
53
- if( styles.border_width ) {
54
- element.style.borderWidth = parseInt(styles.border_width) + "px";
55
  }
56
 
57
- if( styles.border_style ) {
58
- element.style.borderStyle = styles.border_style;
59
- }
 
 
 
 
 
 
 
 
 
 
60
 
61
- if( styles.width ) {
62
- element.style.maxWidth = parseInt(styles.width) + "px";
 
 
 
 
 
 
 
 
 
63
  }
64
- }
65
 
66
- /**
67
- * If a MailChimp for WordPress form was submitted, open the box containing that form (if any)
68
- *
69
- * TODO: Just set location hash from MailChimp for WP?
70
- */
71
- window.addEventListener('load', function() {
72
- if( typeof(window.mc4wp_forms_config) === "object" && window.mc4wp_forms_config.submitted_form ) {
73
- var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;
74
- var boxes = Boxzilla.boxes;
75
- for( var boxId in boxes ) {
76
- if(!boxes.hasOwnProperty(boxId)) { continue; }
77
- var box = boxes[boxId];
78
- if( box.element.querySelector(selector)) {
79
- box.show();
80
- return;
 
 
 
81
  }
82
  }
83
- }
84
- });
 
 
 
85
 
86
- window.Boxzilla = Boxzilla;
87
  },{"boxzilla":4}],2:[function(require,module,exports){
 
 
88
  var duration = 320;
89
 
90
  function css(element, styles) {
91
- for(var property in styles) {
92
  element.style[property] = styles[property];
93
  }
94
  }
95
 
96
  function initObjectProperties(properties, value) {
97
  var newObject = {};
98
- for(var i=0; i<properties.length; i++) {
99
  newObject[properties[i]] = value;
100
  }
101
  return newObject;
102
  }
103
 
104
  function copyObjectProperties(properties, object) {
105
- var newObject = {}
106
- for(var i=0; i<properties.length; i++) {
107
  newObject[properties[i]] = object[properties[i]];
108
  }
109
  return newObject;
@@ -116,7 +133,7 @@ function copyObjectProperties(properties, object) {
116
  * @returns {boolean}
117
  */
118
  function animated(element) {
119
- return !! element.getAttribute('data-animated');
120
  }
121
 
122
  /**
@@ -130,7 +147,7 @@ function toggle(element, animation) {
130
 
131
  // create clone for reference
132
  var clone = element.cloneNode(true);
133
- var cleanup = function() {
134
  element.removeAttribute('data-animated');
135
  element.setAttribute('style', clone.getAttribute('style'));
136
  element.style.display = nowVisible ? 'none' : '';
@@ -140,18 +157,18 @@ function toggle(element, animation) {
140
  element.setAttribute('data-animated', "true");
141
 
142
  // toggle element visiblity right away if we're making something visible
143
- if( ! nowVisible ) {
144
  element.style.display = '';
145
  }
146
 
147
  var hiddenStyles, visibleStyles;
148
 
149
  // animate properties
150
- if( animation === 'slide' ) {
151
  hiddenStyles = initObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 0);
152
  visibleStyles = {};
153
 
154
- if( ! nowVisible ) {
155
  var computedStyles = window.getComputedStyle(element);
156
  visibleStyles = copyObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], computedStyles);
157
  css(element, hiddenStyles);
@@ -163,7 +180,7 @@ function toggle(element, animation) {
163
  } else {
164
  hiddenStyles = { opacity: 0 };
165
  visibleStyles = { opacity: 1 };
166
- if( ! nowVisible ) {
167
  css(element, hiddenStyles);
168
  }
169
 
@@ -177,7 +194,7 @@ function animate(element, targetStyles, fn) {
177
  var currentStyles = {};
178
  var propSteps = {};
179
 
180
- for(var property in targetStyles) {
181
  // make sure we have an object filled with floats
182
  targetStyles[property] = parseFloat(targetStyles[property]);
183
 
@@ -186,28 +203,28 @@ function animate(element, targetStyles, fn) {
186
  var current = parseFloat(initialStyles[property]);
187
 
188
  // is there something to do?
189
- if( current == to ) {
190
  delete targetStyles[property];
191
  continue;
192
  }
193
 
194
- propSteps[property] = ( to - current ) / duration; // points per second
195
  currentStyles[property] = current;
196
  }
197
 
198
- var tick = function() {
199
  var now = +new Date();
200
  var timeSinceLastTick = now - last;
201
  var done = true;
202
 
203
  var step, to, increment, newValue;
204
- for(var property in targetStyles ) {
205
  step = propSteps[property];
206
  to = targetStyles[property];
207
- increment = step * timeSinceLastTick;
208
  newValue = currentStyles[property] + increment;
209
 
210
- if( step > 0 && newValue >= to || step < 0 && newValue <= to ) {
211
  newValue = to;
212
  } else {
213
  done = false;
@@ -223,8 +240,8 @@ function animate(element, targetStyles, fn) {
223
  last = +new Date();
224
 
225
  // keep going until we're done for all props
226
- if(!done) {
227
- (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 32);
228
  } else {
229
  // call callback
230
  fn && fn();
@@ -234,27 +251,27 @@ function animate(element, targetStyles, fn) {
234
  tick();
235
  }
236
 
237
-
238
  module.exports = {
239
  'toggle': toggle,
240
  'animate': animate,
241
  'animated': animated
242
  };
 
243
  },{}],3:[function(require,module,exports){
244
  'use strict';
245
 
246
  var defaults = {
247
- 'animation': 'fade',
248
- 'rehide': false,
249
- 'content': '',
250
- 'cookie': null,
251
- 'icon': '&times',
252
- 'minimumScreenWidth': 0,
253
- 'position': 'center',
254
- 'testMode': false,
255
- 'trigger': false,
256
- 'closable': true
257
- },
258
  Boxzilla,
259
  Animator = require('./animator.js');
260
 
@@ -265,10 +282,14 @@ var defaults = {
265
  * @param obj2
266
  * @returns {*}
267
  */
268
- function merge( obj1, obj2 ) {
269
  var obj3 = {};
270
- for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
271
- for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
 
 
 
 
272
  return obj3;
273
  }
274
 
@@ -280,15 +301,14 @@ function getDocumentHeight() {
280
  var body = document.body,
281
  html = document.documentElement;
282
 
283
- var height = Math.max( body.scrollHeight, body.offsetHeight,
284
- html.clientHeight, html.scrollHeight, html.offsetHeight );
285
 
286
  return height;
287
  }
288
 
289
  // Box Object
290
- var Box = function( id, config ) {
291
- this.id = id;
292
 
293
  // store config values
294
  this.config = merge(defaults, config);
@@ -297,17 +317,17 @@ var Box = function( id, config ) {
297
  this.overlay = document.getElementById('boxzilla-overlay');
298
 
299
  // state
300
- this.visible = false;
301
- this.dismissed = false;
302
- this.triggered = false;
303
  this.triggerHeight = 0;
304
  this.cookieSet = false;
305
  this.element = null;
306
  this.closeIcon = null;
307
 
308
  // if a trigger was given, calculate values once and store
309
- if( this.config.trigger ) {
310
- if( this.config.trigger.method === 'percentage' || this.config.trigger.method === 'element' ) {
311
  this.triggerHeight = this.calculateTriggerHeight();
312
  }
313
 
@@ -322,39 +342,38 @@ var Box = function( id, config ) {
322
  };
323
 
324
  // initialise the box
325
- Box.prototype.events = function() {
326
  var box = this;
327
 
328
  // attach event to "close" icon inside box
329
  this.closeIcon && this.closeIcon.addEventListener('click', box.dismiss.bind(this));
330
 
331
- this.element.addEventListener('click', function(e) {
332
- if( e.target.tagName === 'A' ) {
333
- Boxzilla.trigger('box.interactions.link', [ box, e.target ] );
334
  }
335
  }, false);
336
 
337
- this.element.addEventListener('submit', function(e) {
338
  box.setCookie();
339
- Boxzilla.trigger('box.interactions.form', [ box, e.target ]);
340
  }, false);
341
-
342
- window.addEventListener("hashchange", function() {
343
  var needle = "#boxzilla-" + box.id;
344
- if( location.hash === needle ) {
345
  box.toggle();
346
  }
347
  });
348
 
349
  // maybe show box right away
350
- if( this.fits() && this.locationHashRefersBox() ) {
351
  window.addEventListener('load', this.show.bind(this));
352
  }
353
-
354
  };
355
 
356
  // generate dom elements for this box
357
- Box.prototype.dom = function() {
358
  var wrapper = document.createElement('div');
359
  wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';
360
 
@@ -371,16 +390,16 @@ Box.prototype.dom = function() {
371
 
372
  // remove <script> from box content and append them to the document body
373
  var scripts = content.querySelectorAll('script');
374
- if(scripts.length) {
375
  var script = document.createElement('script');
376
- for( var i=0; i<scripts.length; i++ ) {
377
  script.appendChild(document.createTextNode(scripts[i].text));
378
  scripts[i].parentNode.removeChild(scripts[i]);
379
  }
380
  document.body.appendChild(script);
381
  }
382
-
383
- if( this.config.closable && this.config.icon ) {
384
  var closeIcon = document.createElement('span');
385
  closeIcon.className = "boxzilla-close-icon";
386
  closeIcon.innerHTML = this.config.icon;
@@ -393,7 +412,7 @@ Box.prototype.dom = function() {
393
  };
394
 
395
  // set (calculate) custom box styling depending on box options
396
- Box.prototype.setCustomBoxStyling = function() {
397
 
398
  // reset element to its initial state
399
  var origDisplay = this.element.style.display;
@@ -406,14 +425,14 @@ Box.prototype.setCustomBoxStyling = function() {
406
  var boxHeight = this.element.clientHeight;
407
 
408
  // add scrollbar to box and limit height
409
- if( boxHeight > windowHeight ) {
410
  this.element.style.maxHeight = windowHeight + "px";
411
  this.element.style.overflowY = 'scroll';
412
  }
413
 
414
  // set new top margin for boxes which are centered
415
- if( this.config.position === 'center' ) {
416
- var newTopMargin = ( ( windowHeight - boxHeight ) / 2 );
417
  newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;
418
  this.element.style.marginTop = newTopMargin + "px";
419
  }
@@ -422,25 +441,25 @@ Box.prototype.setCustomBoxStyling = function() {
422
  };
423
 
424
  // toggle visibility of the box
425
- Box.prototype.toggle = function(show) {
426
 
427
  // revert visibility if no explicit argument is given
428
- if( typeof( show ) === "undefined" ) {
429
- show = ! this.visible;
430
  }
431
 
432
  // is box already at desired visibility?
433
- if( show === this.visible ) {
434
  return false;
435
  }
436
 
437
  // is box being animated?
438
- if( Animator.animated(this.element) ) {
439
  return false;
440
  }
441
 
442
  // if box should be hidden but is not closable, bail.
443
- if( ! show && ! this.config.closable ) {
444
  return false;
445
  }
446
 
@@ -451,10 +470,10 @@ Box.prototype.toggle = function(show) {
451
  this.setCustomBoxStyling();
452
 
453
  // trigger event
454
- Boxzilla.trigger('box.' + ( show ? 'show' : 'hide' ), [ this ] );
455
 
456
  // show or hide box using selected animation
457
- if( this.config.position === 'center' ) {
458
  this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');
459
  Animator.toggle(this.overlay, "fade");
460
  }
@@ -463,7 +482,7 @@ Box.prototype.toggle = function(show) {
463
 
464
  // focus on first input field in box
465
  var firstInput = this.element.querySelector('input, textarea');
466
- if(firstInput) {
467
  firstInput.focus();
468
  }
469
 
@@ -471,90 +490,90 @@ Box.prototype.toggle = function(show) {
471
  };
472
 
473
  // show the box
474
- Box.prototype.show = function() {
475
  return this.toggle(true);
476
  };
477
 
478
  // hide the box
479
- Box.prototype.hide = function() {
480
  return this.toggle(false);
481
  };
482
 
483
  // calculate trigger height
484
- Box.prototype.calculateTriggerHeight = function() {
485
  var triggerHeight = 0;
486
 
487
- if( this.config.trigger.method === 'element' ) {
488
  var triggerElement = document.body.querySelector(this.config.trigger.value);
489
- if( triggerElement ) {
490
  var offset = triggerElement.getBoundingClientRect();
491
  triggerHeight = offset.top;
492
  }
493
- } else if( this.config.trigger.method === 'percentage' ) {
494
- triggerHeight = ( this.config.trigger.value / 100 * getDocumentHeight() );
495
  }
496
 
497
  return triggerHeight;
498
  };
499
 
500
  // checks whether window.location.hash equals the box element ID or that of any element inside the box
501
- Box.prototype.locationHashRefersBox = function() {
502
 
503
- if( ! window.location.hash || 0 === window.location.hash.length ) {
504
  return false;
505
  }
506
 
507
  var elementId = window.location.hash.substring(1);
508
- if( elementId === this.element.id ) {
509
  return true;
510
- } else if( this.element.querySelector('#' + elementId) ) {
511
  return true;
512
  }
513
 
514
  return false;
515
  };
516
 
517
- Box.prototype.fits = function() {
518
- if( this.config.minimumScreenWidth <= 0 ) {
519
  return true;
520
  }
521
 
522
- return window.innerWidth > this.config.minimumScreenWidth
523
  };
524
 
525
  // is this box enabled?
526
- Box.prototype.mayAutoShow = function() {
527
 
528
- if( this.dismissed ) {
529
  return false;
530
  }
531
 
532
  // check if box fits on given minimum screen width
533
- if( ! this.fits() ) {
534
  return false;
535
  }
536
 
537
  // if trigger empty or error in calculating triggerHeight, return false
538
- if( ! this.config.trigger ) {
539
  return false;
540
  }
541
 
542
  // rely on cookie value (show if not set, don't show if set)
543
- return ! this.cookieSet;
544
  };
545
 
546
- Box.prototype.mayRehide = function() {
547
  return this.config.rehide && this.triggered;
548
  };
549
 
550
- Box.prototype.isCookieSet = function() {
551
  // always show on test mode
552
- if(this.config.testMode) {
553
  return false;
554
  }
555
 
556
  // if either cookie is null or trigger & dismiss are both falsey, don't bother checking.
557
- if(!this.config.cookie || ( ! this.config.cookie.triggered && ! this.config.cookie.dismissed ) ) {
558
  return false;
559
  }
560
 
@@ -563,20 +582,20 @@ Box.prototype.isCookieSet = function() {
563
  };
564
 
565
  // set cookie that disables automatically showing the box
566
- Box.prototype.setCookie = function(hours) {
567
  var expiryDate = new Date();
568
- expiryDate.setHours( expiryDate.getHours() + hours);
569
- document.cookie = 'boxzilla_box_'+ this.id + '=true; expires='+ expiryDate.toUTCString() +'; path=/';
570
  };
571
 
572
- Box.prototype.trigger = function() {
573
  var shown = this.show();
574
- if( ! shown ) {
575
  return;
576
  }
577
 
578
  this.triggered = true;
579
- if(this.config.cookie && this.config.cookie.triggered) {
580
  this.setCookie(this.config.cookie.triggered);
581
  }
582
  };
@@ -587,12 +606,12 @@ Box.prototype.trigger = function() {
587
  * @param e The event that triggered this dismissal.
588
  * @returns {boolean}
589
  */
590
- Box.prototype.dismiss = function(e) {
591
  // prevent default action
592
  e && e.preventDefault();
593
 
594
  // only dismiss box if it's currently open.
595
- if( ! this.visible ) {
596
  return false;
597
  }
598
 
@@ -600,26 +619,24 @@ Box.prototype.dismiss = function(e) {
600
  this.hide();
601
 
602
  // set cookie
603
- if(this.config.cookie && this.config.cookie.dismissed) {
604
  this.setCookie(this.config.cookie.dismissed);
605
  }
606
 
607
  this.dismissed = true;
608
- Boxzilla.trigger('box.dismiss', [ this ]);
609
  return true;
610
  };
611
 
612
- module.exports = function(_Boxzilla) {
613
  Boxzilla = _Boxzilla;
614
  return Box;
615
  };
 
616
  },{"./animator.js":2}],4:[function(require,module,exports){
617
  'use strict';
618
 
619
- // failsafe against loading script twice...
620
- if( window.Boxzilla ) {
621
- return;
622
- }
623
 
624
  var EventEmitter = require('wolfy87-eventemitter'),
625
  Boxzilla = Object.create(EventEmitter.prototype),
@@ -627,17 +644,19 @@ var EventEmitter = require('wolfy87-eventemitter'),
627
  Timer = require('./timer.js'),
628
  boxes = [],
629
  overlay,
630
- exitIntentDelayTimer, exitIntentTriggered,
631
- siteTimer, pageTimer, pageViews;
 
 
 
632
 
633
  function throttle(fn, threshhold, scope) {
634
  threshhold || (threshhold = 250);
635
- var last,
636
- deferTimer;
637
  return function () {
638
  var context = scope || this;
639
 
640
- var now = +new Date,
641
  args = arguments;
642
  if (last && now < last + threshhold) {
643
  // hold on to it
@@ -664,16 +683,16 @@ function onKeyUp(e) {
664
  function checkPageViewsCriteria() {
665
 
666
  // don't bother if another box is currently open
667
- if( isAnyBoxVisible() ) {
668
  return;
669
  }
670
 
671
- boxes.forEach(function(box) {
672
- if( ! box.mayAutoShow() ) {
673
  return;
674
  }
675
 
676
- if( box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value ) {
677
  box.trigger();
678
  }
679
  });
@@ -682,12 +701,12 @@ function checkPageViewsCriteria() {
682
  // check time trigger criteria for each box
683
  function checkTimeCriteria() {
684
  // don't bother if another box is currently open
685
- if( isAnyBoxVisible() ) {
686
  return;
687
  }
688
 
689
- boxes.forEach(function(box) {
690
- if( ! box.mayAutoShow() ) {
691
  return;
692
  }
693
 
@@ -705,23 +724,23 @@ function checkTimeCriteria() {
705
 
706
  // check triggerHeight criteria for all boxes
707
  function checkHeightCriteria() {
708
- var scrollY = ( window.scrollY || window.pageYOffset ) + window.innerHeight * 0.75;
709
 
710
- boxes.forEach(function(box) {
711
 
712
- if( ! box.mayAutoShow() || box.triggerHeight <= 0 ) {
713
  return;
714
  }
715
 
716
- if( scrollY > box.triggerHeight ) {
717
  // don't bother if another box is currently open
718
- if( isAnyBoxVisible() ) {
719
  return;
720
  }
721
 
722
  // trigger box
723
  box.trigger();
724
- } else if( box.mayRehide() ) {
725
  box.hide();
726
  }
727
  });
@@ -729,7 +748,7 @@ function checkHeightCriteria() {
729
 
730
  // recalculate heights and variables based on height
731
  function recalculateHeights() {
732
- boxes.forEach(function(box) {
733
  box.setCustomBoxStyling();
734
  });
735
  }
@@ -739,12 +758,12 @@ function onOverlayClick(e) {
739
  var y = e.offsetY;
740
 
741
  // calculate if click was near a box to avoid closing it (click error margin)
742
- boxes.forEach(function(box) {
743
  var rect = box.element.getBoundingClientRect();
744
- var margin = 100 + ( window.innerWidth * 0.05 );
745
 
746
  // if click was not anywhere near box, dismiss it.
747
- if( x < ( rect.left - margin ) || x > ( rect.right + margin ) || y < ( rect.top - margin ) || y > ( rect.bottom + margin ) ) {
748
  box.dismiss();
749
  }
750
  });
@@ -752,12 +771,12 @@ function onOverlayClick(e) {
752
 
753
  function triggerExitIntent() {
754
  // do nothing if already triggered OR another box is visible.
755
- if(exitIntentTriggered || isAnyBoxVisible() ) {
756
  return;
757
  }
758
 
759
- boxes.forEach(function(box) {
760
- if(box.mayAutoShow() && box.config.trigger.method === 'exit_intent' ) {
761
  box.trigger();
762
  }
763
  });
@@ -769,17 +788,17 @@ function onMouseLeave(e) {
769
  var delay = 400;
770
 
771
  // did mouse leave at top of window?
772
- if( e.clientY <= 0 ) {
773
  exitIntentDelayTimer = window.setTimeout(triggerExitIntent, delay);
774
  }
775
  }
776
 
777
  function isAnyBoxVisible() {
778
 
779
- for( var i=0; i<boxes.length; i++ ) {
780
  var box = boxes[i];
781
 
782
- if( box.visible ) {
783
  return true;
784
  }
785
  }
@@ -788,20 +807,20 @@ function isAnyBoxVisible() {
788
  }
789
 
790
  function onMouseEnter() {
791
- if( exitIntentDelayTimer ) {
792
  window.clearInterval(exitIntentDelayTimer);
793
  exitIntentDelayTimer = null;
794
  }
795
  }
796
 
797
  var timers = {
798
- start: function() {
799
  var sessionTime = sessionStorage.getItem('boxzilla_timer');
800
- if( sessionTime ) siteTimer.time = sessionTime;
801
  siteTimer.start();
802
  pageTimer.start();
803
  },
804
- stop: function() {
805
  sessionStorage.setItem('boxzilla_timer', siteTimer.time);
806
  siteTimer.stop();
807
  pageTimer.stop();
@@ -809,7 +828,7 @@ var timers = {
809
  };
810
 
811
  // initialise & add event listeners
812
- Boxzilla.init = function() {
813
  siteTimer = new Timer(sessionStorage.getItem('boxzilla_timer') || 0);
814
  pageTimer = new Timer(0);
815
  pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;
@@ -831,17 +850,17 @@ Boxzilla.init = function() {
831
  window.addEventListener('touchmove', throttle(checkHeightCriteria));
832
  window.addEventListener('scroll', throttle(checkHeightCriteria));
833
  window.addEventListener('resize', throttle(recalculateHeights));
834
- window.addEventListener('load', recalculateHeights );
835
  overlay.addEventListener('click', onOverlayClick);
836
  window.setInterval(checkTimeCriteria, 1000);
837
- window.setTimeout(checkPageViewsCriteria, 1000 );
838
  document.documentElement.addEventListener('mouseleave', onMouseLeave);
839
  document.documentElement.addEventListener('mouseenter', onMouseEnter);
840
  document.addEventListener('keyup', onKeyUp);
841
 
842
  timers.start();
843
  window.addEventListener('focus', timers.start);
844
- window.addEventListener('beforeunload', function() {
845
  timers.stop();
846
  sessionStorage.setItem('boxzilla_pageviews', ++pageViews);
847
  });
@@ -858,52 +877,60 @@ Boxzilla.init = function() {
858
  *
859
  * @returns Box
860
  */
861
- Boxzilla.create = function(id, opts) {
862
  var box = new Box(id, opts);
863
  boxes.push(box);
864
  return box;
865
  };
866
 
867
- Boxzilla.get = function(id) {
868
- for( var i=0; i<boxes.length; i++) {
869
  var box = boxes[i];
870
- if( box.id == id ) {
871
  return box;
872
  }
873
  }
874
 
875
  throw new Error("No box exists with ID " + id);
876
- }
877
 
878
  // dismiss a single box (or all by omitting id param)
879
- Boxzilla.dismiss = function(id) {
880
  // if no id given, dismiss all current open boxes
881
- if( typeof(id) === "undefined" ) {
882
- boxes.forEach(function(box) { box.dismiss(); });
883
- } else if( typeof( boxes[id] ) === "object" ) {
 
 
884
  Boxzilla.get(id).dismiss();
885
  }
886
  };
887
 
888
- Boxzilla.hide = function(id) {
889
- if( typeof(id) === "undefined" ) {
890
- boxes.forEach(function(box) { box.hide(); });
 
 
891
  } else {
892
  Boxzilla.get(id).hide();
893
  }
894
  };
895
 
896
- Boxzilla.show = function(id) {
897
- if( typeof(id) === "undefined" ) {
898
- boxes.forEach(function(box) { box.show(); });
 
 
899
  } else {
900
  Boxzilla.get(id).show();
901
  }
902
  };
903
 
904
- Boxzilla.toggle = function(id) {
905
- if( typeof(id) === "undefined" ) {
906
- boxes.forEach(function(box) { box.toggle(); });
 
 
907
  } else {
908
  Boxzilla.get(id).toggle();
909
  }
@@ -914,38 +941,43 @@ Boxzilla.boxes = boxes;
914
 
915
  window.Boxzilla = Boxzilla;
916
 
917
- if ( typeof module !== 'undefined' && module.exports ) {
918
  module.exports = Boxzilla;
919
  }
 
920
  },{"./box.js":3,"./styles.js":5,"./timer.js":6,"wolfy87-eventemitter":7}],5:[function(require,module,exports){
921
- const 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}`;
 
 
922
  module.exports = styles;
 
923
  },{}],6:[function(require,module,exports){
924
  'use strict';
925
 
926
- var Timer = function(start) {
927
  this.time = start;
928
  this.interval = 0;
929
  };
930
 
931
- Timer.prototype.tick = function() {
932
  this.time++;
933
  };
934
 
935
- Timer.prototype.start = function() {
936
- if( ! this.interval ) {
937
  this.interval = window.setInterval(this.tick.bind(this), 1000);
938
  }
939
  };
940
 
941
- Timer.prototype.stop = function() {
942
- if( this.interval ) {
943
  window.clearInterval(this.interval);
944
  this.interval = 0;
945
  }
946
  };
947
 
948
  module.exports = Timer;
 
949
  },{}],7:[function(require,module,exports){
950
  /*!
951
  * EventEmitter v4.2.11 - git.io/ee
1
  (function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
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
+ var isLoggedIn = document.body.className.indexOf('logged-in') > -1;
12
 
13
+ // failsafe against including script twice.
14
+ if (options.inited) {
15
+ return;
16
+ }
 
17
 
18
+ // print message when test mode is enabled
19
+ if (isLoggedIn && options.testMode) {
20
+ console.log('Boxzilla: Test mode is enabled. Please disable test mode if you\'re done testing.');
 
 
21
  }
22
 
23
+ // init boxzilla
24
+ Boxzilla.init();
 
 
 
25
 
26
+ // create boxes from options
27
+ for (var i = 0; i < options.boxes.length; i++) {
28
+ // get opts
29
+ var boxOpts = options.boxes[i];
30
+ boxOpts.testMode = isLoggedIn && options.testMode;
31
 
32
+ // fix http:// links in box content....
33
+ if (window.location.protocol === "https:" && window.location.host) {
34
+ var o = "http://" + window.location.host;
35
+ var n = o.replace('http://', 'https://');
36
+ boxOpts.content = boxOpts.content.replace(o, n);
37
+ }
38
 
39
+ // create box
40
+ var box = Boxzilla.create(boxOpts.id, boxOpts);
 
41
 
42
+ // add custom css to box
43
+ css(box.element, boxOpts.css);
 
44
 
45
+ box.element.firstChild.firstChild.className += " first-child";
46
+ box.element.firstChild.lastChild.className += " last-child";
47
  }
48
 
49
+ // helper function for setting CSS styles
50
+ function css(element, styles) {
51
+ if (styles.background_color) {
52
+ element.style.background = styles.background_color;
53
+ }
54
+
55
+ if (styles.color) {
56
+ element.style.color = styles.color;
57
+ }
58
+
59
+ if (styles.border_color) {
60
+ element.style.borderColor = styles.border_color;
61
+ }
62
 
63
+ if (styles.border_width) {
64
+ element.style.borderWidth = parseInt(styles.border_width) + "px";
65
+ }
66
+
67
+ if (styles.border_style) {
68
+ element.style.borderStyle = styles.border_style;
69
+ }
70
+
71
+ if (styles.width) {
72
+ element.style.maxWidth = parseInt(styles.width) + "px";
73
+ }
74
  }
 
75
 
76
+ /**
77
+ * If a MailChimp for WordPress form was submitted, open the box containing that form (if any)
78
+ *
79
+ * TODO: Just set location hash from MailChimp for WP?
80
+ */
81
+ window.addEventListener('load', function () {
82
+ if (_typeof(window.mc4wp_forms_config) === "object" && window.mc4wp_forms_config.submitted_form) {
83
+ var selector = '#' + window.mc4wp_forms_config.submitted_form.element_id;
84
+ var boxes = Boxzilla.boxes;
85
+ for (var boxId in boxes) {
86
+ if (!boxes.hasOwnProperty(boxId)) {
87
+ continue;
88
+ }
89
+ var box = boxes[boxId];
90
+ if (box.element.querySelector(selector)) {
91
+ box.show();
92
+ return;
93
+ }
94
  }
95
  }
96
+ });
97
+
98
+ options.inited = true;
99
+ window.Boxzilla = Boxzilla;
100
+ })();
101
 
 
102
  },{"boxzilla":4}],2:[function(require,module,exports){
103
+ 'use strict';
104
+
105
  var duration = 320;
106
 
107
  function css(element, styles) {
108
+ for (var property in styles) {
109
  element.style[property] = styles[property];
110
  }
111
  }
112
 
113
  function initObjectProperties(properties, value) {
114
  var newObject = {};
115
+ for (var i = 0; i < properties.length; i++) {
116
  newObject[properties[i]] = value;
117
  }
118
  return newObject;
119
  }
120
 
121
  function copyObjectProperties(properties, object) {
122
+ var newObject = {};
123
+ for (var i = 0; i < properties.length; i++) {
124
  newObject[properties[i]] = object[properties[i]];
125
  }
126
  return newObject;
133
  * @returns {boolean}
134
  */
135
  function animated(element) {
136
+ return !!element.getAttribute('data-animated');
137
  }
138
 
139
  /**
147
 
148
  // create clone for reference
149
  var clone = element.cloneNode(true);
150
+ var cleanup = function cleanup() {
151
  element.removeAttribute('data-animated');
152
  element.setAttribute('style', clone.getAttribute('style'));
153
  element.style.display = nowVisible ? 'none' : '';
157
  element.setAttribute('data-animated', "true");
158
 
159
  // toggle element visiblity right away if we're making something visible
160
+ if (!nowVisible) {
161
  element.style.display = '';
162
  }
163
 
164
  var hiddenStyles, visibleStyles;
165
 
166
  // animate properties
167
+ if (animation === 'slide') {
168
  hiddenStyles = initObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 0);
169
  visibleStyles = {};
170
 
171
+ if (!nowVisible) {
172
  var computedStyles = window.getComputedStyle(element);
173
  visibleStyles = copyObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], computedStyles);
174
  css(element, hiddenStyles);
180
  } else {
181
  hiddenStyles = { opacity: 0 };
182
  visibleStyles = { opacity: 1 };
183
+ if (!nowVisible) {
184
  css(element, hiddenStyles);
185
  }
186
 
194
  var currentStyles = {};
195
  var propSteps = {};
196
 
197
+ for (var property in targetStyles) {
198
  // make sure we have an object filled with floats
199
  targetStyles[property] = parseFloat(targetStyles[property]);
200
 
203
  var current = parseFloat(initialStyles[property]);
204
 
205
  // is there something to do?
206
+ if (current == to) {
207
  delete targetStyles[property];
208
  continue;
209
  }
210
 
211
+ propSteps[property] = (to - current) / duration; // points per second
212
  currentStyles[property] = current;
213
  }
214
 
215
+ var tick = function tick() {
216
  var now = +new Date();
217
  var timeSinceLastTick = now - last;
218
  var done = true;
219
 
220
  var step, to, increment, newValue;
221
+ for (var property in targetStyles) {
222
  step = propSteps[property];
223
  to = targetStyles[property];
224
+ increment = step * timeSinceLastTick;
225
  newValue = currentStyles[property] + increment;
226
 
227
+ if (step > 0 && newValue >= to || step < 0 && newValue <= to) {
228
  newValue = to;
229
  } else {
230
  done = false;
240
  last = +new Date();
241
 
242
  // keep going until we're done for all props
243
+ if (!done) {
244
+ window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);
245
  } else {
246
  // call callback
247
  fn && fn();
251
  tick();
252
  }
253
 
 
254
  module.exports = {
255
  'toggle': toggle,
256
  'animate': animate,
257
  'animated': animated
258
  };
259
+
260
  },{}],3:[function(require,module,exports){
261
  'use strict';
262
 
263
  var defaults = {
264
+ 'animation': 'fade',
265
+ 'rehide': false,
266
+ 'content': '',
267
+ 'cookie': null,
268
+ 'icon': '&times',
269
+ 'minimumScreenWidth': 0,
270
+ 'position': 'center',
271
+ 'testMode': false,
272
+ 'trigger': false,
273
+ 'closable': true
274
+ },
275
  Boxzilla,
276
  Animator = require('./animator.js');
277
 
282
  * @param obj2
283
  * @returns {*}
284
  */
285
+ function merge(obj1, obj2) {
286
  var obj3 = {};
287
+ for (var attrname in obj1) {
288
+ obj3[attrname] = obj1[attrname];
289
+ }
290
+ for (var attrname in obj2) {
291
+ obj3[attrname] = obj2[attrname];
292
+ }
293
  return obj3;
294
  }
295
 
301
  var body = document.body,
302
  html = document.documentElement;
303
 
304
+ var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
 
305
 
306
  return height;
307
  }
308
 
309
  // Box Object
310
+ var Box = function Box(id, config) {
311
+ this.id = id;
312
 
313
  // store config values
314
  this.config = merge(defaults, config);
317
  this.overlay = document.getElementById('boxzilla-overlay');
318
 
319
  // state
320
+ this.visible = false;
321
+ this.dismissed = false;
322
+ this.triggered = false;
323
  this.triggerHeight = 0;
324
  this.cookieSet = false;
325
  this.element = null;
326
  this.closeIcon = null;
327
 
328
  // if a trigger was given, calculate values once and store
329
+ if (this.config.trigger) {
330
+ if (this.config.trigger.method === 'percentage' || this.config.trigger.method === 'element') {
331
  this.triggerHeight = this.calculateTriggerHeight();
332
  }
333
 
342
  };
343
 
344
  // initialise the box
345
+ Box.prototype.events = function () {
346
  var box = this;
347
 
348
  // attach event to "close" icon inside box
349
  this.closeIcon && this.closeIcon.addEventListener('click', box.dismiss.bind(this));
350
 
351
+ this.element.addEventListener('click', function (e) {
352
+ if (e.target.tagName === 'A') {
353
+ Boxzilla.trigger('box.interactions.link', [box, e.target]);
354
  }
355
  }, false);
356
 
357
+ this.element.addEventListener('submit', function (e) {
358
  box.setCookie();
359
+ Boxzilla.trigger('box.interactions.form', [box, e.target]);
360
  }, false);
361
+
362
+ window.addEventListener("hashchange", function () {
363
  var needle = "#boxzilla-" + box.id;
364
+ if (location.hash === needle) {
365
  box.toggle();
366
  }
367
  });
368
 
369
  // maybe show box right away
370
+ if (this.fits() && this.locationHashRefersBox()) {
371
  window.addEventListener('load', this.show.bind(this));
372
  }
 
373
  };
374
 
375
  // generate dom elements for this box
376
+ Box.prototype.dom = function () {
377
  var wrapper = document.createElement('div');
378
  wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';
379
 
390
 
391
  // remove <script> from box content and append them to the document body
392
  var scripts = content.querySelectorAll('script');
393
+ if (scripts.length) {
394
  var script = document.createElement('script');
395
+ for (var i = 0; i < scripts.length; i++) {
396
  script.appendChild(document.createTextNode(scripts[i].text));
397
  scripts[i].parentNode.removeChild(scripts[i]);
398
  }
399
  document.body.appendChild(script);
400
  }
401
+
402
+ if (this.config.closable && this.config.icon) {
403
  var closeIcon = document.createElement('span');
404
  closeIcon.className = "boxzilla-close-icon";
405
  closeIcon.innerHTML = this.config.icon;
412
  };
413
 
414
  // set (calculate) custom box styling depending on box options
415
+ Box.prototype.setCustomBoxStyling = function () {
416
 
417
  // reset element to its initial state
418
  var origDisplay = this.element.style.display;
425
  var boxHeight = this.element.clientHeight;
426
 
427
  // add scrollbar to box and limit height
428
+ if (boxHeight > windowHeight) {
429
  this.element.style.maxHeight = windowHeight + "px";
430
  this.element.style.overflowY = 'scroll';
431
  }
432
 
433
  // set new top margin for boxes which are centered
434
+ if (this.config.position === 'center') {
435
+ var newTopMargin = (windowHeight - boxHeight) / 2;
436
  newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;
437
  this.element.style.marginTop = newTopMargin + "px";
438
  }
441
  };
442
 
443
  // toggle visibility of the box
444
+ Box.prototype.toggle = function (show) {
445
 
446
  // revert visibility if no explicit argument is given
447
+ if (typeof show === "undefined") {
448
+ show = !this.visible;
449
  }
450
 
451
  // is box already at desired visibility?
452
+ if (show === this.visible) {
453
  return false;
454
  }
455
 
456
  // is box being animated?
457
+ if (Animator.animated(this.element)) {
458
  return false;
459
  }
460
 
461
  // if box should be hidden but is not closable, bail.
462
+ if (!show && !this.config.closable) {
463
  return false;
464