PluginProbe
Boxzilla – WordPress Popup Builder / 3.1.4
Boxzilla – WordPress Popup Builder v3.1.4
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
← All changes | assets/js/admin-script.js +124 -163 3.1.173.1.4 View file →
@@ -1,176 +1,138 @@
1 1 (function () { var require = undefined; var module = undefined; var exports = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2 -'use strict';
3 -
4 2 window.Boxzilla_Admin = require('./admin/_admin.js');
5 -
6 3 },{"./admin/_admin.js":2}],2:[function(require,module,exports){
7 4 'use strict';
8 5
9 -(function () {
10 - 'use strict';
6 +var $ = window.jQuery;
7 +var Option = require('./_option.js');
8 +var optionControls = document.getElementById('boxzilla-box-options-controls');
9 +var $optionControls = $(optionControls);
11 10
12 - var $ = window.jQuery;
13 - var Option = require('./_option.js');
14 - var optionControls = document.getElementById('boxzilla-box-options-controls');
15 - var $optionControls = $(optionControls);
16 - var tnLoggedIn = document.createTextNode(' logged in');
11 +// sanity check, are we on the correct page?
12 +if( $optionControls.length === 0 ) {
13 + return;
14 +}
17 15
18 - // sanity check, are we on the correct page?
19 - if ($optionControls.length === 0) {
20 - return;
21 - }
16 +var EventEmitter = require('wolfy87-eventemitter');
17 +var events = new EventEmitter();
18 +var Designer = require('./_designer.js')($, Option, events);
19 +var rowTemplate = wp.template('rule-row-template');
20 +var i18n = boxzilla_i18n;
22 21
23 - var EventEmitter = require('wolfy87-eventemitter');
24 - var events = new EventEmitter();
25 - var Designer = require('./_designer.js')($, Option, events);
26 - var rowTemplate = wp.template('rule-row-template');
27 - var i18n = boxzilla_i18n;
22 +// events
23 +$optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
24 +$optionControls.on('click', ".boxzilla-remove-rule", removeRule);
25 +$optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
26 +$optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions );
28 27
29 - // events
30 - $optionControls.on('click', ".boxzilla-add-rule", addRuleFields);
31 - $optionControls.on('click', ".boxzilla-remove-rule", removeRule);
32 - $optionControls.on('change', ".boxzilla-rule-condition", setContextualHelpers);
33 - $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);
28 +$(window).load(function() {
29 + if( typeof(window.tinyMCE) === "undefined" ) {
30 + document.getElementById('notice-notinymce').style.display = '';
31 + }
32 +});
34 33
35 - $(window).load(function () {
36 - if (typeof window.tinyMCE === "undefined") {
37 - document.getElementById('notice-notinymce').style.display = '';
38 - }
39 - });
34 +// call contextual helper method for each row
35 +$('.boxzilla-rule-row').each(setContextualHelpers);
40 36
41 - // call contextual helper method for each row
42 - $('.boxzilla-rule-row').each(setContextualHelpers);
37 +function toggleTriggerOptions() {
38 + $optionControls.find('.boxzilla-trigger-options').toggle( this.value !== '' );
39 +}
43 40
44 - function toggleTriggerOptions() {
45 - $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');
46 - }
41 +function removeRule() {
42 + $(this).parents('tr').remove();
43 +}
47 44
48 - function removeRule() {
49 - $(this).parents('tr').remove();
50 - }
45 +function setContextualHelpers() {
51 46
52 - function setContextualHelpers() {
53 - var context = this.tagName.toLowerCase() === "tr" ? this : $(this).parents('tr').get(0);
54 - var condition = context.querySelector('.boxzilla-rule-condition').value;
55 - var valueInput = context.querySelector('.boxzilla-rule-value');
56 - var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
57 - var betterInput = valueInput.cloneNode(true);
58 - var $betterInput = $(betterInput);
47 + var context = ( this.tagName.toLowerCase() === "tr" ) ? this : $(this).parents('tr').get(0);
48 + var condition = context.querySelector('.boxzilla-rule-condition').value;
49 + var valueInput = context.querySelector('.boxzilla-rule-value');
50 + var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
51 + var betterInput = valueInput.cloneNode(true);
52 + var $betterInput = $(betterInput);
59 53
60 - // remove previously added helpers
61 - $(context.querySelectorAll('.boxzilla-helper')).remove();
54 + // remove previously added helpers
55 + $(context.querySelectorAll('.boxzilla-helper')).remove();
62 56
63 - // prepare better input
64 - betterInput.removeAttribute('name');
65 - betterInput.className = betterInput.className + ' boxzilla-helper';
66 - valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
67 - $betterInput.change(function () {
68 - valueInput.value = this.value;
69 - });
57 + // prepare better input
58 + betterInput.removeAttribute('name');
59 + betterInput.className = betterInput.className + ' boxzilla-helper';
60 + valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
61 + $betterInput.change(function() { valueInput.value = this.value; });
70 62
71 - betterInput.style.display = '';
72 - valueInput.style.display = 'none';
73 - qualifierInput.style.display = '';
74 - if (tnLoggedIn.parentNode) {
75 - tnLoggedIn.parentNode.removeChild(tnLoggedIn);
76 - }
63 + betterInput.style.display = '';
64 + valueInput.style.display = 'none';
65 + qualifierInput.style.display = '';
77 66
78 - // change placeholder for textual help
79 - switch (condition) {
80 - default:
81 - betterInput.placeholder = i18n.enterCommaSeparatedValues;
82 - break;
67 + // change placeholder for textual help
68 + switch(condition) {
69 + default:
70 + betterInput.placeholder = i18n.enterCommaSeparatedValues;
71 + break;
83 72
84 - case '':
85 - case 'everywhere':
86 - qualifierInput.value = '1';
87 - valueInput.value = '';
88 - betterInput.style.display = 'none';
89 - qualifierInput.style.display = 'none';
90 - break;
73 + case '':
74 + case 'everywhere':
75 + qualifierInput.value = '1';
76 + valueInput.value = '';
77 + betterInput.style.display = 'none';
78 + qualifierInput.style.display = 'none';
79 + break;
91 80
92 - case 'is_single':
93 - case 'is_post':
94 - betterInput.placeholder = i18n.enterCommaSeparatedPosts;
95 - $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", {
96 - multiple: true,
97 - multipleSep: ","
98 - });
99 - break;
81 + case 'is_single':
82 + case 'is_post':
83 + betterInput.placeholder = i18n.enterCommaSeparatedPosts;
84 + $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post", {multiple:true, multipleSep: ","});
85 + break;
100 86
101 - case 'is_page':
102 - betterInput.placeholder = i18n.enterCommaSeparatedPages;
103 - $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {
104 - multiple: true,
105 - multipleSep: ","
106 - });
107 - break;
87 + case 'is_page':
88 + betterInput.placeholder = i18n.enterCommaSeparatedPages;
89 + $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {multiple:true, multipleSep: ","});
90 + break;
108 91
109 - case 'is_post_type':
110 - betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
111 - $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", {
112 - multiple: true,
113 - multipleSep: ","
114 - });
115 - break;
92 + case 'is_post_type':
93 + betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
94 + $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_type", {multiple:true, multipleSep: ","});
95 + break;
116 96
117 - case 'is_url':
118 - betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
119 - break;
97 + case 'is_url':
98 + betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
99 + break;
120 100
121 - case 'is_post_in_category':
122 - $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {
123 - multiple: true,
124 - multipleSep: ","
125 - });
126 - break;
101 + case 'is_post_in_category':
102 + $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {multiple:true, multipleSep: ","});
103 + break;
127 104
128 - case 'is_post_with_tag':
129 - $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {
130 - multiple: true,
131 - multipleSep: ","
132 - });
133 - break;
105 + case 'is_post_with_tag':
106 + $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {multiple:true, multipleSep: ","});
107 + break;
108 + }
109 +}
134 110
135 - case 'is_user_logged_in':
136 - betterInput.style.display = 'none';
137 - valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);
138 - break;
111 +function addRuleFields() {
112 + var data = {
113 + 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length
114 + };
115 + var html = rowTemplate(data);
116 + $(document.getElementById('boxzilla-box-rules')).after(html);
117 + return false;
118 +}
139 119
140 - }
141 - }
120 +module.exports = {
121 + 'Designer': Designer,
122 + 'Option': Option,
123 + 'events': events
124 +};
142 125
143 - function addRuleFields() {
144 - var data = {
145 - 'key': optionControls.querySelectorAll('.boxzilla-rule-row').length
146 - };
147 - var html = rowTemplate(data);
148 - $(document.getElementById('boxzilla-box-rules')).after(html);
149 - return false;
150 - }
151 -
152 - module.exports = {
153 - 'Designer': Designer,
154 - 'Option': Option,
155 - 'events': events
156 - };
157 -})();
158 -
159 126 },{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(require,module,exports){
160 -'use strict';
127 +var Designer = function($, Option, events) {
161 128
162 -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
163 -
164 -var Designer = function Designer($, Option, events) {
165 -
166 129 // vars
167 130 var boxId = document.getElementById('post_ID').value || 0,
168 - $editor,
169 - $editorFrame,
170 - $innerEditor,
171 - options = {},
172 - visualEditorInitialised = false;
131 + $editor, $editorFrame,
132 + $innerEditor,
133 + options = {},
134 + visualEditorInitialised = false;
173 135
174 136 var $appearanceControls = $("#boxzilla-box-appearance-controls");
175 137
176 138 // create Option objects
@@ -184,9 +146,9 @@
184 146 // functions
185 147 function init() {
186 148
187 149 // Only run if TinyMCE has actually inited
188 - if (_typeof(window.tinyMCE) !== "object" || tinyMCE.get('content') === null) {
150 + if( typeof( window.tinyMCE ) !== "object" || tinyMCE.get('content') === null ) {
189 151 return;
190 152 }
191 153
192 154 // add classes to TinyMCE <html>
@@ -215,15 +177,15 @@
215 177 events.trigger('editor.init');
216 178 }
217 179
218 180 /**
219 - * Applies the styles from the options to the TinyMCE Editor
220 - *
221 - * @return bool
222 - */
181 + * Applies the styles from the options to the TinyMCE Editor
182 + *
183 + * @return bool
184 + */
223 185 function applyStyles() {
224 186
225 - if (!visualEditorInitialised) {
187 + if( ! visualEditorInitialised ) {
226 188 return false;
227 189 }
228 190
229 191 // apply styles from CSS editor
@@ -242,10 +204,10 @@
242 204 return true;
243 205 }
244 206
245 207 function resetStyles() {
246 - for (var key in options) {
247 - if (key.substring(0, 5) === 'theme') {
208 + for( var key in options ) {
209 + if( key.substring(0,5) === 'theme' ) {
248 210 continue;
249 211 }
250 212
251 213 options[key].clear();
@@ -266,25 +228,25 @@
266 228 'init': init,
267 229 'resetStyles': resetStyles,
268 230 'options': options
269 231 };
232 +
270 233 };
271 234
272 235 module.exports = Designer;
273 -
274 236 },{}],4:[function(require,module,exports){
275 237 'use strict';
276 238
277 239 var $ = window.jQuery;
278 240
279 -var Option = function Option(element) {
241 +var Option = function( element ) {
280 242
281 243 // find corresponding element
282 - if (typeof element == "string") {
244 + if( typeof(element) == "string" ) {
283 245 element = document.getElementById('boxzilla-' + element);
284 246 }
285 247
286 - if (!element) {
248 + if( ! element ) {
287 249 console.error("Unable to find option element.");
288 250 }
289 251
290 252 this.element = element;
@@ -289,11 +251,11 @@
289 251
290 252 this.element = element;
291 253 };
292 254
293 -Option.prototype.getColorValue = function () {
294 - if (this.element.value.length > 0) {
295 - if ($(this.element).hasClass('wp-color-field')) {
255 +Option.prototype.getColorValue = function() {
256 + if( this.element.value.length > 0 ) {
257 + if( $(this.element).hasClass('wp-color-field')) {
296 258 return $(this.element).wpColorPicker('color');
297 259 } else {
298 260 return this.element.value;
299 261 }
@@ -301,19 +263,19 @@
301 263
302 264 return '';
303 265 };
304 266
305 -Option.prototype.getPxValue = function (fallbackValue) {
306 - if (this.element.value.length > 0) {
307 - return parseInt(this.element.value) + "px";
267 +Option.prototype.getPxValue = function( fallbackValue ) {
268 + if( this.element.value.length > 0 ) {
269 + return parseInt( this.element.value ) + "px";
308 270 }
309 271
310 272 return fallbackValue || '';
311 273 };
312 274
313 -Option.prototype.getValue = function (fallbackValue) {
275 +Option.prototype.getValue = function( fallbackValue ) {
314 276
315 - if (this.element.value.length > 0) {
277 + if( this.element.value.length > 0 ) {
316 278 return this.element.value;
317 279 }
318 280
319 281 return fallbackValue || '';
@@ -318,18 +280,17 @@
318 280
319 281 return fallbackValue || '';
320 282 };
321 283
322 -Option.prototype.clear = function () {
284 +Option.prototype.clear = function() {
323 285 this.element.value = '';
324 286 };
325 287
326 -Option.prototype.setValue = function (value) {
288 +Option.prototype.setValue = function(value) {
327 289 this.element.value = value;
328 290 };
329 291
330 292 module.exports = Option;
331 -
332 293 },{}],5:[function(require,module,exports){
333 294 /*!
334 295 * EventEmitter v4.2.11 - git.io/ee
335 296 * Unlicense - http://unlicense.org/