Version Description
Download this release
Release Info
Developer | DvanKooten |
Plugin | Boxzilla |
Version | 3.2.9 |
Comparing to | |
See all releases |
Code changes from version 3.2.7 to 3.2.9
- assets/browserify/admin/_designer.js +16 -14
- assets/js/admin-script.js +286 -288
- assets/js/admin-script.min.js +1 -1
- assets/js/admin-script.min.js.map +1 -1
- assets/js/script.js +536 -554
- assets/js/script.min.js +1 -1
- assets/js/script.min.js.map +1 -1
- assets/scss/admin-styles.scss +0 -181
- boxzilla.php +2 -2
- languages/boxzilla.pot +8 -8
- readme.txt +35 -47
- src/licensing/class-update-manager.php +6 -0
- vendor/composer/ClassLoader.php +4 -4
- vendor/composer/autoload_classmap.php +0 -1
- vendor/composer/autoload_static.php +0 -1
assets/browserify/admin/_designer.js
CHANGED
@@ -19,7 +19,6 @@ var Designer = function($, Option, events) {
|
|
19 |
|
20 |
// functions
|
21 |
function init() {
|
22 |
-
|
23 |
// Only run if TinyMCE has actually inited
|
24 |
if( typeof( window.tinyMCE ) !== "object" || tinyMCE.get('content') === null ) {
|
25 |
return;
|
@@ -57,23 +56,26 @@ var Designer = function($, Option, events) {
|
|
57 |
* @return bool
|
58 |
*/
|
59 |
function applyStyles() {
|
60 |
-
|
61 |
if( ! visualEditorInitialised ) {
|
62 |
return false;
|
63 |
}
|
64 |
|
65 |
-
//
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
77 |
|
78 |
return true;
|
79 |
}
|
19 |
|
20 |
// functions
|
21 |
function init() {
|
|
|
22 |
// Only run if TinyMCE has actually inited
|
23 |
if( typeof( window.tinyMCE ) !== "object" || tinyMCE.get('content') === null ) {
|
24 |
return;
|
56 |
* @return bool
|
57 |
*/
|
58 |
function applyStyles() {
|
|
|
59 |
if( ! visualEditorInitialised ) {
|
60 |
return false;
|
61 |
}
|
62 |
|
63 |
+
// Apply styles from CSS editor.
|
64 |
+
// Use short timeout to make sure color values are updated.
|
65 |
+
window.setTimeout(() => {
|
66 |
+
|
67 |
+
$innerEditor.css({
|
68 |
+
'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),
|
69 |
+
'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),
|
70 |
+
'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),
|
71 |
+
'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),
|
72 |
+
'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),
|
73 |
+
'color': options.color.getColorValue() // getColorValue( 'color', '' )
|
74 |
+
});
|
75 |
+
|
76 |
+
/* @since 2.0.3 */
|
77 |
+
events.trigger('editor.styles.apply');
|
78 |
+
}, 10)
|
79 |
|
80 |
return true;
|
81 |
}
|
assets/js/admin-script.js
CHANGED
@@ -1,296 +1,296 @@
|
|
1 |
-
(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){function e
|
2 |
-
|
3 |
|
4 |
window.Boxzilla_Admin = require('./admin/_admin.js');
|
5 |
|
6 |
},{"./admin/_admin.js":2}],2:[function(require,module,exports){
|
7 |
-
|
8 |
|
9 |
(function () {
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
var Option = require('./_option.js');
|
14 |
-
var optionControls = document.getElementById('boxzilla-box-options-controls');
|
15 |
-
var $optionControls = $(optionControls);
|
16 |
-
var tnLoggedIn = document.createTextNode(' logged in');
|
17 |
|
18 |
-
|
19 |
-
if ($optionControls.length === 0) {
|
20 |
-
return;
|
21 |
-
}
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
var rowTemplate = wp.template('rule-row-template');
|
27 |
-
var i18n = boxzilla_i18n;
|
28 |
-
var ruleComparisonEl = document.getElementById('boxzilla-rule-comparison');
|
29 |
-
var rulesContainerEl = document.getElementById('boxzilla-box-rules');
|
30 |
-
|
31 |
-
// events
|
32 |
-
$optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
|
33 |
-
$optionControls.on('click', ".boxzilla-remove-rule", removeRule);
|
34 |
-
$optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
|
35 |
-
$optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);
|
36 |
-
$(ruleComparisonEl).change(toggleAndOrTexts);
|
37 |
-
|
38 |
-
$(window).load(function () {
|
39 |
-
if (typeof window.tinyMCE === "undefined") {
|
40 |
-
document.getElementById('notice-notinymce').style.display = '';
|
41 |
-
}
|
42 |
-
});
|
43 |
|
44 |
-
|
45 |
-
|
|
|
46 |
|
47 |
-
|
48 |
-
var newText = ruleComparisonEl.value === 'any' ? i18n.or : i18n.and;
|
49 |
-
$('.boxzilla-andor').text(newText);
|
50 |
-
}
|
51 |
|
52 |
-
|
53 |
-
$optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');
|
54 |
-
}
|
55 |
|
56 |
-
|
57 |
-
var row = $(this).parents('tr');
|
58 |
|
59 |
-
|
60 |
-
|
|
|
|
|
61 |
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
|
|
65 |
|
66 |
-
|
67 |
-
var context = this.tagName.toLowerCase() === "tr" ? this : $(this).parents('tr').get(0);
|
68 |
-
var condition = context.querySelector('.boxzilla-rule-condition').value;
|
69 |
-
var valueInput = context.querySelector('.boxzilla-rule-value');
|
70 |
-
var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
|
71 |
-
var betterInput = valueInput.cloneNode(true);
|
72 |
-
var $betterInput = $(betterInput);
|
73 |
-
|
74 |
-
// remove previously added helpers
|
75 |
-
$(context.querySelectorAll('.boxzilla-helper')).remove();
|
76 |
-
|
77 |
-
// prepare better input
|
78 |
-
betterInput.removeAttribute('name');
|
79 |
-
betterInput.className = betterInput.className + ' boxzilla-helper';
|
80 |
-
valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
|
81 |
-
$betterInput.change(function () {
|
82 |
-
valueInput.value = this.value;
|
83 |
-
});
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
qualifierInput.querySelector('option[value="contains"]').style.display = 'none';
|
90 |
-
if (tnLoggedIn.parentNode) {
|
91 |
-
tnLoggedIn.parentNode.removeChild(tnLoggedIn);
|
92 |
-
}
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
betterInput.placeholder = i18n.enterCommaSeparatedValues;
|
98 |
-
break;
|
99 |
-
|
100 |
-
case '':
|
101 |
-
case 'everywhere':
|
102 |
-
qualifierInput.value = '1';
|
103 |
-
valueInput.value = '';
|
104 |
-
betterInput.style.display = 'none';
|
105 |
-
qualifierInput.style.display = 'none';
|
106 |
-
break;
|
107 |
-
|
108 |
-
case 'is_single':
|
109 |
-
case 'is_post':
|
110 |
-
betterInput.placeholder = i18n.enterCommaSeparatedPosts;
|
111 |
-
$betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", {
|
112 |
-
multiple: true,
|
113 |
-
multipleSep: ","
|
114 |
-
});
|
115 |
-
break;
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
$betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {
|
120 |
-
multiple: true,
|
121 |
-
multipleSep: ","
|
122 |
-
});
|
123 |
-
break;
|
124 |
|
125 |
-
|
126 |
-
betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
|
127 |
-
$betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", {
|
128 |
-
multiple: true,
|
129 |
-
multipleSep: ","
|
130 |
-
});
|
131 |
-
break;
|
132 |
-
|
133 |
-
case 'is_url':
|
134 |
-
qualifierInput.querySelector('option[value="contains"]').style.display = '';
|
135 |
-
qualifierInput.querySelector('option[value="not_contains"]').style.display = '';
|
136 |
-
betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
|
137 |
-
break;
|
138 |
-
|
139 |
-
case 'is_post_in_category':
|
140 |
-
$betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {
|
141 |
-
multiple: true,
|
142 |
-
multipleSep: ","
|
143 |
-
});
|
144 |
-
break;
|
145 |
|
146 |
-
|
147 |
-
|
148 |
-
multiple: true,
|
149 |
-
multipleSep: ","
|
150 |
-
});
|
151 |
-
break;
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
157 |
|
158 |
-
|
159 |
-
qualifierInput.querySelector('option[value="contains"]').style.display = '';
|
160 |
-
qualifierInput.querySelector('option[value="not_contains"]').style.display = '';
|
161 |
-
break;
|
162 |
|
163 |
-
|
164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
}
|
|
|
175 |
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
})();
|
182 |
|
183 |
},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(require,module,exports){
|
184 |
-
|
185 |
|
186 |
-
|
187 |
|
188 |
var Designer = function Designer($, Option, events) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
options = {},
|
196 |
-
visualEditorInitialised = false;
|
197 |
-
|
198 |
-
var $appearanceControls = $("#boxzilla-box-appearance-controls");
|
199 |
-
|
200 |
-
// create Option objects
|
201 |
-
options.borderColor = new Option('border-color');
|
202 |
-
options.borderWidth = new Option('border-width');
|
203 |
-
options.borderStyle = new Option('border-style');
|
204 |
-
options.backgroundColor = new Option('background-color');
|
205 |
-
options.width = new Option('width');
|
206 |
-
options.color = new Option('color');
|
207 |
-
|
208 |
-
// functions
|
209 |
-
function init() {
|
210 |
-
|
211 |
-
// Only run if TinyMCE has actually inited
|
212 |
-
if (_typeof(window.tinyMCE) !== "object" || tinyMCE.get('content') === null) {
|
213 |
-
return;
|
214 |
-
}
|
215 |
-
|
216 |
-
// add classes to TinyMCE <html>
|
217 |
-
$editorFrame = $("#content_ifr");
|
218 |
-
$editor = $editorFrame.contents().find('html');
|
219 |
-
$editor.css({
|
220 |
-
'background': 'white'
|
221 |
-
});
|
222 |
-
|
223 |
-
// add content class and padding to TinyMCE <body>
|
224 |
-
$innerEditor = $editor.find('#tinymce');
|
225 |
-
$innerEditor.addClass('boxzilla boxzilla-' + boxId);
|
226 |
-
$innerEditor.css({
|
227 |
-
'margin': 0,
|
228 |
-
'background': 'white',
|
229 |
-
'display': 'inline-block',
|
230 |
-
'width': 'auto',
|
231 |
-
'min-width': '240px',
|
232 |
-
'position': 'relative'
|
233 |
-
});
|
234 |
-
$innerEditor.get(0).style.cssText += ';padding: 25px !important;';
|
235 |
-
|
236 |
-
visualEditorInitialised = true;
|
237 |
-
|
238 |
-
/* @since 2.0.3 */
|
239 |
-
events.trigger('editor.init');
|
240 |
-
}
|
241 |
-
|
242 |
-
/**
|
243 |
-
* Applies the styles from the options to the TinyMCE Editor
|
244 |
-
*
|
245 |
-
* @return bool
|
246 |
-
*/
|
247 |
-
function applyStyles() {
|
248 |
-
|
249 |
-
if (!visualEditorInitialised) {
|
250 |
-
return false;
|
251 |
-
}
|
252 |
-
|
253 |
-
// apply styles from CSS editor
|
254 |
-
$innerEditor.css({
|
255 |
-
'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),
|
256 |
-
'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),
|
257 |
-
'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),
|
258 |
-
'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),
|
259 |
-
'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),
|
260 |
-
'color': options.color.getColorValue() // getColorValue( 'color', '' )
|
261 |
-
});
|
262 |
-
|
263 |
-
/* @since 2.0.3 */
|
264 |
-
events.trigger('editor.styles.apply');
|
265 |
-
|
266 |
-
return true;
|
267 |
-
}
|
268 |
-
|
269 |
-
function resetStyles() {
|
270 |
-
for (var key in options) {
|
271 |
-
if (key.substring(0, 5) === 'theme') {
|
272 |
-
continue;
|
273 |
-
}
|
274 |
-
|
275 |
-
options[key].clear();
|
276 |
-
}
|
277 |
-
applyStyles();
|
278 |
-
|
279 |
-
/* @since 2.0.3 */
|
280 |
-
events.trigger('editor.styles.reset');
|
281 |
-
}
|
282 |
-
|
283 |
-
// event binders
|
284 |
-
$appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });
|
285 |
-
$appearanceControls.find(":input").not(".boxzilla-color-field").change(applyStyles);
|
286 |
-
events.on('editor.init', applyStyles);
|
287 |
-
|
288 |
-
// public methods
|
289 |
-
return {
|
290 |
-
'init': init,
|
291 |
-
'resetStyles': resetStyles,
|
292 |
-
'options': options
|
293 |
-
};
|
294 |
};
|
295 |
|
296 |
module.exports = Designer;
|
@@ -301,61 +301,59 @@ module.exports = Designer;
|
|
301 |
var $ = window.jQuery;
|
302 |
|
303 |
var Option = function Option(element) {
|
|
|
|
|
|
|
|
|
304 |
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
}
|
309 |
|
310 |
-
|
311 |
-
console.error("Unable to find option element.");
|
312 |
-
}
|
313 |
-
|
314 |
-
this.element = element;
|
315 |
};
|
316 |
|
317 |
Option.prototype.getColorValue = function () {
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
};
|
328 |
|
329 |
Option.prototype.getPxValue = function (fallbackValue) {
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
|
334 |
-
|
335 |
};
|
336 |
|
337 |
Option.prototype.getValue = function (fallbackValue) {
|
|
|
|
|
|
|
338 |
|
339 |
-
|
340 |
-
return this.element.value;
|
341 |
-
}
|
342 |
-
|
343 |
-
return fallbackValue || '';
|
344 |
};
|
345 |
|
346 |
Option.prototype.clear = function () {
|
347 |
-
|
348 |
};
|
349 |
|
350 |
Option.prototype.setValue = function (value) {
|
351 |
-
|
352 |
};
|
353 |
|
354 |
module.exports = Option;
|
355 |
|
356 |
},{}],5:[function(require,module,exports){
|
357 |
/*!
|
358 |
-
* EventEmitter v5.2.
|
359 |
* Unlicense - http://unlicense.org/
|
360 |
* Oliver Caldwell - http://oli.me.uk/
|
361 |
* @preserve
|
@@ -839,7 +837,7 @@ module.exports = Option;
|
|
839 |
else {
|
840 |
exports.EventEmitter = EventEmitter;
|
841 |
}
|
842 |
-
}(this || {}));
|
843 |
|
844 |
},{}]},{},[1]);
|
845 |
; })();
|
1 |
+
(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
2 |
+
"use strict";
|
3 |
|
4 |
window.Boxzilla_Admin = require('./admin/_admin.js');
|
5 |
|
6 |
},{"./admin/_admin.js":2}],2:[function(require,module,exports){
|
7 |
+
"use strict";
|
8 |
|
9 |
(function () {
|
10 |
+
'use strict';
|
11 |
|
12 |
+
var $ = window.jQuery;
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
var Option = require('./_option.js');
|
|
|
|
|
|
|
15 |
|
16 |
+
var optionControls = document.getElementById('boxzilla-box-options-controls');
|
17 |
+
var $optionControls = $(optionControls);
|
18 |
+
var tnLoggedIn = document.createTextNode(' logged in'); // sanity check, are we on the correct page?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
if ($optionControls.length === 0) {
|
21 |
+
return;
|
22 |
+
}
|
23 |
|
24 |
+
var EventEmitter = require('wolfy87-eventemitter');
|
|
|
|
|
|
|
25 |
|
26 |
+
var events = new EventEmitter();
|
|
|
|
|
27 |
|
28 |
+
var Designer = require('./_designer.js')($, Option, events);
|
|
|
29 |
|
30 |
+
var rowTemplate = wp.template('rule-row-template');
|
31 |
+
var i18n = boxzilla_i18n;
|
32 |
+
var ruleComparisonEl = document.getElementById('boxzilla-rule-comparison');
|
33 |
+
var rulesContainerEl = document.getElementById('boxzilla-box-rules'); // events
|
34 |
|
35 |
+
$optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
|
36 |
+
$optionControls.on('click', ".boxzilla-remove-rule", removeRule);
|
37 |
+
$optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
|
38 |
+
$optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);
|
39 |
+
$(ruleComparisonEl).change(toggleAndOrTexts);
|
40 |
+
$(window).load(function () {
|
41 |
+
if (typeof window.tinyMCE === "undefined") {
|
42 |
+
document.getElementById('notice-notinymce').style.display = '';
|
43 |
}
|
44 |
+
}); // call contextual helper method for each row
|
45 |
|
46 |
+
$('.boxzilla-rule-row').each(setContextualHelpers);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
function toggleAndOrTexts() {
|
49 |
+
var newText = ruleComparisonEl.value === 'any' ? i18n.or : i18n.and;
|
50 |
+
$('.boxzilla-andor').text(newText);
|
51 |
+
}
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
function toggleTriggerOptions() {
|
54 |
+
$optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');
|
55 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
function removeRule() {
|
58 |
+
var row = $(this).parents('tr'); // delete andor row
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
+
row.prev().remove(); // delete rule row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
+
row.remove();
|
63 |
+
}
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
function setContextualHelpers() {
|
66 |
+
var context = this.tagName.toLowerCase() === "tr" ? this : $(this).parents('tr').get(0);
|
67 |
+
var condition = context.querySelector('.boxzilla-rule-condition').value;
|
68 |
+
var valueInput = context.querySelector('.boxzilla-rule-value');
|
69 |
+
var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
|
70 |
+
var betterInput = valueInput.cloneNode(true);
|
71 |
+
var $betterInput = $(betterInput); // remove previously added helpers
|
72 |
|
73 |
+
$(context.querySelectorAll('.boxzilla-helper')).remove(); // prepare better input
|
|
|
|
|
|
|
74 |
|
75 |
+
betterInput.removeAttribute('name');
|
76 |
+
betterInput.className = betterInput.className + ' boxzilla-helper';
|
77 |
+
valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
|
78 |
+
$betterInput.change(function () {
|
79 |
+
valueInput.value = this.value;
|
80 |
+
});
|
81 |
+
betterInput.style.display = '';
|
82 |
+
valueInput.style.display = 'none';
|
83 |
+
qualifierInput.style.display = '';
|
84 |
+
qualifierInput.querySelector('option[value="not_contains"]').style.display = 'none';
|
85 |
+
qualifierInput.querySelector('option[value="contains"]').style.display = 'none';
|
86 |
+
|
87 |
+
if (tnLoggedIn.parentNode) {
|
88 |
+
tnLoggedIn.parentNode.removeChild(tnLoggedIn);
|
89 |
+
} // change placeholder for textual help
|
90 |
+
|
91 |
+
|
92 |
+
switch (condition) {
|
93 |
+
default:
|
94 |
+
betterInput.placeholder = i18n.enterCommaSeparatedValues;
|
95 |
+
break;
|
96 |
+
|
97 |
+
case '':
|
98 |
+
case 'everywhere':
|
99 |
+
qualifierInput.value = '1';
|
100 |
+
valueInput.value = '';
|
101 |
+
betterInput.style.display = 'none';
|
102 |
+
qualifierInput.style.display = 'none';
|
103 |
+
break;
|
104 |
+
|
105 |
+
case 'is_single':
|
106 |
+
case 'is_post':
|
107 |
+
betterInput.placeholder = i18n.enterCommaSeparatedPosts;
|
108 |
+
$betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", {
|
109 |
+
multiple: true,
|
110 |
+
multipleSep: ","
|
111 |
+
});
|
112 |
+
break;
|
113 |
|
114 |
+
case 'is_page':
|
115 |
+
betterInput.placeholder = i18n.enterCommaSeparatedPages;
|
116 |
+
$betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {
|
117 |
+
multiple: true,
|
118 |
+
multipleSep: ","
|
119 |
+
});
|
120 |
+
break;
|
121 |
+
|
122 |
+
case 'is_post_type':
|
123 |
+
betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
|
124 |
+
$betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", {
|
125 |
+
multiple: true,
|
126 |
+
multipleSep: ","
|
127 |
+
});
|
128 |
+
break;
|
129 |
+
|
130 |
+
case 'is_url':
|
131 |
+
qualifierInput.querySelector('option[value="contains"]').style.display = '';
|
132 |
+
qualifierInput.querySelector('option[value="not_contains"]').style.display = '';
|
133 |
+
betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
|
134 |
+
break;
|
135 |
+
|
136 |
+
case 'is_post_in_category':
|
137 |
+
$betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {
|
138 |
+
multiple: true,
|
139 |
+
multipleSep: ","
|
140 |
+
});
|
141 |
+
break;
|
142 |
+
|
143 |
+
case 'is_post_with_tag':
|
144 |
+
$betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {
|
145 |
+
multiple: true,
|
146 |
+
multipleSep: ","
|
147 |
+
});
|
148 |
+
break;
|
149 |
+
|
150 |
+
case 'is_user_logged_in':
|
151 |
+
betterInput.style.display = 'none';
|
152 |
+
valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);
|
153 |
+
break;
|
154 |
+
|
155 |
+
case 'is_referer':
|
156 |
+
qualifierInput.querySelector('option[value="contains"]').style.display = '';
|
157 |
+
qualifierInput.querySelector('option[value="not_contains"]').style.display = '';
|
158 |
+
break;
|
159 |
}
|
160 |
+
}
|
161 |
|
162 |
+
function addRuleFields() {
|
163 |
+
var data = {
|
164 |
+
'key': optionControls.querySelectorAll('.boxzilla-rule-row').length,
|
165 |
+
'andor': ruleComparisonEl.value === 'any' ? i18n.or : i18n.and
|
166 |
};
|
167 |
+
var html = rowTemplate(data);
|
168 |
+
$(rulesContainerEl).append(html);
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
|
172 |
+
module.exports = {
|
173 |
+
'Designer': Designer,
|
174 |
+
'Option': Option,
|
175 |
+
'events': events
|
176 |
+
};
|
177 |
})();
|
178 |
|
179 |
},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(require,module,exports){
|
180 |
+
"use strict";
|
181 |
|
182 |
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
183 |
|
184 |
var Designer = function Designer($, Option, events) {
|
185 |
+
// vars
|
186 |
+
var boxId = document.getElementById('post_ID').value || 0,
|
187 |
+
$editor,
|
188 |
+
$editorFrame,
|
189 |
+
$innerEditor,
|
190 |
+
options = {},
|
191 |
+
visualEditorInitialised = false;
|
192 |
+
var $appearanceControls = $("#boxzilla-box-appearance-controls"); // create Option objects
|
193 |
+
|
194 |
+
options.borderColor = new Option('border-color');
|
195 |
+
options.borderWidth = new Option('border-width');
|
196 |
+
options.borderStyle = new Option('border-style');
|
197 |
+
options.backgroundColor = new Option('background-color');
|
198 |
+
options.width = new Option('width');
|
199 |
+
options.color = new Option('color'); // functions
|
200 |
+
|
201 |
+
function init() {
|
202 |
+
// Only run if TinyMCE has actually inited
|
203 |
+
if (_typeof(window.tinyMCE) !== "object" || tinyMCE.get('content') === null) {
|
204 |
+
return;
|
205 |
+
} // add classes to TinyMCE <html>
|
206 |
+
|
207 |
+
|
208 |
+
$editorFrame = $("#content_ifr");
|
209 |
+
$editor = $editorFrame.contents().find('html');
|
210 |
+
$editor.css({
|
211 |
+
'background': 'white'
|
212 |
+
}); // add content class and padding to TinyMCE <body>
|
213 |
+
|
214 |
+
$innerEditor = $editor.find('#tinymce');
|
215 |
+
$innerEditor.addClass('boxzilla boxzilla-' + boxId);
|
216 |
+
$innerEditor.css({
|
217 |
+
'margin': 0,
|
218 |
+
'background': 'white',
|
219 |
+
'display': 'inline-block',
|
220 |
+
'width': 'auto',
|
221 |
+
'min-width': '240px',
|
222 |
+
'position': 'relative'
|
223 |
+
});
|
224 |
+
$innerEditor.get(0).style.cssText += ';padding: 25px !important;';
|
225 |
+
visualEditorInitialised = true;
|
226 |
+
/* @since 2.0.3 */
|
227 |
+
|
228 |
+
events.trigger('editor.init');
|
229 |
+
}
|
230 |
+
/**
|
231 |
+
* Applies the styles from the options to the TinyMCE Editor
|
232 |
+
*
|
233 |
+
* @return bool
|
234 |
+
*/
|
235 |
+
|
236 |
+
|
237 |
+
function applyStyles() {
|
238 |
+
if (!visualEditorInitialised) {
|
239 |
+
return false;
|
240 |
+
} // Apply styles from CSS editor.
|
241 |
+
// Use short timeout to make sure color values are updated.
|
242 |
+
|
243 |
+
|
244 |
+
window.setTimeout(function () {
|
245 |
+
$innerEditor.css({
|
246 |
+
'border-color': options.borderColor.getColorValue(),
|
247 |
+
//getColorValue( 'borderColor', '' ),
|
248 |
+
'border-width': options.borderWidth.getPxValue(),
|
249 |
+
//getPxValue( 'borderWidth', '' ),
|
250 |
+
'border-style': options.borderStyle.getValue(),
|
251 |
+
//getValue('borderStyle', '' ),
|
252 |
+
'background-color': options.backgroundColor.getColorValue(),
|
253 |
+
//getColorValue( 'backgroundColor', ''),
|
254 |
+
'width': options.width.getPxValue(),
|
255 |
+
//getPxValue( 'width', 'auto' ),
|
256 |
+
'color': options.color.getColorValue() // getColorValue( 'color', '' )
|
257 |
+
|
258 |
+
});
|
259 |
+
/* @since 2.0.3 */
|
260 |
+
|
261 |
+
events.trigger('editor.styles.apply');
|
262 |
+
}, 10);
|
263 |
+
return true;
|
264 |
+
}
|
265 |
+
|
266 |
+
function resetStyles() {
|
267 |
+
for (var key in options) {
|
268 |
+
if (key.substring(0, 5) === 'theme') {
|
269 |
+
continue;
|
270 |
+
}
|
271 |
+
|
272 |
+
options[key].clear();
|
273 |
+
}
|
274 |
+
|
275 |
+
applyStyles();
|
276 |
+
/* @since 2.0.3 */
|
277 |
+
|
278 |
+
events.trigger('editor.styles.reset');
|
279 |
+
} // event binders
|
280 |
+
|
281 |
+
|
282 |
+
$appearanceControls.find('input.boxzilla-color-field').wpColorPicker({
|
283 |
+
change: applyStyles,
|
284 |
+
clear: applyStyles
|
285 |
+
});
|
286 |
+
$appearanceControls.find(":input").not(".boxzilla-color-field").change(applyStyles);
|
287 |
+
events.on('editor.init', applyStyles); // public methods
|
288 |
|
289 |
+
return {
|
290 |
+
'init': init,
|
291 |
+
'resetStyles': resetStyles,
|
292 |
+
'options': options
|
293 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
};
|
295 |
|
296 |
module.exports = Designer;
|
301 |
var $ = window.jQuery;
|
302 |
|
303 |
var Option = function Option(element) {
|
304 |
+
// find corresponding element
|
305 |
+
if (typeof element == "string") {
|
306 |
+
element = document.getElementById('boxzilla-' + element);
|
307 |
+
}
|
308 |
|
309 |
+
if (!element) {
|
310 |
+
console.error("Unable to find option element.");
|
311 |
+
}
|
|
|
312 |
|
313 |
+
this.element = element;
|
|
|
|
|
|
|
|
|
314 |
};
|
315 |
|
316 |
Option.prototype.getColorValue = function () {
|
317 |
+
if (this.element.value.length > 0) {
|
318 |
+
if ($(this.element).hasClass('wp-color-field')) {
|
319 |
+
return $(this.element).wpColorPicker('color');
|
320 |
+
} else {
|
321 |
+
return this.element.value;
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
return '';
|
326 |
};
|
327 |
|
328 |
Option.prototype.getPxValue = function (fallbackValue) {
|
329 |
+
if (this.element.value.length > 0) {
|
330 |
+
return parseInt(this.element.value) + "px";
|
331 |
+
}
|
332 |
|
333 |
+
return fallbackValue || '';
|
334 |
};
|
335 |
|
336 |
Option.prototype.getValue = function (fallbackValue) {
|
337 |
+
if (this.element.value.length > 0) {
|
338 |
+
return this.element.value;
|
339 |
+
}
|
340 |
|
341 |
+
return fallbackValue || '';
|
|
|
|
|
|
|
|
|
342 |
};
|
343 |
|
344 |
Option.prototype.clear = function () {
|
345 |
+
this.element.value = '';
|
346 |
};
|
347 |
|
348 |
Option.prototype.setValue = function (value) {
|
349 |
+
this.element.value = value;
|
350 |
};
|
351 |
|
352 |
module.exports = Option;
|
353 |
|
354 |
},{}],5:[function(require,module,exports){
|
355 |
/*!
|
356 |
+
* EventEmitter v5.2.5 - git.io/ee
|
357 |
* Unlicense - http://unlicense.org/
|
358 |
* Oliver Caldwell - http://oli.me.uk/
|
359 |
* @preserve
|
837 |
else {
|
838 |
exports.EventEmitter = EventEmitter;
|
839 |
}
|
840 |
+
}(typeof window !== 'undefined' ? window : this || {}));
|
841 |
|
842 |
},{}]},{},[1]);
|
843 |
; })();
|
assets/js/admin-script.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
!function(){var
|
2 |
//# sourceMappingURL=admin-script.min.js.map
|
1 |
+
!function(){var s=void 0;!function i(l,s,a){function u(t,e){if(!s[t]){if(!l[t]){var n=!1;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}var r=s[t]={exports:{}};l[t][0].call(r.exports,function(e){return u(l[t][1][e]||e)},r,r.exports,i,l,s,a)}return s[t].exports}for(var c=!1,e=0;e<a.length;e++)u(a[e]);return u}({1:[function(e,t,n){"use strict";window.Boxzilla_Admin=e("./admin/_admin.js")},{"./admin/_admin.js":2}],2:[function(d,f,e){"use strict";!function(){var l=window.jQuery,e=d("./_option.js"),n=document.getElementById("boxzilla-box-options-controls"),t=l(n),s=document.createTextNode(" logged in");if(0!==t.length){var o=new(d("wolfy87-eventemitter")),r=d("./_designer.js")(l,e,o),i=wp.template("rule-row-template"),a=boxzilla_i18n,u=document.getElementById("boxzilla-rule-comparison"),c=document.getElementById("boxzilla-box-rules");t.on("click",".boxzilla-add-rule",function(){var e={key:n.querySelectorAll(".boxzilla-rule-row").length,andor:"any"===u.value?a.or:a.and},t=i(e);return l(c).append(t),!1}),t.on("click",".boxzilla-remove-rule",function(){var e=l(this).parents("tr");e.prev().remove(),e.remove()}),t.on("change",".boxzilla-rule-condition",p),t.find(".boxzilla-auto-show-trigger").on("change",function(){t.find(".boxzilla-trigger-options").toggle(""!==this.value)}),l(u).change(function(){var e="any"===u.value?a.or:a.and;l(".boxzilla-andor").text(e)}),l(window).load(function(){void 0===window.tinyMCE&&(document.getElementById("notice-notinymce").style.display="")}),l(".boxzilla-rule-row").each(p),f.exports={Designer:r,Option:e,events:o}}function p(){var e="tr"===this.tagName.toLowerCase()?this:l(this).parents("tr").get(0),t=e.querySelector(".boxzilla-rule-condition").value,n=e.querySelector(".boxzilla-rule-value"),o=e.querySelector(".boxzilla-rule-qualifier"),r=n.cloneNode(!0),i=l(r);switch(l(e.querySelectorAll(".boxzilla-helper")).remove(),r.removeAttribute("name"),r.className=r.className+" boxzilla-helper",n.parentNode.insertBefore(r,n.nextSibling),i.change(function(){n.value=this.value}),r.style.display="",n.style.display="none",o.style.display="",o.querySelector('option[value="not_contains"]').style.display="none",o.querySelector('option[value="contains"]').style.display="none",s.parentNode&&s.parentNode.removeChild(s),t){default:r.placeholder=a.enterCommaSeparatedValues;break;case"":case"everywhere":o.value="1",n.value="",r.style.display="none",o.style.display="none";break;case"is_single":case"is_post":r.placeholder=a.enterCommaSeparatedPosts,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post",{multiple:!0,multipleSep:","});break;case"is_page":r.placeholder=a.enterCommaSeparatedPages,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=page",{multiple:!0,multipleSep:","});break;case"is_post_type":r.placeholder=a.enterCommaSeparatedPostTypes,i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_type",{multiple:!0,multipleSep:","});break;case"is_url":o.querySelector('option[value="contains"]').style.display="",o.querySelector('option[value="not_contains"]').style.display="",r.placeholder=a.enterCommaSeparatedRelativeUrls;break;case"is_post_in_category":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=category",{multiple:!0,multipleSep:","});break;case"is_post_with_tag":i.suggest(ajaxurl+"?action=boxzilla_autocomplete&type=post_tag",{multiple:!0,multipleSep:","});break;case"is_user_logged_in":r.style.display="none",n.parentNode.insertBefore(s,n.nextSibling);break;case"is_referer":o.querySelector('option[value="contains"]').style.display="",o.querySelector('option[value="not_contains"]').style.display=""}}}()},{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(e,t,n){"use strict";function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.exports=function(e,t,n){var o,r,i,l=document.getElementById("post_ID").value||0,s={},a=!1,u=e("#boxzilla-box-appearance-controls");function c(){return!!a&&(window.setTimeout(function(){i.css({"border-color":s.borderColor.getColorValue(),"border-width":s.borderWidth.getPxValue(),"border-style":s.borderStyle.getValue(),"background-color":s.backgroundColor.getColorValue(),width:s.width.getPxValue(),color:s.color.getColorValue()}),n.trigger("editor.styles.apply")},10),!0)}return s.borderColor=new t("border-color"),s.borderWidth=new t("border-width"),s.borderStyle=new t("border-style"),s.backgroundColor=new t("background-color"),s.width=new t("width"),s.color=new t("color"),u.find("input.boxzilla-color-field").wpColorPicker({change:c,clear:c}),u.find(":input").not(".boxzilla-color-field").change(c),n.on("editor.init",c),{init:function(){"object"===p(window.tinyMCE)&&null!==tinyMCE.get("content")&&(r=e("#content_ifr"),(o=r.contents().find("html")).css({background:"white"}),(i=o.find("#tinymce")).addClass("boxzilla boxzilla-"+l),i.css({margin:0,background:"white",display:"inline-block",width:"auto","min-width":"240px",position:"relative"}),i.get(0).style.cssText+=";padding: 25px !important;",a=!0,n.trigger("editor.init"))},resetStyles:function(){for(var e in s)"theme"!==e.substring(0,5)&&s[e].clear();c(),n.trigger("editor.styles.reset")},options:s}}},{}],4:[function(e,t,n){"use strict";var o=window.jQuery,r=function(e){"string"==typeof e&&(e=document.getElementById("boxzilla-"+e)),e||console.error("Unable to find option element."),this.element=e};r.prototype.getColorValue=function(){return 0<this.element.value.length?o(this.element).hasClass("wp-color-field")?o(this.element).wpColorPicker("color"):this.element.value:""},r.prototype.getPxValue=function(e){return 0<this.element.value.length?parseInt(this.element.value)+"px":e||""},r.prototype.getValue=function(e){return 0<this.element.value.length?this.element.value:e||""},r.prototype.clear=function(){this.element.value=""},r.prototype.setValue=function(e){this.element.value=e},t.exports=r},{}],5:[function(e,l,t){!function(e){"use strict";function t(){}var n=t.prototype,o=e.EventEmitter;function i(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function r(e){return function(){return this[e].apply(this,arguments)}}n.getListeners=function(e){var t,n,o=this._getEvents();if(e instanceof RegExp)for(n in t={},o)o.hasOwnProperty(n)&&e.test(n)&&(t[n]=o[n]);else t=o[e]||(o[e]=[]);return t},n.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},n.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&((t={})[e]=n),t||n},n.addListener=function(e,t){if(!function e(t){return"function"==typeof t||t instanceof RegExp||!(!t||"object"!=typeof t)&&e(t.listener)}(t))throw new TypeError("listener must be a function");var n,o=this.getListenersAsObject(e),r="object"==typeof t;for(n in o)o.hasOwnProperty(n)&&-1===i(o[n],t)&&o[n].push(r?t:{listener:t,once:!1});return this},n.on=r("addListener"),n.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},n.once=r("addOnceListener"),n.defineEvent=function(e){return this.getListeners(e),this},n.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},n.removeListener=function(e,t){var n,o,r=this.getListenersAsObject(e);for(o in r)r.hasOwnProperty(o)&&-1!==(n=i(r[o],t))&&r[o].splice(n,1);return this},n.off=r("removeListener"),n.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},n.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},n.manipulateListeners=function(e,t,n){var o,r,i=e?this.removeListener:this.addListener,l=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(o=n.length;o--;)i.call(this,t,n[o]);else for(o in t)t.hasOwnProperty(o)&&(r=t[o])&&("function"==typeof r?i.call(this,o,r):l.call(this,o,r));return this},n.removeEvent=function(e){var t,n=typeof e,o=this._getEvents();if("string"===n)delete o[e];else if(e instanceof RegExp)for(t in o)o.hasOwnProperty(t)&&e.test(t)&&delete o[t];else delete this._events;return this},n.removeAllListeners=r("removeEvent"),n.emitEvent=function(e,t){var n,o,r,i,l=this.getListenersAsObject(e);for(i in l)if(l.hasOwnProperty(i))for(n=l[i].slice(0),r=0;r<n.length;r++)!0===(o=n[r]).once&&this.removeListener(e,o.listener),o.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,o.listener);return this},n.trigger=r("emitEvent"),n.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},n.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},n._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},n._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return e.EventEmitter=o,t},"function"==typeof s&&s.amd?s(function(){return t}):"object"==typeof l&&l.exports?l.exports=t:e.EventEmitter=t}("undefined"!=typeof window?window:this||{})},{}]},{},[1])}();
|
2 |
//# sourceMappingURL=admin-script.min.js.map
|
assets/js/admin-script.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["admin-script.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","window","Boxzilla_Admin","./admin/_admin.js","2","setContextualHelpers","context","this","tagName","toLowerCase","$","parents","get","condition","querySelector","value","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","querySelectorAll","remove","removeAttribute","className","parentNode","insertBefore","nextSibling","change","style","display","tnLoggedIn","removeChild","placeholder","i18n","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","jQuery","Option","optionControls","document","getElementById","$optionControls","createTextNode","events","Designer","rowTemplate","wp","template","boxzilla_i18n","ruleComparisonEl","rulesContainerEl","on","data","key","andor","or","and","html","append","row","prev","find","toggle","newText","text","load","tinyMCE","each","./_designer.js","./_option.js","wolfy87-eventemitter","3","_typeof","Symbol","iterator","obj","constructor","prototype","applyStyles","visualEditorInitialised","$innerEditor","css","border-color","options","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","width","color","trigger","$editor","$editorFrame","boxId","$appearanceControls","wpColorPicker","clear","not","init","contents","background","addClass","margin","min-width","position","cssText","resetStyles","substring","4","element","console","error","hasClass","fallbackValue","parseInt","setValue","5","EventEmitter","indexOfListener","listeners","listener","alias","name","apply","arguments","isValidListener","RegExp","proto","originalGlobalValue","getListeners","evt","response","_getEvents","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","TypeError","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"CAAA,WAAe,IAAIA,OAAUC,EAAgEC,OAASD,GAAW,WAAY,SAASE,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAkB,mBAATV,GAAqBA,EAAQ,IAAIS,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EAAEG,IAAIQ,YAAYZ,EAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,IAAIE,EAAED,EAAEI,GAAG,GAAGL,GAAG,OAAOI,EAAEF,GAAIF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGQ,QAAkD,IAAI,IAA1CL,EAAkB,mBAATX,GAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAAE,OAAOJ,EAA3c,EAAA,EAAkdgB,GAAG,SAASnB,EAAQoB,EAAOJ,GAC9lB,aAEAK,OAAOC,eAAiBtB,EAAQ,uBAE7BuB,oBAAoB,IAAIC,GAAG,SAASxB,EAAQoB,EAAOJ,GACtD,cAEA,WAyDI,SAASS,IACL,IAAIC,EAAyC,OAA/BC,KAAKC,QAAQC,cAAyBF,KAAOG,EAAEH,MAAMI,QAAQ,MA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lI,KAAMwK,SAExBxK,KAAK2K,uBAClB3K,KAAK2J,eAAelB,EAAKV,EAASA,UAMlD,OAAO/H,MAMXsI,EAAMrC,QAAU+B,EAAM,aAUtBM,EAAMsC,KAAO,SAAcnC,GACvB,IAAI+B,EAAOtB,MAAMpE,UAAU4F,MAAMpL,KAAK6I,UAAW,GACjD,OAAOnI,KAAKuK,UAAU9B,EAAK+B,IAW/BlC,EAAMuC,mBAAqB,SAA4BrK,GAEnD,OADAR,KAAK8K,iBAAmBtK,EACjBR,MAWXsI,EAAMqC,oBAAsB,WACxB,OAAI3K,KAAK4I,eAAe,qBACb5I,KAAK8K,kBAapBxC,EAAMK,WAAa,WACf,OAAO3I,KAAKqK,UAAYrK,KAAKqK,aAQjCzC,EAAamD,WAAa,WAEtB,OADA1L,EAAQuI,aAAeW,EAChBX,GAIW,mBAAXrJ,GAAyBA,EAAOyM,IACvCzM,EAAO,WACH,OAAOqJ,IAGY,iBAAXnI,GAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUuI,EAGjBvI,EAAQuI,aAAeA,EA5d9B,CA8dC5H,oBAES,IA30BX","file":"admin-script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){\n'use strict';\n\nwindow.Boxzilla_Admin = require('./admin/_admin.js');\n\n},{\"./admin/_admin.js\":2}],2:[function(require,module,exports){\n'use strict';\n\n(function () {\n 'use strict';\n\n var $ = window.jQuery;\n var Option = require('./_option.js');\n var optionControls = document.getElementById('boxzilla-box-options-controls');\n var $optionControls = $(optionControls);\n var tnLoggedIn = document.createTextNode(' logged in');\n\n // sanity check, are we on the correct page?\n if ($optionControls.length === 0) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter');\n var events = new EventEmitter();\n var Designer = require('./_designer.js')($, Option, events);\n var rowTemplate = wp.template('rule-row-template');\n var i18n = boxzilla_i18n;\n var ruleComparisonEl = document.getElementById('boxzilla-rule-comparison');\n var rulesContainerEl = document.getElementById('boxzilla-box-rules');\n\n // events\n $optionControls.on('click', \".boxzilla-add-rule\", addRuleFields);\n $optionControls.on('click', \".boxzilla-remove-rule\", removeRule);\n $optionControls.on('change', \".boxzilla-rule-condition\", setContextualHelpers);\n $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);\n $(ruleComparisonEl).change(toggleAndOrTexts);\n\n $(window).load(function () {\n if (typeof window.tinyMCE === \"undefined\") {\n document.getElementById('notice-notinymce').style.display = '';\n }\n });\n\n // call contextual helper method for each row\n $('.boxzilla-rule-row').each(setContextualHelpers);\n\n function toggleAndOrTexts() {\n var newText = ruleComparisonEl.value === 'any' ? i18n.or : i18n.and;\n $('.boxzilla-andor').text(newText);\n }\n\n function toggleTriggerOptions() {\n $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n }\n\n function removeRule() {\n var row = $(this).parents('tr');\n\n // delete andor row\n row.prev().remove();\n\n // delete rule row\n row.remove();\n }\n\n function setContextualHelpers() {\n var context = this.tagName.toLowerCase() === \"tr\" ? this : $(this).parents('tr').get(0);\n var condition = context.querySelector('.boxzilla-rule-condition').value;\n var valueInput = context.querySelector('.boxzilla-rule-value');\n var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n var betterInput = valueInput.cloneNode(true);\n var $betterInput = $(betterInput);\n\n // remove previously added helpers\n $(context.querySelectorAll('.boxzilla-helper')).remove();\n\n // prepare better input\n betterInput.removeAttribute('name');\n betterInput.className = betterInput.className + ' boxzilla-helper';\n valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n $betterInput.change(function () {\n valueInput.value = this.value;\n });\n\n betterInput.style.display = '';\n valueInput.style.display = 'none';\n qualifierInput.style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = 'none';\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = 'none';\n if (tnLoggedIn.parentNode) {\n tnLoggedIn.parentNode.removeChild(tnLoggedIn);\n }\n\n // change placeholder for textual help\n switch (condition) {\n default:\n betterInput.placeholder = i18n.enterCommaSeparatedValues;\n break;\n\n case '':\n case 'everywhere':\n qualifierInput.value = '1';\n valueInput.value = '';\n betterInput.style.display = 'none';\n qualifierInput.style.display = 'none';\n break;\n\n case 'is_single':\n case 'is_post':\n betterInput.placeholder = i18n.enterCommaSeparatedPosts;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_page':\n betterInput.placeholder = i18n.enterCommaSeparatedPages;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_type':\n betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_url':\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = '';\n betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n break;\n\n case 'is_post_in_category':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_with_tag':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_user_logged_in':\n betterInput.style.display = 'none';\n valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);\n break;\n\n case 'is_referer':\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = '';\n break;\n\n }\n }\n\n function addRuleFields() {\n var data = {\n 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length,\n 'andor': ruleComparisonEl.value === 'any' ? i18n.or : i18n.and\n };\n var html = rowTemplate(data);\n $(rulesContainerEl).append(html);\n return false;\n }\n\n module.exports = {\n 'Designer': Designer,\n 'Option': Option,\n 'events': events\n };\n})();\n\n},{\"./_designer.js\":3,\"./_option.js\":4,\"wolfy87-eventemitter\":5}],3:[function(require,module,exports){\n'use strict';\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar Designer = function Designer($, Option, events) {\n\n\t// vars\n\tvar boxId = document.getElementById('post_ID').value || 0,\n\t $editor,\n\t $editorFrame,\n\t $innerEditor,\n\t options = {},\n\t visualEditorInitialised = false;\n\n\tvar $appearanceControls = $(\"#boxzilla-box-appearance-controls\");\n\n\t// create Option objects\n\toptions.borderColor = new Option('border-color');\n\toptions.borderWidth = new Option('border-width');\n\toptions.borderStyle = new Option('border-style');\n\toptions.backgroundColor = new Option('background-color');\n\toptions.width = new Option('width');\n\toptions.color = new Option('color');\n\n\t// functions\n\tfunction init() {\n\n\t\t// Only run if TinyMCE has actually inited\n\t\tif (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// add classes to TinyMCE <html>\n\t\t$editorFrame = $(\"#content_ifr\");\n\t\t$editor = $editorFrame.contents().find('html');\n\t\t$editor.css({\n\t\t\t'background': 'white'\n\t\t});\n\n\t\t// add content class and padding to TinyMCE <body>\n\t\t$innerEditor = $editor.find('#tinymce');\n\t\t$innerEditor.addClass('boxzilla boxzilla-' + boxId);\n\t\t$innerEditor.css({\n\t\t\t'margin': 0,\n\t\t\t'background': 'white',\n\t\t\t'display': 'inline-block',\n\t\t\t'width': 'auto',\n\t\t\t'min-width': '240px',\n\t\t\t'position': 'relative'\n\t\t});\n\t\t$innerEditor.get(0).style.cssText += ';padding: 25px !important;';\n\n\t\tvisualEditorInitialised = true;\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.init');\n\t}\n\n\t/**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n\tfunction applyStyles() {\n\n\t\tif (!visualEditorInitialised) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// apply styles from CSS editor\n\t\t$innerEditor.css({\n\t\t\t'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),\n\t\t\t'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),\n\t\t\t'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),\n\t\t\t'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),\n\t\t\t'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),\n\t\t\t'color': options.color.getColorValue() // getColorValue( 'color', '' )\n\t\t});\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.apply');\n\n\t\treturn true;\n\t}\n\n\tfunction resetStyles() {\n\t\tfor (var key in options) {\n\t\t\tif (key.substring(0, 5) === 'theme') {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toptions[key].clear();\n\t\t}\n\t\tapplyStyles();\n\n\t\t/* @since 2.0.3 */\n\t\tevents.trigger('editor.styles.reset');\n\t}\n\n\t// event binders\n\t$appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });\n\t$appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n\tevents.on('editor.init', applyStyles);\n\n\t// public methods\n\treturn {\n\t\t'init': init,\n\t\t'resetStyles': resetStyles,\n\t\t'options': options\n\t};\n};\n\nmodule.exports = Designer;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\n\nvar Option = function Option(element) {\n\n\t// find corresponding element\n\tif (typeof element == \"string\") {\n\t\telement = document.getElementById('boxzilla-' + element);\n\t}\n\n\tif (!element) {\n\t\tconsole.error(\"Unable to find option element.\");\n\t}\n\n\tthis.element = element;\n};\n\nOption.prototype.getColorValue = function () {\n\tif (this.element.value.length > 0) {\n\t\tif ($(this.element).hasClass('wp-color-field')) {\n\t\t\treturn $(this.element).wpColorPicker('color');\n\t\t} else {\n\t\t\treturn this.element.value;\n\t\t}\n\t}\n\n\treturn '';\n};\n\nOption.prototype.getPxValue = function (fallbackValue) {\n\tif (this.element.value.length > 0) {\n\t\treturn parseInt(this.element.value) + \"px\";\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.getValue = function (fallbackValue) {\n\n\tif (this.element.value.length > 0) {\n\t\treturn this.element.value;\n\t}\n\n\treturn fallbackValue || '';\n};\n\nOption.prototype.clear = function () {\n\tthis.element.value = '';\n};\n\nOption.prototype.setValue = function (value) {\n\tthis.element.value = value;\n};\n\nmodule.exports = Option;\n\n},{}],5:[function(require,module,exports){\n/*!\n * EventEmitter v5.2.4 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function (exports) {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n function isValidListener (listener) {\n if (typeof listener === 'function' || listener instanceof RegExp) {\n return true\n } else if (listener && typeof listener === 'object') {\n return isValidListener(listener.listener)\n } else {\n return false\n }\n }\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n if (!isValidListener(listener)) {\n throw new TypeError('listener must be a function');\n }\n\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n\n for (i = 0; i < listeners.length; i++) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}(this || {}));\n\n},{}]},{},[1]);\n; })();"]}
|
1 |
+
{"version":3,"sources":["admin-script.js"],"names":["define","undefined","r","e","n","t","o","i","f","c","u","a","Error","code","p","exports","call","length","1","require","module","window","Boxzilla_Admin","./admin/_admin.js","2","$","jQuery","Option","optionControls","document","getElementById","$optionControls","tnLoggedIn","createTextNode","events","Designer","rowTemplate","wp","template","i18n","boxzilla_i18n","ruleComparisonEl","rulesContainerEl","on","data","key","querySelectorAll","andor","value","or","and","html","append","row","this","parents","prev","remove","setContextualHelpers","find","toggle","change","newText","text","load","tinyMCE","style","display","each","context","tagName","toLowerCase","get","condition","querySelector","valueInput","qualifierInput","betterInput","cloneNode","$betterInput","removeAttribute","className","parentNode","insertBefore","nextSibling","removeChild","placeholder","enterCommaSeparatedValues","enterCommaSeparatedPosts","suggest","ajaxurl","multiple","multipleSep","enterCommaSeparatedPages","enterCommaSeparatedPostTypes","enterCommaSeparatedRelativeUrls","./_designer.js","./_option.js","wolfy87-eventemitter","3","_typeof","obj","Symbol","iterator","constructor","prototype","$editor","$editorFrame","$innerEditor","boxId","options","visualEditorInitialised","$appearanceControls","applyStyles","setTimeout","css","border-color","borderColor","getColorValue","border-width","borderWidth","getPxValue","border-style","borderStyle","getValue","background-color","backgroundColor","width","color","trigger","wpColorPicker","clear","not","init","contents","background","addClass","margin","min-width","position","cssText","resetStyles","substring","4","element","console","error","hasClass","fallbackValue","parseInt","setValue","5","EventEmitter","proto","originalGlobalValue","indexOfListener","listeners","listener","alias","name","apply","arguments","getListeners","evt","response","_getEvents","RegExp","hasOwnProperty","test","flattenListeners","flatListeners","push","getListenersAsObject","Array","addListener","isValidListener","TypeError","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","index","splice","off","addListeners","manipulateListeners","removeListeners","single","removeEvent","type","_events","removeAllListeners","emitEvent","args","listenersMap","slice","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict","amd"],"mappings":"CAAA,WAAe,IAA8EA,OAASC,GAAuB,SAASC,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,GAAE,EAAoC,IAAID,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EAAEG,GAAG,CAACQ,QAAQ,IAAIZ,EAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAoB,OAAOI,EAAlBH,EAAEI,GAAG,GAAGL,IAAeA,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAE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yI,EAGjBzI,EAAQyI,aAAeA,EA5d9B,CA8dmB,oBAAXnI,OAAyBA,OAASiC,MAAQ,KAEjD,KAAK,GAAG,CAAC,IAz0BX","file":"admin-script.min.js","sourcesContent":["(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n\"use strict\";\n\nwindow.Boxzilla_Admin = require('./admin/_admin.js');\n\n},{\"./admin/_admin.js\":2}],2:[function(require,module,exports){\n\"use strict\";\n\n(function () {\n 'use strict';\n\n var $ = window.jQuery;\n\n var Option = require('./_option.js');\n\n var optionControls = document.getElementById('boxzilla-box-options-controls');\n var $optionControls = $(optionControls);\n var tnLoggedIn = document.createTextNode(' logged in'); // sanity check, are we on the correct page?\n\n if ($optionControls.length === 0) {\n return;\n }\n\n var EventEmitter = require('wolfy87-eventemitter');\n\n var events = new EventEmitter();\n\n var Designer = require('./_designer.js')($, Option, events);\n\n var rowTemplate = wp.template('rule-row-template');\n var i18n = boxzilla_i18n;\n var ruleComparisonEl = document.getElementById('boxzilla-rule-comparison');\n var rulesContainerEl = document.getElementById('boxzilla-box-rules'); // events\n\n $optionControls.on('click', \".boxzilla-add-rule\", addRuleFields);\n $optionControls.on('click', \".boxzilla-remove-rule\", removeRule);\n $optionControls.on('change', \".boxzilla-rule-condition\", setContextualHelpers);\n $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);\n $(ruleComparisonEl).change(toggleAndOrTexts);\n $(window).load(function () {\n if (typeof window.tinyMCE === \"undefined\") {\n document.getElementById('notice-notinymce').style.display = '';\n }\n }); // call contextual helper method for each row\n\n $('.boxzilla-rule-row').each(setContextualHelpers);\n\n function toggleAndOrTexts() {\n var newText = ruleComparisonEl.value === 'any' ? i18n.or : i18n.and;\n $('.boxzilla-andor').text(newText);\n }\n\n function toggleTriggerOptions() {\n $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');\n }\n\n function removeRule() {\n var row = $(this).parents('tr'); // delete andor row\n\n row.prev().remove(); // delete rule row\n\n row.remove();\n }\n\n function setContextualHelpers() {\n var context = this.tagName.toLowerCase() === \"tr\" ? this : $(this).parents('tr').get(0);\n var condition = context.querySelector('.boxzilla-rule-condition').value;\n var valueInput = context.querySelector('.boxzilla-rule-value');\n var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');\n var betterInput = valueInput.cloneNode(true);\n var $betterInput = $(betterInput); // remove previously added helpers\n\n $(context.querySelectorAll('.boxzilla-helper')).remove(); // prepare better input\n\n betterInput.removeAttribute('name');\n betterInput.className = betterInput.className + ' boxzilla-helper';\n valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);\n $betterInput.change(function () {\n valueInput.value = this.value;\n });\n betterInput.style.display = '';\n valueInput.style.display = 'none';\n qualifierInput.style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = 'none';\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = 'none';\n\n if (tnLoggedIn.parentNode) {\n tnLoggedIn.parentNode.removeChild(tnLoggedIn);\n } // change placeholder for textual help\n\n\n switch (condition) {\n default:\n betterInput.placeholder = i18n.enterCommaSeparatedValues;\n break;\n\n case '':\n case 'everywhere':\n qualifierInput.value = '1';\n valueInput.value = '';\n betterInput.style.display = 'none';\n qualifierInput.style.display = 'none';\n break;\n\n case 'is_single':\n case 'is_post':\n betterInput.placeholder = i18n.enterCommaSeparatedPosts;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_page':\n betterInput.placeholder = i18n.enterCommaSeparatedPages;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=page\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_type':\n betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_type\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_url':\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = '';\n betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;\n break;\n\n case 'is_post_in_category':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=category\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_post_with_tag':\n $betterInput.suggest(ajaxurl + \"?action=boxzilla_autocomplete&type=post_tag\", {\n multiple: true,\n multipleSep: \",\"\n });\n break;\n\n case 'is_user_logged_in':\n betterInput.style.display = 'none';\n valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);\n break;\n\n case 'is_referer':\n qualifierInput.querySelector('option[value=\"contains\"]').style.display = '';\n qualifierInput.querySelector('option[value=\"not_contains\"]').style.display = '';\n break;\n }\n }\n\n function addRuleFields() {\n var data = {\n 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length,\n 'andor': ruleComparisonEl.value === 'any' ? i18n.or : i18n.and\n };\n var html = rowTemplate(data);\n $(rulesContainerEl).append(html);\n return false;\n }\n\n module.exports = {\n 'Designer': Designer,\n 'Option': Option,\n 'events': events\n };\n})();\n\n},{\"./_designer.js\":3,\"./_option.js\":4,\"wolfy87-eventemitter\":5}],3:[function(require,module,exports){\n\"use strict\";\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar Designer = function Designer($, Option, events) {\n // vars\n var boxId = document.getElementById('post_ID').value || 0,\n $editor,\n $editorFrame,\n $innerEditor,\n options = {},\n visualEditorInitialised = false;\n var $appearanceControls = $(\"#boxzilla-box-appearance-controls\"); // create Option objects\n\n options.borderColor = new Option('border-color');\n options.borderWidth = new Option('border-width');\n options.borderStyle = new Option('border-style');\n options.backgroundColor = new Option('background-color');\n options.width = new Option('width');\n options.color = new Option('color'); // functions\n\n function init() {\n // Only run if TinyMCE has actually inited\n if (_typeof(window.tinyMCE) !== \"object\" || tinyMCE.get('content') === null) {\n return;\n } // add classes to TinyMCE <html>\n\n\n $editorFrame = $(\"#content_ifr\");\n $editor = $editorFrame.contents().find('html');\n $editor.css({\n 'background': 'white'\n }); // add content class and padding to TinyMCE <body>\n\n $innerEditor = $editor.find('#tinymce');\n $innerEditor.addClass('boxzilla boxzilla-' + boxId);\n $innerEditor.css({\n 'margin': 0,\n 'background': 'white',\n 'display': 'inline-block',\n 'width': 'auto',\n 'min-width': '240px',\n 'position': 'relative'\n });\n $innerEditor.get(0).style.cssText += ';padding: 25px !important;';\n visualEditorInitialised = true;\n /* @since 2.0.3 */\n\n events.trigger('editor.init');\n }\n /**\n * Applies the styles from the options to the TinyMCE Editor\n *\n * @return bool\n */\n\n\n function applyStyles() {\n if (!visualEditorInitialised) {\n return false;\n } // Apply styles from CSS editor. \n // Use short timeout to make sure color values are updated.\n\n\n window.setTimeout(function () {\n $innerEditor.css({\n 'border-color': options.borderColor.getColorValue(),\n //getColorValue( 'borderColor', '' ),\n 'border-width': options.borderWidth.getPxValue(),\n //getPxValue( 'borderWidth', '' ),\n 'border-style': options.borderStyle.getValue(),\n //getValue('borderStyle', '' ),\n 'background-color': options.backgroundColor.getColorValue(),\n //getColorValue( 'backgroundColor', ''),\n 'width': options.width.getPxValue(),\n //getPxValue( 'width', 'auto' ),\n 'color': options.color.getColorValue() // getColorValue( 'color', '' )\n\n });\n /* @since 2.0.3 */\n\n events.trigger('editor.styles.apply');\n }, 10);\n return true;\n }\n\n function resetStyles() {\n for (var key in options) {\n if (key.substring(0, 5) === 'theme') {\n continue;\n }\n\n options[key].clear();\n }\n\n applyStyles();\n /* @since 2.0.3 */\n\n events.trigger('editor.styles.reset');\n } // event binders\n\n\n $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({\n change: applyStyles,\n clear: applyStyles\n });\n $appearanceControls.find(\":input\").not(\".boxzilla-color-field\").change(applyStyles);\n events.on('editor.init', applyStyles); // public methods\n\n return {\n 'init': init,\n 'resetStyles': resetStyles,\n 'options': options\n };\n};\n\nmodule.exports = Designer;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar $ = window.jQuery;\n\nvar Option = function Option(element) {\n // find corresponding element\n if (typeof element == \"string\") {\n element = document.getElementById('boxzilla-' + element);\n }\n\n if (!element) {\n console.error(\"Unable to find option element.\");\n }\n\n this.element = element;\n};\n\nOption.prototype.getColorValue = function () {\n if (this.element.value.length > 0) {\n if ($(this.element).hasClass('wp-color-field')) {\n return $(this.element).wpColorPicker('color');\n } else {\n return this.element.value;\n }\n }\n\n return '';\n};\n\nOption.prototype.getPxValue = function (fallbackValue) {\n if (this.element.value.length > 0) {\n return parseInt(this.element.value) + \"px\";\n }\n\n return fallbackValue || '';\n};\n\nOption.prototype.getValue = function (fallbackValue) {\n if (this.element.value.length > 0) {\n return this.element.value;\n }\n\n return fallbackValue || '';\n};\n\nOption.prototype.clear = function () {\n this.element.value = '';\n};\n\nOption.prototype.setValue = function (value) {\n this.element.value = value;\n};\n\nmodule.exports = Option;\n\n},{}],5:[function(require,module,exports){\n/*!\n * EventEmitter v5.2.5 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function (exports) {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n function isValidListener (listener) {\n if (typeof listener === 'function' || listener instanceof RegExp) {\n return true\n } else if (listener && typeof listener === 'object') {\n return isValidListener(listener.listener)\n } else {\n return false\n }\n }\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n if (!isValidListener(listener)) {\n throw new TypeError('listener must be a function');\n }\n\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n\n for (i = 0; i < listeners.length; i++) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}(typeof window !== 'undefined' ? window : this || {}));\n\n},{}]},{},[1]);\n; })();"]}
|
assets/js/script.js
CHANGED
@@ -1,147 +1,140 @@
|
|
1 |
-
(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){function e
|
2 |
-
|
3 |
|
4 |
-
|
5 |
|
6 |
(function () {
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
var options = window.boxzilla_options;
|
11 |
|
12 |
-
|
13 |
-
window.Boxzilla = Boxzilla;
|
14 |
|
15 |
-
|
16 |
-
function css(element, styles) {
|
17 |
-
if (styles.background_color) {
|
18 |
-
element.style.background = styles.background_color;
|
19 |
-
}
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
}
|
40 |
}
|
41 |
|
42 |
-
|
|
|
|
|
|
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
48 |
|
49 |
-
// create boxes from options
|
50 |
-
for (var key in options.boxes) {
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
55 |
|
56 |
-
|
57 |
-
var boxContentElement = document.getElementById('boxzilla-box-' + boxOpts.id + '-content');
|
58 |
-
if (!boxContentElement) {
|
59 |
-
continue;
|
60 |
-
}
|
61 |
|
62 |
-
|
63 |
-
|
|
|
64 |
|
65 |
-
// create box
|
66 |
-
var box = Boxzilla.create(boxOpts.id, boxOpts);
|
67 |
|
68 |
-
|
69 |
-
box.element.className = box.element.className + ' boxzilla-' + boxOpts.post.slug;
|
70 |
|
71 |
-
|
72 |
-
css(box.element, boxOpts.css);
|
73 |
|
74 |
-
|
75 |
-
box.element.firstChild.lastChild.className += " last-child";
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
}
|
81 |
-
}
|
82 |
|
83 |
-
|
84 |
-
|
|
|
|
|
85 |
|
86 |
-
// trigger "done" event.
|
87 |
-
Boxzilla.trigger('done');
|
88 |
|
89 |
-
|
90 |
-
maybeOpenMailChimpForWordPressBox();
|
91 |
-
}
|
92 |
|
93 |
-
|
94 |
-
if (!window.location.hash || 0 === window.location.hash.length) {
|
95 |
-
return false;
|
96 |
-
}
|
97 |
|
98 |
-
|
|
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
}
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
return true;
|
110 |
-
}
|
111 |
|
112 |
-
|
|
|
113 |
}
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
var box = boxes[boxId];
|
127 |
-
if (box.element.querySelector(selector)) {
|
128 |
-
box.show();
|
129 |
-
return;
|
130 |
-
}
|
131 |
-
}
|
132 |
}
|
133 |
|
134 |
-
|
135 |
-
var
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
|
|
139 |
|
140 |
-
// init boxzilla
|
141 |
-
Boxzilla.init();
|
142 |
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
})();
|
146 |
|
147 |
},{"boxzilla":5}],2:[function(require,module,exports){
|
@@ -621,170 +614,177 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
|
|
621 |
}.call(this));
|
622 |
|
623 |
},{}],3:[function(require,module,exports){
|
624 |
-
|
625 |
|
626 |
var duration = 320;
|
627 |
|
628 |
function css(element, styles) {
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
}
|
633 |
|
634 |
function initObjectProperties(properties, value) {
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
|
|
|
|
640 |
}
|
641 |
|
642 |
function copyObjectProperties(properties, object) {
|
643 |
-
|
644 |
-
for (var i = 0; i < properties.length; i++) {
|
645 |
-
newObject[properties[i]] = object[properties[i]];
|
646 |
-
}
|
647 |
-
return newObject;
|
648 |
-
}
|
649 |
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
/**
|
651 |
* Checks if the given element is currently being animated.
|
652 |
*
|
653 |
* @param element
|
654 |
* @returns {boolean}
|
655 |
*/
|
|
|
|
|
656 |
function animated(element) {
|
657 |
-
|
658 |
}
|
659 |
-
|
660 |
/**
|
661 |
* Toggles the element using the given animation.
|
662 |
*
|
663 |
* @param element
|
664 |
* @param animation Either "fade" or "slide"
|
665 |
*/
|
|
|
|
|
666 |
function toggle(element, animation, callbackFn) {
|
667 |
-
|
668 |
-
|
669 |
-
// create clone for reference
|
670 |
-
var clone = element.cloneNode(true);
|
671 |
-
var cleanup = function cleanup() {
|
672 |
-
element.removeAttribute('data-animated');
|
673 |
-
element.setAttribute('style', clone.getAttribute('style'));
|
674 |
-
element.style.display = nowVisible ? 'none' : '';
|
675 |
-
if (callbackFn) {
|
676 |
-
callbackFn();
|
677 |
-
}
|
678 |
-
};
|
679 |
|
680 |
-
|
681 |
-
element.setAttribute('data-animated', "true");
|
682 |
|
683 |
-
|
684 |
-
|
685 |
-
|
|
|
|
|
|
|
|
|
686 |
}
|
|
|
687 |
|
688 |
-
var hiddenStyles, visibleStyles;
|
689 |
|
690 |
-
|
691 |
-
if (animation === 'slide') {
|
692 |
-
hiddenStyles = initObjectProperties(["height", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"], 0);
|
693 |
-
visibleStyles = {};
|
694 |
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
|
699 |
-
|
700 |
-
if (!isFinite(visibleStyles.height)) {
|
701 |
-
var clientRect = element.getBoundingClientRect();
|
702 |
-
visibleStyles.height = clientRect.height;
|
703 |
-
}
|
704 |
-
css(element, hiddenStyles);
|
705 |
-
}
|
706 |
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
css(element, hiddenStyles);
|
715 |
-
}
|
716 |
|
717 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
718 |
}
|
|
|
|
|
|
|
719 |
}
|
720 |
|
721 |
function animate(element, targetStyles, fn) {
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
// calculate step size & current value
|
732 |
-
var to = targetStyles[property];
|
733 |
-
var current = parseFloat(initialStyles[property]);
|
734 |
|
735 |
-
|
736 |
-
|
737 |
-
delete targetStyles[property];
|
738 |
-
continue;
|
739 |
-
}
|
740 |
|
741 |
-
|
742 |
-
|
|
|
743 |
}
|
744 |
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
var step, to, increment, newValue;
|
751 |
-
for (var property in targetStyles) {
|
752 |
-
step = propSteps[property];
|
753 |
-
to = targetStyles[property];
|
754 |
-
increment = step * timeSinceLastTick;
|
755 |
-
newValue = currentStyles[property] + increment;
|
756 |
-
|
757 |
-
if (step > 0 && newValue >= to || step < 0 && newValue <= to) {
|
758 |
-
newValue = to;
|
759 |
-
} else {
|
760 |
-
done = false;
|
761 |
-
}
|
762 |
|
763 |
-
|
764 |
-
|
|
|
|
|
|
|
765 |
|
766 |
-
|
767 |
-
|
768 |
-
|
|
|
|
|
769 |
|
770 |
-
|
|
|
|
|
|
|
|
|
771 |
|
772 |
-
// keep going until we're done for all props
|
773 |
-
if (!done) {
|
774 |
-
window.requestAnimationFrame && requestAnimationFrame(tick) || setTimeout(tick, 32);
|
775 |
-
} else {
|
776 |
-
// call callback
|
777 |
-
fn && fn();
|
778 |
-
}
|
779 |
-
};
|
780 |
|
781 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
782 |
}
|
783 |
|
784 |
module.exports = {
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
};
|
789 |
|
790 |
},{}],4:[function(require,module,exports){
|
@@ -804,7 +804,6 @@ var defaults = {
|
|
804 |
},
|
805 |
Boxzilla,
|
806 |
Animator = require('./animator.js');
|
807 |
-
|
808 |
/**
|
809 |
* Merge 2 objects, values of the latter overwriting the former.
|
810 |
*
|
@@ -812,41 +811,42 @@ var defaults = {
|
|
812 |
* @param obj2
|
813 |
* @returns {*}
|
814 |
*/
|
|
|
|
|
815 |
function merge(obj1, obj2) {
|
816 |
var obj3 = {};
|
|
|
817 |
for (var attrname in obj1) {
|
818 |
obj3[attrname] = obj1[attrname];
|
819 |
}
|
|
|
820 |
for (var attrname in obj2) {
|
821 |
obj3[attrname] = obj2[attrname];
|
822 |
}
|
|
|
823 |
return obj3;
|
824 |
}
|
825 |
-
|
826 |
/**
|
827 |
* Get the real height of entire document.
|
828 |
* @returns {number}
|
829 |
*/
|
|
|
|
|
830 |
function getDocumentHeight() {
|
831 |
var body = document.body,
|
832 |
html = document.documentElement;
|
833 |
-
|
834 |
var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
|
835 |
-
|
836 |
return height;
|
837 |
-
}
|
|
|
838 |
|
839 |
-
// Box Object
|
840 |
var Box = function Box(id, config) {
|
841 |
-
this.id = id;
|
842 |
|
843 |
-
// store
|
844 |
-
this.config = merge(defaults, config);
|
845 |
|
846 |
-
|
847 |
-
this.overlay = document.getElementById('boxzilla-overlay');
|
848 |
|
849 |
-
// state
|
850 |
this.visible = false;
|
851 |
this.dismissed = false;
|
852 |
this.triggered = false;
|
@@ -854,20 +854,17 @@ var Box = function Box(id, config) {
|
|
854 |
this.cookieSet = this.isCookieSet();
|
855 |
this.element = null;
|
856 |
this.contentElement = null;
|
857 |
-
this.closeIcon = null;
|
858 |
|
859 |
-
//
|
860 |
-
this.dom();
|
861 |
|
862 |
-
// further initialise the box
|
863 |
this.events();
|
864 |
-
};
|
|
|
865 |
|
866 |
-
// initialise the box
|
867 |
Box.prototype.events = function () {
|
868 |
-
var box = this;
|
869 |
|
870 |
-
// attach event to "close" icon inside box
|
871 |
if (this.closeIcon) {
|
872 |
this.closeIcon.addEventListener('click', this.dismiss.bind(this));
|
873 |
}
|
@@ -877,34 +874,32 @@ Box.prototype.events = function () {
|
|
877 |
Boxzilla.trigger('box.interactions.link', [box, e.target]);
|
878 |
}
|
879 |
}, false);
|
880 |
-
|
881 |
this.element.addEventListener('submit', function (e) {
|
882 |
box.setCookie();
|
883 |
Boxzilla.trigger('box.interactions.form', [box, e.target]);
|
884 |
}, false);
|
885 |
-
};
|
|
|
886 |
|
887 |
-
// generate dom elements for this box
|
888 |
Box.prototype.dom = function () {
|
889 |
var wrapper = document.createElement('div');
|
890 |
wrapper.className = 'boxzilla-container boxzilla-' + this.config.position + '-container';
|
891 |
-
|
892 |
var box = document.createElement('div');
|
893 |
box.setAttribute('id', 'boxzilla-' + this.id);
|
894 |
box.className = 'boxzilla boxzilla-' + this.id + ' boxzilla-' + this.config.position;
|
895 |
box.style.display = 'none';
|
896 |
wrapper.appendChild(box);
|
897 |
-
|
898 |
var content;
|
|
|
899 |
if (typeof this.config.content === "string") {
|
900 |
content = document.createElement('div');
|
901 |
content.innerHTML = this.config.content;
|
902 |
} else {
|
903 |
-
content = this.config.content;
|
904 |
|
905 |
-
// make sure element is visible
|
906 |
content.style.display = '';
|
907 |
}
|
|
|
908 |
content.className = 'boxzilla-content';
|
909 |
box.appendChild(content);
|
910 |
|
@@ -919,28 +914,25 @@ Box.prototype.dom = function () {
|
|
919 |
document.body.appendChild(wrapper);
|
920 |
this.contentElement = content;
|
921 |
this.element = box;
|
922 |
-
};
|
923 |
|
924 |
-
// set (calculate) custom box styling depending on box options
|
925 |
-
Box.prototype.setCustomBoxStyling = function () {
|
926 |
|
|
|
927 |
// reset element to its initial state
|
928 |
var origDisplay = this.element.style.display;
|
929 |
this.element.style.display = '';
|
930 |
this.element.style.overflowY = 'auto';
|
931 |
-
this.element.style.maxHeight = 'none';
|
932 |
|
933 |
-
// get new dimensions
|
934 |
var windowHeight = window.innerHeight;
|
935 |
-
var boxHeight = this.element.clientHeight;
|
936 |
|
937 |
-
// add scrollbar to box and limit height
|
938 |
if (boxHeight > windowHeight) {
|
939 |
this.element.style.maxHeight = windowHeight + "px";
|
940 |
this.element.style.overflowY = 'scroll';
|
941 |
-
}
|
|
|
942 |
|
943 |
-
// set new top margin for boxes which are centered
|
944 |
if (this.config.position === 'center') {
|
945 |
var newTopMargin = (windowHeight - boxHeight) / 2;
|
946 |
newTopMargin = newTopMargin >= 0 ? newTopMargin : 0;
|
@@ -948,41 +940,37 @@ Box.prototype.setCustomBoxStyling = function () {
|
|
948 |
}
|
949 |
|
950 |
this.element.style.display = origDisplay;
|
951 |
-
};
|
952 |
|
953 |
-
// toggle visibility of the box
|
954 |
-
Box.prototype.toggle = function (show) {
|
955 |
|
|
|
956 |
// revert visibility if no explicit argument is given
|
957 |
if (typeof show === "undefined") {
|
958 |
show = !this.visible;
|
959 |
-
}
|
|
|
960 |
|
961 |
-
// is box already at desired visibility?
|
962 |
if (show === this.visible) {
|
963 |
return false;
|
964 |
-
}
|
|
|
965 |
|
966 |
-
// is box being animated?
|
967 |
if (Animator.animated(this.element)) {
|
968 |
return false;
|
969 |
-
}
|
|
|
970 |
|
971 |
-
// if box should be hidden but is not closable, bail.
|
972 |
if (!show && !this.config.closable) {
|
973 |
return false;
|
974 |
-
}
|
975 |
|
976 |
-
// set new visibility status
|
977 |
-
this.visible = show;
|
978 |
|
979 |
-
// calculate new styling rules
|
980 |
-
this.setCustomBoxStyling();
|
981 |
|
982 |
-
// trigger event
|
983 |
-
|
|
|
984 |
|
985 |
-
// show or hide box using selected animation
|
986 |
if (this.config.position === 'center') {
|
987 |
this.overlay.classList.toggle('boxzilla-' + this.id + '-overlay');
|
988 |
Animator.toggle(this.overlay, "fade");
|
@@ -992,29 +980,30 @@ Box.prototype.toggle = function (show) {
|
|
992 |
if (this.visible) {
|
993 |
return;
|
994 |
}
|
|
|
995 |
this.contentElement.innerHTML = this.contentElement.innerHTML;
|
996 |
}.bind(this));
|
997 |
-
|
998 |
return true;
|
999 |
-
};
|
|
|
1000 |
|
1001 |
-
// show the box
|
1002 |
Box.prototype.show = function () {
|
1003 |
return this.toggle(true);
|
1004 |
-
};
|
|
|
1005 |
|
1006 |
-
// hide the box
|
1007 |
Box.prototype.hide = function () {
|
1008 |
return this.toggle(false);
|
1009 |
-
};
|
|
|
1010 |
|
1011 |
-
// calculate trigger height
|
1012 |
Box.prototype.calculateTriggerHeight = function () {
|
1013 |
var triggerHeight = 0;
|
1014 |
|
1015 |
if (this.config.trigger) {
|
1016 |
if (this.config.trigger.method === 'element') {
|
1017 |
var triggerElement = document.body.querySelector(this.config.trigger.value);
|
|
|
1018 |
if (triggerElement) {
|
1019 |
var offset = triggerElement.getBoundingClientRect();
|
1020 |
triggerHeight = offset.top;
|
@@ -1035,37 +1024,37 @@ Box.prototype.fits = function () {
|
|
1035 |
switch (this.config.screenWidthCondition.condition) {
|
1036 |
case "larger":
|
1037 |
return window.innerWidth > this.config.screenWidthCondition.value;
|
|
|
1038 |
case "smaller":
|
1039 |
return window.innerWidth < this.config.screenWidthCondition.value;
|
1040 |
-
}
|
|
|
1041 |
|
1042 |
-
// meh.. condition should be "smaller" or "larger", just return true.
|
1043 |
return true;
|
1044 |
};
|
1045 |
|
1046 |
Box.prototype.onResize = function () {
|
1047 |
this.triggerHeight = this.calculateTriggerHeight();
|
1048 |
this.setCustomBoxStyling();
|
1049 |
-
};
|
1050 |
|
1051 |
-
// is this box enabled?
|
1052 |
-
Box.prototype.mayAutoShow = function () {
|
1053 |
|
|
|
1054 |
if (this.dismissed) {
|
1055 |
return false;
|
1056 |
-
}
|
|
|
1057 |
|
1058 |
-
// check if box fits on given minimum screen width
|
1059 |
if (!this.fits()) {
|
1060 |
return false;
|
1061 |
-
}
|
|
|
1062 |
|
1063 |
-
// if trigger empty or error in calculating triggerHeight, return false
|
1064 |
if (!this.config.trigger) {
|
1065 |
return false;
|
1066 |
-
}
|
|
|
1067 |
|
1068 |
-
// rely on cookie value (show if not set, don't show if set)
|
1069 |
return !this.cookieSet;
|
1070 |
};
|
1071 |
|
@@ -1077,18 +1066,18 @@ Box.prototype.isCookieSet = function () {
|
|
1077 |
// always show on test mode or when no auto-trigger is configured
|
1078 |
if (this.config.testMode || !this.config.trigger) {
|
1079 |
return false;
|
1080 |
-
}
|
|
|
1081 |
|
1082 |
-
// if either cookie is null or trigger & dismiss are both falsey, don't bother checking.
|
1083 |
if (!this.config.cookie || !this.config.cookie.triggered && !this.config.cookie.dismissed) {
|
1084 |
return false;
|
1085 |
}
|
1086 |
|
1087 |
var cookieSet = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + 'boxzilla_box_' + this.id + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1") === "true";
|
1088 |
return cookieSet;
|
1089 |
-
};
|
|
|
1090 |
|
1091 |
-
// set cookie that disables automatically showing the box
|
1092 |
Box.prototype.setCookie = function (hours) {
|
1093 |
var expiryDate = new Date();
|
1094 |
expiryDate.setHours(expiryDate.getHours() + hours);
|
@@ -1097,35 +1086,36 @@ Box.prototype.setCookie = function (hours) {
|
|
1097 |
|
1098 |
Box.prototype.trigger = function () {
|
1099 |
var shown = this.show();
|
|
|
1100 |
if (!shown) {
|
1101 |
return;
|
1102 |
}
|
1103 |
|
1104 |
this.triggered = true;
|
|
|
1105 |
if (this.config.cookie && this.config.cookie.triggered) {
|
1106 |
this.setCookie(this.config.cookie.triggered);
|
1107 |
}
|
1108 |
};
|
1109 |
-
|
1110 |
/**
|
1111 |
* Dismisses the box and optionally sets a cookie.
|
1112 |
*
|
1113 |
* @param e The event that triggered this dismissal.
|
1114 |
* @returns {boolean}
|
1115 |
*/
|
|
|
|
|
1116 |
Box.prototype.dismiss = function (e) {
|
1117 |
// prevent default action
|
1118 |
-
e && e.preventDefault();
|
1119 |
|
1120 |
-
// only dismiss box if it's currently open.
|
1121 |
if (!this.visible) {
|
1122 |
return false;
|
1123 |
-
}
|
1124 |
|
1125 |
-
// hide box element
|
1126 |
-
this.hide();
|
1127 |
|
1128 |
-
// set cookie
|
|
|
1129 |
if (this.config.cookie && this.config.cookie.dismissed) {
|
1130 |
this.setCookie(this.config.cookie.dismissed);
|
1131 |
}
|
@@ -1157,256 +1147,247 @@ var EventEmitter = require('wolfy87-eventemitter'),
|
|
1157 |
pageViews;
|
1158 |
|
1159 |
function throttle(fn, threshhold, scope) {
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
}
|
|
|
1180 |
|
1181 |
-
// "keyup" listener
|
1182 |
function onKeyUp(e) {
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
}
|
|
|
1187 |
|
1188 |
-
// check "pageviews" criteria for each box
|
1189 |
function checkPageViewsCriteria() {
|
|
|
|
|
|
|
|
|
1190 |
|
1191 |
-
|
1192 |
-
if (
|
1193 |
-
|
1194 |
}
|
1195 |
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
|
|
1200 |
|
1201 |
-
if (box.config.trigger.method === 'pageviews' && pageViews >= box.config.trigger.value) {
|
1202 |
-
box.trigger();
|
1203 |
-
}
|
1204 |
-
});
|
1205 |
-
}
|
1206 |
|
1207 |
-
// check time trigger criteria for each box
|
1208 |
function checkTimeCriteria() {
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
|
1219 |
-
// check "time on site" trigger
|
1220 |
-
if (box.config.trigger.method === 'time_on_site' && siteTimer.time >= box.config.trigger.value) {
|
1221 |
-
box.trigger();
|
1222 |
-
}
|
1223 |
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
|
|
|
|
|
|
|
|
|
|
1230 |
|
1231 |
-
// check triggerHeight criteria for all boxes
|
1232 |
function checkHeightCriteria() {
|
|
|
|
|
|
|
|
|
|
|
|
|
1233 |
|
1234 |
-
|
1235 |
-
|
|
|
|
|
|
|
1236 |
|
1237 |
-
boxes.forEach(function (box) {
|
1238 |
-
if (!box.mayAutoShow() || box.triggerHeight <= 0) {
|
1239 |
-
return;
|
1240 |
-
}
|
1241 |
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
|
|
|
|
|
|
|
|
1247 |
|
1248 |
-
// trigger box
|
1249 |
-
box.trigger();
|
1250 |
-
} else if (box.mayRehide()) {
|
1251 |
-
box.hide();
|
1252 |
-
}
|
1253 |
-
});
|
1254 |
-
}
|
1255 |
|
1256 |
-
// recalculate heights and variables based on height
|
1257 |
function recalculateHeights() {
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
}
|
1262 |
|
1263 |
function onOverlayClick(e) {
|
1264 |
-
|
1265 |
-
|
1266 |
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
var margin = 40;
|
1271 |
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
});
|
1277 |
}
|
1278 |
|
1279 |
function triggerExitIntent() {
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
boxes.forEach(function (box) {
|
1286 |
-
if (box.mayAutoShow() && box.config.trigger.method === 'exit_intent') {
|
1287 |
-
box.trigger();
|
1288 |
-
}
|
1289 |
-
});
|
1290 |
|
1291 |
-
|
|
|
|
|
|
|
|
|
|
|
1292 |
}
|
1293 |
|
1294 |
function onMouseLeave(e) {
|
1295 |
-
|
1296 |
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
}
|
1301 |
}
|
1302 |
|
1303 |
function isAnyBoxVisible() {
|
|
|
|
|
1304 |
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
if (box.visible) {
|
1309 |
-
return true;
|
1310 |
-
}
|
1311 |
}
|
|
|
1312 |
|
1313 |
-
|
1314 |
}
|
1315 |
|
1316 |
function onMouseEnter() {
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
}
|
1322 |
|
1323 |
function onElementClick(e) {
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
for (var i = 0; i <= depth; i++) {
|
1328 |
-
if (!el || el.tagName === 'A') {
|
1329 |
-
break;
|
1330 |
-
}
|
1331 |
|
1332 |
-
|
|
|
|
|
1333 |
}
|
1334 |
|
1335 |
-
|
1336 |
-
|
1337 |
-
}
|
1338 |
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
|
|
|
|
|
|
|
|
1343 |
}
|
1344 |
|
1345 |
var timers = {
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
}
|
|
|
1360 |
|
1361 |
-
// initialise & add event listeners
|
1362 |
Boxzilla.init = function () {
|
1363 |
-
|
1364 |
-
|
1365 |
-
try {
|
1366 |
-
pageViews = sessionStorage.getItem('boxzilla_pageviews') || 0;
|
1367 |
-
} catch (e) {
|
1368 |
-
pageViews = 0;
|
1369 |
-
}
|
1370 |
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
var styleElement = document.createElement('style');
|
1377 |
-
styleElement.setAttribute("type", "text/css");
|
1378 |
-
styleElement.innerHTML = styles;
|
1379 |
-
document.head.appendChild(styleElement);
|
1380 |
-
|
1381 |
-
// add overlay element to dom
|
1382 |
-
overlay = document.createElement('div');
|
1383 |
-
overlay.style.display = 'none';
|
1384 |
-
overlay.id = 'boxzilla-overlay';
|
1385 |
-
document.body.appendChild(overlay);
|
1386 |
-
|
1387 |
-
// event binds
|
1388 |
-
scrollElement.addEventListener('touchstart', throttle(checkHeightCriteria), true);
|
1389 |
-
scrollElement.addEventListener('scroll', throttle(checkHeightCriteria), true);
|
1390 |
-
window.addEventListener('resize', throttle(recalculateHeights));
|
1391 |
-
window.addEventListener('load', recalculateHeights);
|
1392 |
-
overlay.addEventListener('click', onOverlayClick);
|
1393 |
-
window.setInterval(checkTimeCriteria, 1000);
|
1394 |
-
window.setTimeout(checkPageViewsCriteria, 1000);
|
1395 |
-
document.documentElement.addEventListener('mouseleave', onMouseLeave);
|
1396 |
-
document.documentElement.addEventListener('mouseenter', onMouseEnter);
|
1397 |
-
document.addEventListener('keyup', onKeyUp);
|
1398 |
-
|
1399 |
-
timers.start();
|
1400 |
-
window.addEventListener('focus', timers.start);
|
1401 |
-
window.addEventListener('beforeunload', function () {
|
1402 |
-
timers.stop();
|
1403 |
-
sessionStorage.setItem('boxzilla_pageviews', ++pageViews);
|
1404 |
-
});
|
1405 |
-
window.addEventListener('blur', timers.stop);
|
1406 |
|
1407 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1408 |
};
|
1409 |
-
|
1410 |
/**
|
1411 |
* Create a new Box
|
1412 |
*
|
@@ -1415,82 +1396,83 @@ Boxzilla.init = function () {
|
|
1415 |
*
|
1416 |
* @returns Box
|
1417 |
*/
|
1418 |
-
Boxzilla.create = function (id, opts) {
|
1419 |
|
1420 |
-
// preserve backwards compat for minimumScreenWidth option
|
1421 |
-
if (typeof opts.minimumScreenWidth !== "undefined") {
|
1422 |
-
opts.screenWidthCondition = {
|
1423 |
-
condition: "larger",
|
1424 |
-
value: opts.minimumScreenWidth
|
1425 |
-
};
|
1426 |
-
}
|
1427 |
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1431 |
};
|
1432 |
|
1433 |
Boxzilla.get = function (id) {
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
}
|
|
|
|
|
|
|
|
|
1440 |
|
1441 |
-
throw new Error("No box exists with ID " + id);
|
1442 |
-
};
|
1443 |
|
1444 |
-
// dismiss a single box (or all by omitting id param)
|
1445 |
Boxzilla.dismiss = function (id) {
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
};
|
1455 |
|
1456 |
Boxzilla.hide = function (id) {
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
};
|
1465 |
|
1466 |
Boxzilla.show = function (id) {
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
};
|
1475 |
|
1476 |
Boxzilla.toggle = function (id) {
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
};
|
|
|
1485 |
|
1486 |
-
// expose
|
1487 |
-
Boxzilla.boxes = boxes;
|
1488 |
|
1489 |
-
// expose boxzilla object
|
1490 |
window.Boxzilla = Boxzilla;
|
1491 |
|
1492 |
if (typeof module !== 'undefined' && module.exports) {
|
1493 |
-
|
1494 |
}
|
1495 |
|
1496 |
},{"./box.js":4,"./styles.js":6,"./timer.js":7,"wolfy87-eventemitter":2}],6:[function(require,module,exports){
|
@@ -1503,25 +1485,25 @@ module.exports = styles;
|
|
1503 |
'use strict';
|
1504 |
|
1505 |
var Timer = function Timer(start) {
|
1506 |
-
|
1507 |
-
|
1508 |
};
|
1509 |
|
1510 |
Timer.prototype.tick = function () {
|
1511 |
-
|
1512 |
};
|
1513 |
|
1514 |
Timer.prototype.start = function () {
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
};
|
1519 |
|
1520 |
Timer.prototype.stop = function () {
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
};
|
1526 |
|
1527 |
module.exports = Timer;
|
1 |
+
(function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
2 |
+
"use strict";
|
3 |
|
4 |
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
5 |
|
6 |
(function () {
|
7 |
+
'use strict';
|
8 |
|
9 |
+
var Boxzilla = require('boxzilla');
|
|
|
10 |
|
11 |
+
var options = window.boxzilla_options; // expose Boxzilla object to window
|
|
|
12 |
|
13 |
+
window.Boxzilla = Boxzilla; // helper function for setting CSS styles
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
function css(element, styles) {
|
16 |
+
if (styles.background_color) {
|
17 |
+
element.style.background = styles.background_color;
|
18 |
+
}
|
19 |
|
20 |
+
if (styles.color) {
|
21 |
+
element.style.color = styles.color;
|
22 |
+
}
|
23 |
|
24 |
+
if (styles.border_color) {
|
25 |
+
element.style.borderColor = styles.border_color;
|
26 |
+
}
|
27 |
|
28 |
+
if (styles.border_width) {
|
29 |
+
element.style.borderWidth = parseInt(styles.border_width) + "px";
|
30 |
+
}
|
31 |
|
32 |
+
if (styles.border_style) {
|
33 |
+
element.style.borderStyle = styles.border_style;
|
|
|
34 |
}
|
35 |
|
36 |
+
if (styles.width) {
|
37 |
+
element.style.maxWidth = parseInt(styles.width) + "px";
|
38 |
+
}
|
39 |
+
}
|
40 |
|
41 |
+
function createBoxesFromConfig() {
|
42 |
+
// failsafe against including script twice.
|
43 |
+
if (options.inited) {
|
44 |
+
return;
|
45 |
+
} // create boxes from options
|
46 |
|
|
|
|
|
47 |
|
48 |
+
for (var key in options.boxes) {
|
49 |
+
// get opts
|
50 |
+
var boxOpts = options.boxes[key];
|
51 |
+
boxOpts.testMode = isLoggedIn && options.testMode; // find box content element, bail if not found
|
52 |
|
53 |
+
var boxContentElement = document.getElementById('boxzilla-box-' + boxOpts.id + '-content');
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
if (!boxContentElement) {
|
56 |
+
continue;
|
57 |
+
} // use element as content option
|
58 |
|
|
|
|
|
59 |
|
60 |
+
boxOpts.content = boxContentElement; // create box
|
|
|
61 |
|
62 |
+
var box = Boxzilla.create(boxOpts.id, boxOpts); // add box slug to box element as classname
|
|
|
63 |
|
64 |
+
box.element.className = box.element.className + ' boxzilla-' + boxOpts.post.slug; // add custom css to box
|
|
|
65 |
|
66 |
+
css(box.element, boxOpts.css);
|
67 |
+
box.element.firstChild.firstChild.className += " first-child";
|
68 |
+
box.element.firstChild.lastChild.className += " last-child"; // maybe show box right away
|
|
|
|
|
69 |
|
70 |
+
if (box.fits() && locationHashRefersBox(box)) {
|
71 |
+
box.show();
|
72 |
+
}
|
73 |
+
} // set flag to prevent initialising twice
|
74 |
|
|
|
|
|
75 |
|
76 |
+
options.inited = true; // trigger "done" event.
|
|
|
|
|