PluginProbe
Boxzilla – WordPress Popup Builder / 3.2.21
Boxzilla – WordPress Popup Builder v3.2.21
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 +279 -213 3.0.23.2.21 View file →
@@ -1,305 +1,359 @@
1 -(function () { var require = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
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 +
2 4 window.Boxzilla_Admin = require('./admin/_admin.js');
5 +
3 6 },{"./admin/_admin.js":2}],2:[function(require,module,exports){
4 -'use strict';
7 +"use strict";
5 8
6 9 var $ = window.jQuery;
10 +
7 11 var Option = require('./_option.js');
12 +
8 13 var optionControls = document.getElementById('boxzilla-box-options-controls');
9 14 var $optionControls = $(optionControls);
15 +var tnLoggedIn = document.createTextNode(' logged in');
10 16
11 -// sanity check, are we on the correct page?
12 -if( $optionControls.length === 0 ) {
13 - return;
14 -}
17 +var EventEmitter = require('wolfy87-eventemitter');
15 18
16 -var EventEmitter = require('wolfy87-eventemitter');
17 19 var events = new EventEmitter();
20 +
18 21 var Designer = require('./_designer.js')($, Option, events);
19 -var rowTemplate = wp.template('rule-row-template');
20 -var i18n = boxzilla_i18n;
21 22
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 );
23 +var rowTemplate = window.wp.template('rule-row-template');
24 +var i18n = window.boxzilla_i18n;
25 +var ruleComparisonEl = document.getElementById('boxzilla-rule-comparison');
26 +var rulesContainerEl = document.getElementById('boxzilla-box-rules');
27 +var ajaxurl = window.ajaxurl; // events
27 28
28 -$(window).load(function() {
29 - if( typeof(window.tinyMCE) === "undefined" ) {
30 - document.getElementById('notice-notinymce').style.display = '';
31 - }
29 +$(window).load(function () {
30 + if (typeof window.tinyMCE === 'undefined') {
31 + document.getElementById('notice-notinymce').style.display = '';
32 + }
33 +
34 + $optionControls.on('click', '.boxzilla-add-rule', addRuleFields);
35 + $optionControls.on('click', '.boxzilla-remove-rule', removeRule);
36 + $optionControls.on('change', '.boxzilla-rule-condition', setContextualHelpers);
37 + $optionControls.find('.boxzilla-auto-show-trigger').on('change', toggleTriggerOptions);
38 + $(ruleComparisonEl).change(toggleAndOrTexts);
39 + $('.boxzilla-rule-row').each(setContextualHelpers);
32 40 });
33 41
34 -// call contextual helper method for each row
35 -$('.boxzilla-rule-row').each(setContextualHelpers);
42 +function toggleAndOrTexts() {
43 + var newText = ruleComparisonEl.value === 'any' ? i18n.or : i18n.and;
44 + $('.boxzilla-andor').text(newText);
45 +}
36 46
37 47 function toggleTriggerOptions() {
38 - $optionControls.find('.boxzilla-trigger-options').toggle( this.value !== '' );
48 + $optionControls.find('.boxzilla-trigger-options').toggle(this.value !== '');
39 49 }
40 50
41 51 function removeRule() {
42 - $(this).parents('tr').remove();
52 + var row = $(this).parents('tr'); // delete andor row
53 +
54 + row.prev().remove(); // delete rule row
55 +
56 + row.remove();
43 57 }
44 58
45 59 function setContextualHelpers() {
60 + var context = this.tagName.toLowerCase() === 'tr' ? this : $(this).parents('tr').get(0);
61 + var condition = context.querySelector('.boxzilla-rule-condition').value;
62 + var valueInput = context.querySelector('.boxzilla-rule-value');
63 + var qualifierInput = context.querySelector('.boxzilla-rule-qualifier');
64 + var betterInput = valueInput.cloneNode(true);
65 + var $betterInput = $(betterInput); // remove previously added helpers
46 66
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);
67 + $(context.querySelectorAll('.boxzilla-helper')).remove(); // prepare better input
53 68
54 - // remove previously added helpers
55 - $(context.querySelectorAll('.boxzilla-helper')).remove();
69 + betterInput.removeAttribute('name');
70 + betterInput.className = betterInput.className + ' boxzilla-helper';
71 + valueInput.parentNode.insertBefore(betterInput, valueInput.nextSibling);
72 + $betterInput.change(function () {
73 + valueInput.value = this.value;
74 + });
75 + betterInput.style.display = '';
76 + valueInput.style.display = 'none';
77 + qualifierInput.style.display = '';
78 + qualifierInput.querySelector('option[value="not_contains"]').style.display = 'none';
79 + qualifierInput.querySelector('option[value="contains"]').style.display = 'none';
56 80
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; });
81 + if (tnLoggedIn.parentNode) {
82 + tnLoggedIn.parentNode.removeChild(tnLoggedIn);
83 + } // change placeholder for textual help
62 84
63 - betterInput.style.display = '';
64 - valueInput.style.display = 'none';
65 - qualifierInput.style.display = '';
66 85
67 - // change placeholder for textual help
68 - switch(condition) {
69 - default:
70 - betterInput.placeholder = i18n.enterCommaSeparatedValues;
71 - break;
86 + switch (condition) {
87 + default:
88 + betterInput.placeholder = i18n.enterCommaSeparatedValues;
89 + break;
72 90
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 + case '':
92 + case 'everywhere':
93 + qualifierInput.value = '1';
94 + valueInput.value = '';
95 + betterInput.style.display = 'none';
96 + qualifierInput.style.display = 'none';
97 + break;
80 98
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;
99 + case 'is_single':
100 + case 'is_post':
101 + betterInput.placeholder = i18n.enterCommaSeparatedPosts;
102 + $betterInput.suggest(ajaxurl + '?action=boxzilla_autocomplete&type=post', {
103 + multiple: true,
104 + multipleSep: ','
105 + });
106 + break;
86 107
87 - case 'is_page':
88 - betterInput.placeholder = i18n.enterCommaSeparatedPages;
89 - $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=page", {multiple:true, multipleSep: ","});
90 - break;
108 + case 'is_page':
109 + betterInput.placeholder = i18n.enterCommaSeparatedPages;
110 + $betterInput.suggest(ajaxurl + '?action=boxzilla_autocomplete&type=page', {
111 + multiple: true,
112 + multipleSep: ','
113 + });
114 + break;
91 115
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 + case 'is_post_type':
117 + betterInput.placeholder = i18n.enterCommaSeparatedPostTypes;
118 + $betterInput.suggest(ajaxurl + '?action=boxzilla_autocomplete&type=post_type', {
119 + multiple: true,
120 + multipleSep: ','
121 + });
122 + break;
96 123
97 - case 'is_url':
98 - betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
99 - break;
124 + case 'is_url':
125 + qualifierInput.querySelector('option[value="contains"]').style.display = '';
126 + qualifierInput.querySelector('option[value="not_contains"]').style.display = '';
127 + betterInput.placeholder = i18n.enterCommaSeparatedRelativeUrls;
128 + break;
100 129
101 - case 'is_post_in_category':
102 - $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=category", {multiple:true, multipleSep: ","});
103 - break;
130 + case 'is_post_in_category':
131 + $betterInput.suggest(ajaxurl + '?action=boxzilla_autocomplete&type=category', {
132 + multiple: true,
133 + multipleSep: ','
134 + });
135 + break;
104 136
105 - case 'is_post_with_tag':
106 - $betterInput.suggest(ajaxurl + "?action=boxzilla_autocomplete&type=post_tag", {multiple:true, multipleSep: ","});
107 - break;
108 - }
137 + case 'is_post_with_tag':
138 + $betterInput.suggest(ajaxurl + '?action=boxzilla_autocomplete&type=post_tag', {
139 + multiple: true,
140 + multipleSep: ','
141 + });
142 + break;
143 +
144 + case 'is_user_logged_in':
145 + betterInput.style.display = 'none';
146 + valueInput.parentNode.insertBefore(tnLoggedIn, valueInput.nextSibling);
147 + break;
148 +
149 + case 'is_referer':
150 + qualifierInput.querySelector('option[value="contains"]').style.display = '';
151 + qualifierInput.querySelector('option[value="not_contains"]').style.display = '';
152 + break;
153 + }
109 154 }
110 155
111 156 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;
157 + var data = {
158 + key: optionControls.querySelectorAll('.boxzilla-rule-row').length,
159 + andor: ruleComparisonEl.value === 'any' ? i18n.or : i18n.and
160 + };
161 + var html = rowTemplate(data);
162 + $(rulesContainerEl).append(html);
163 + return false;
118 164 }
119 165
120 166 module.exports = {
121 - 'Designer': Designer,
122 - 'Option': Option,
123 - 'events': events
167 + Designer: Designer,
168 + Option: Option,
169 + events: events
124 170 };
125 171
126 172 },{"./_designer.js":3,"./_option.js":4,"wolfy87-eventemitter":5}],3:[function(require,module,exports){
127 -var Designer = function($, Option, events) {
173 +"use strict";
128 174
129 - // vars
130 - var boxId = document.getElementById('post_ID').value || 0,
131 - $editor, $editorFrame,
132 - $innerEditor,
133 - options = {},
134 - visualEditorInitialised = false;
175 +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); }
135 176
136 - var $appearanceControls = $("#boxzilla-box-appearance-controls");
177 +var Designer = function Designer($, Option, events) {
178 + // vars
179 + var boxId = document.getElementById('post_ID').value || 0;
180 + var $editor;
181 + var $editorFrame;
182 + var $innerEditor;
183 + var options = {};
184 + var visualEditorInitialised = false;
185 + var $appearanceControls = $('#boxzilla-box-appearance-controls'); // functions
137 186
138 - // create Option objects
139 - options.borderColor = new Option('border-color');
140 - options.borderWidth = new Option('border-width');
141 - options.borderStyle = new Option('border-style');
142 - options.backgroundColor = new Option('background-color');
143 - options.width = new Option('width');
144 - options.color = new Option('color');
187 + function init() {
188 + // Only run if TinyMCE has actually inited
189 + if (_typeof(window.tinyMCE) !== 'object' || window.tinyMCE.get('content') === null) {
190 + return;
191 + } // create Option objects
145 192
146 - // functions
147 - function init() {
148 193
149 - // Only run if TinyMCE has actually inited
150 - if( typeof( window.tinyMCE ) !== "object" || tinyMCE.get('content') === null ) {
151 - return;
152 - }
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'); // add classes to TinyMCE <html>
153 200
154 - // add classes to TinyMCE <html>
155 - $editorFrame = $("#content_ifr");
156 - $editor = $editorFrame.contents().find('html');
157 - $editor.css({
158 - 'background': 'white'
159 - });
201 + $editorFrame = $('#content_ifr');
202 + $editor = $editorFrame.contents().find('html');
203 + $editor.css({
204 + background: 'white'
205 + }); // add content class and padding to TinyMCE <body>
160 206
161 - // add content class and padding to TinyMCE <body>
162 - $innerEditor = $editor.find('#tinymce');
163 - $innerEditor.addClass('boxzilla boxzilla-' + boxId);
164 - $innerEditor.css({
165 - 'margin': 0,
166 - 'background': 'white',
167 - 'display': 'inline-block',
168 - 'width': 'auto',
169 - 'min-width': '240px',
170 - 'position': 'relative'
171 - });
172 - $innerEditor.get(0).style.cssText += ';padding: 25px !important;';
207 + $innerEditor = $editor.find('#tinymce');
208 + $innerEditor.addClass('boxzilla boxzilla-' + boxId);
209 + $innerEditor.css({
210 + margin: 0,
211 + background: 'white',
212 + display: 'inline-block',
213 + width: 'auto',
214 + 'min-width': '240px',
215 + position: 'relative'
216 + });
217 + $innerEditor.get(0).style.cssText += ';padding: 25px !important;';
218 + visualEditorInitialised = true;
219 + /* @since 2.0.3 */
173 220
174 - visualEditorInitialised = true;
221 + events.trigger('editor.init');
222 + }
223 + /**
224 + * Applies the styles from the options to the TinyMCE Editor
225 + *
226 + * @return bool
227 + */
175 228
176 - /* @since 2.0.3 */
177 - events.trigger('editor.init');
178 - }
179 229
180 - /**
181 - * Applies the styles from the options to the TinyMCE Editor
182 - *
183 - * @return bool
184 - */
185 - function applyStyles() {
230 + function applyStyles() {
231 + if (!visualEditorInitialised) {
232 + return false;
233 + } // Apply styles from CSS editor.
234 + // Use short timeout to make sure color values are updated.
186 235
187 - if( ! visualEditorInitialised ) {
188 - return false;
189 - }
190 236
191 - // apply styles from CSS editor
192 - $innerEditor.css({
193 - 'border-color': options.borderColor.getColorValue(), //getColorValue( 'borderColor', '' ),
194 - 'border-width': options.borderWidth.getPxValue(), //getPxValue( 'borderWidth', '' ),
195 - 'border-style': options.borderStyle.getValue(), //getValue('borderStyle', '' ),
196 - 'background-color': options.backgroundColor.getColorValue(), //getColorValue( 'backgroundColor', ''),
197 - 'width': options.width.getPxValue(), //getPxValue( 'width', 'auto' ),
198 - 'color': options.color.getColorValue() // getColorValue( 'color', '' )
199 - });
237 + window.setTimeout(function () {
238 + $innerEditor.css({
239 + 'border-color': options.borderColor.getColorValue(),
240 + // getColorValue( 'borderColor', '' ),
241 + 'border-width': options.borderWidth.getPxValue(),
242 + // getPxValue( 'borderWidth', '' ),
243 + 'border-style': options.borderStyle.getValue(),
244 + // getValue('borderStyle', '' ),
245 + 'background-color': options.backgroundColor.getColorValue(),
246 + // getColorValue( 'backgroundColor', ''),
247 + width: options.width.getPxValue(),
248 + // getPxValue( 'width', 'auto' ),
249 + color: options.color.getColorValue() // getColorValue( 'color', '' )
200 250
201 - /* @since 2.0.3 */
202 - events.trigger('editor.styles.apply');
251 + });
252 + /* @since 2.0.3 */
203 253
204 - return true;
205 - }
254 + events.trigger('editor.styles.apply');
255 + }, 10);
256 + return true;
257 + }
206 258
207 - function resetStyles() {
208 - for( var key in options ) {
209 - if( key.substring(0,5) === 'theme' ) {
210 - continue;
211 - }
259 + function resetStyles() {
260 + for (var key in options) {
261 + if (key.substring(0, 5) === 'theme') {
262 + continue;
263 + }
212 264
213 - options[key].clear();
214 - }
215 - applyStyles();
265 + options[key].clear();
266 + }
216 267
217 - /* @since 2.0.3 */
218 - events.trigger('editor.styles.reset');
219 - }
268 + applyStyles();
269 + /* @since 2.0.3 */
220 270
221 - // event binders
222 - $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({ change: applyStyles, clear: applyStyles });
223 - $appearanceControls.find(":input").not(".boxzilla-color-field").change(applyStyles);
224 - events.on('editor.init', applyStyles);
271 + events.trigger('editor.styles.reset');
272 + } // event binders
225 273
226 - // public methods
227 - return {
228 - 'init': init,
229 - 'resetStyles': resetStyles,
230 - 'options': options
231 - };
232 274
275 + $appearanceControls.find('input.boxzilla-color-field').wpColorPicker({
276 + change: applyStyles,
277 + clear: applyStyles
278 + });
279 + $appearanceControls.find(':input').not('.boxzilla-color-field').change(applyStyles);
280 + events.on('editor.init', applyStyles); // public methods
281 +
282 + return {
283 + init: init,
284 + resetStyles: resetStyles,
285 + options: options
286 + };
233 287 };
234 288
235 289 module.exports = Designer;
290 +
236 291 },{}],4:[function(require,module,exports){
237 -'use strict';
292 +"use strict";
238 293
239 294 var $ = window.jQuery;
240 295
241 -var Option = function( element ) {
296 +var Option = function Option(element) {
297 + // find corresponding element
298 + if (typeof element === 'string') {
299 + element = document.getElementById('boxzilla-' + element);
300 + }
242 301
243 - // find corresponding element
244 - if( typeof(element) == "string" ) {
245 - element = document.getElementById('boxzilla-' + element);
246 - }
302 + if (!element) {
303 + console.error('Unable to find option element.');
304 + }
247 305
248 - if( ! element ) {
249 - console.error("Unable to find option element.");
250 - }
251 -
252 - this.element = element;
306 + this.element = element;
253 307 };
254 308
255 -Option.prototype.getColorValue = function() {
256 - if( this.element.value.length > 0 ) {
257 - if( $(this.element).hasClass('wp-color-field')) {
258 - return $(this.element).wpColorPicker('color');
259 - } else {
260 - return this.element.value;
261 - }
262 - }
309 +Option.prototype.getColorValue = function () {
310 + if (this.element.value.length > 0) {
311 + if ($(this.element).hasClass('wp-color-field')) {
312 + return $(this.element).wpColorPicker('color');
313 + } else {
314 + return this.element.value;
315 + }
316 + }
263 317
264 - return '';
318 + return '';
265 319 };
266 320
267 -Option.prototype.getPxValue = function( fallbackValue ) {
268 - if( this.element.value.length > 0 ) {
269 - return parseInt( this.element.value ) + "px";
270 - }
321 +Option.prototype.getPxValue = function (fallbackValue) {
322 + if (this.element.value.length > 0) {
323 + return parseInt(this.element.value) + 'px';
324 + }
271 325
272 - return fallbackValue || '';
326 + return fallbackValue || '';
273 327 };
274 328
275 -Option.prototype.getValue = function( fallbackValue ) {
329 +Option.prototype.getValue = function (fallbackValue) {
330 + if (this.element.value.length > 0) {
331 + return this.element.value;
332 + }
276 333
277 - if( this.element.value.length > 0 ) {
278 - return this.element.value;
279 - }
280 -
281 - return fallbackValue || '';
334 + return fallbackValue || '';
282 335 };
283 336
284 -Option.prototype.clear = function() {
285 - this.element.value = '';
337 +Option.prototype.clear = function () {
338 + this.element.value = '';
286 339 };
287 340
288 -Option.prototype.setValue = function(value) {
289 - this.element.value = value;
341 +Option.prototype.setValue = function (value) {
342 + this.element.value = value;
290 343 };
291 344
292 345 module.exports = Option;
346 +
293 347 },{}],5:[function(require,module,exports){
294 348 /*!
295 - * EventEmitter v4.2.11 - git.io/ee
349 + * EventEmitter v5.2.9 - git.io/ee
296 350 * Unlicense - http://unlicense.org/
297 - * Oliver Caldwell - http://oli.me.uk/
351 + * Oliver Caldwell - https://oli.me.uk/
298 352 * @preserve
299 353 */
300 354
301 -;(function () {
355 +;(function (exports) {
302 356 'use strict';
303 357
304 358 /**
305 359 * Class for managing events.
@@ -310,9 +364,8 @@
310 364 function EventEmitter() {}
311 365
312 366 // Shortcuts to improve speed and size
313 367 var proto = EventEmitter.prototype;
314 - var exports = this;
315 368 var originalGlobalValue = exports.EventEmitter;
316 369
317 370 /**
318 371 * Finds the index of the listener for the event in its storage array.
@@ -411,8 +464,18 @@
411 464
412 465 return response || listeners;
413 466 };
414 467
468 + function isValidListener (listener) {
469 + if (typeof listener === 'function' || listener instanceof RegExp) {
470 + return true
471 + } else if (listener && typeof listener === 'object') {
472 + return isValidListener(listener.listener)
473 + } else {
474 + return false
475 + }
476 + }
477 +
415 478 /**
416 479 * Adds a listener function to the specified event.
417 480 * The listener will not be added if it is a duplicate.
418 481 * If the listener returns true then it will be removed after it is called.
@@ -422,8 +485,12 @@
422 485 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
423 486 * @return {Object} Current instance of EventEmitter for chaining.
424 487 */
425 488 proto.addListener = function addListener(evt, listener) {
489 + if (!isValidListener(listener)) {
490 + throw new TypeError('listener must be a function');
491 + }
492 +
426 493 var listeners = this.getListenersAsObject(evt);
427 494 var listenerIsWrapped = typeof listener === 'object';
428 495 var key;
429 496
@@ -521,9 +588,9 @@
521 588 proto.off = alias('removeListener');
522 589
523 590 /**
524 591 * Adds listeners in bulk using the manipulateListeners method.
525 - * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
592 + * 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.
526 593 * You can also pass it a regular expression to add the array of listeners to all events that match it.
527 594 * Yeah, this function does quite a bit. That's probably a bad thing.
528 595 *
529 596 * @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.
@@ -536,9 +603,9 @@
536 603 };
537 604
538 605 /**
539 606 * Removes listeners in bulk using the manipulateListeners method.
540 - * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
607 + * 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.
541 608 * You can also pass it an event name and an array of listeners to be removed.
542 609 * You can also pass it a regular expression to remove the listeners from all events that match it.
543 610 *
544 611 * @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.
@@ -660,11 +727,10 @@
660 727
661 728 for (key in listenersMap) {
662 729 if (listenersMap.hasOwnProperty(key)) {
663 730 listeners = listenersMap[key].slice(0);
664 - i = listeners.length;
665 731
666 - while (i--) {
732 + for (i = 0; i < listeners.length; i++) {
667 733 // If the listener returns true then it shall be removed from the event
668 734 // The function is executed either with a basic call or an apply if there is an args array
669 735 listener = listeners[i];
670 736
@@ -763,8 +829,8 @@
763 829 }
764 830 else {
765 831 exports.EventEmitter = EventEmitter;
766 832 }
767 -}.call(this));
833 +}(typeof window !== 'undefined' ? window : this || {}));
768 834
769 835 },{}]},{},[1]);
770 - })();
836 +; })();