Fix no-param-reassign in ES5
[MAILPOET-1033]
This commit is contained in:
@ -82,7 +82,6 @@
|
|||||||
"no-unused-vars": 0,
|
"no-unused-vars": 0,
|
||||||
"object-shorthand": 0,
|
"object-shorthand": 0,
|
||||||
"new-parens": 0,
|
"new-parens": 0,
|
||||||
"no-param-reassign": 0,
|
|
||||||
"keyword-spacing": 0,
|
"keyword-spacing": 0,
|
||||||
"eol-last": 0,
|
"eol-last": 0,
|
||||||
"dot-notation": 0,
|
"dot-notation": 0,
|
||||||
|
@ -12,7 +12,8 @@ function requestFailed(errorMessage, xhr) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
define('ajax', ['mailpoet', 'jquery', 'underscore'], function(MailPoet, jQuery, _) {
|
define('ajax', ['mailpoet', 'jquery', 'underscore'], function(mp, jQuery, _) {
|
||||||
|
var MailPoet = mp;
|
||||||
|
|
||||||
MailPoet.Ajax = {
|
MailPoet.Ajax = {
|
||||||
version: 0.5,
|
version: 0.5,
|
||||||
|
@ -24,7 +24,8 @@ function track(name, data){
|
|||||||
window.mixpanel.track(name, data);
|
window.mixpanel.track(name, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportMixpanel(MailPoet) {
|
function exportMixpanel(mp) {
|
||||||
|
var MailPoet = mp;
|
||||||
MailPoet.forceTrackEvent = track;
|
MailPoet.forceTrackEvent = track;
|
||||||
|
|
||||||
if (window.mailpoet_analytics_enabled) {
|
if (window.mailpoet_analytics_enabled) {
|
||||||
@ -61,7 +62,8 @@ function cacheEvent(forced, name, data) {
|
|||||||
|
|
||||||
define(
|
define(
|
||||||
['mailpoet', 'underscore'],
|
['mailpoet', 'underscore'],
|
||||||
function(MailPoet, _) {
|
function(mp, _) {
|
||||||
|
var MailPoet = mp;
|
||||||
|
|
||||||
MailPoet.trackEvent = _.partial(cacheEvent, false);
|
MailPoet.trackEvent = _.partial(cacheEvent, false);
|
||||||
MailPoet.forceTrackEvent = _.partial(cacheEvent, true);
|
MailPoet.forceTrackEvent = _.partial(cacheEvent, true);
|
||||||
|
@ -4,12 +4,14 @@ define('date',
|
|||||||
'jquery',
|
'jquery',
|
||||||
'moment'
|
'moment'
|
||||||
], function(
|
], function(
|
||||||
MailPoet,
|
mp,
|
||||||
jQuery,
|
jQuery,
|
||||||
Moment
|
Moment
|
||||||
) {
|
) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var MailPoet = mp;
|
||||||
|
|
||||||
MailPoet.Date = {
|
MailPoet.Date = {
|
||||||
version: 0.1,
|
version: 0.1,
|
||||||
options: {},
|
options: {},
|
||||||
@ -17,8 +19,8 @@ define('date',
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
format: 'F, d Y H:i:s'
|
format: 'F, d Y H:i:s'
|
||||||
},
|
},
|
||||||
init: function(options) {
|
init: function (opts) {
|
||||||
options = options || {};
|
var options = opts || {};
|
||||||
|
|
||||||
// set UTC offset
|
// set UTC offset
|
||||||
if (
|
if (
|
||||||
@ -39,16 +41,16 @@ define('date',
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
format: function(date, options) {
|
format: function(date, opts) {
|
||||||
options = options || {};
|
var options = opts || {};
|
||||||
this.init(options);
|
this.init(options);
|
||||||
|
|
||||||
var date = Moment(date, this.convertFormat(options.parseFormat));
|
var momentDate = Moment(date, this.convertFormat(options.parseFormat));
|
||||||
if (options.offset === 0) date = date.utc();
|
if (options.offset === 0) momentDate = momentDate.utc();
|
||||||
return date.format(this.convertFormat(this.options.format));
|
return momentDate.format(this.convertFormat(this.options.format));
|
||||||
},
|
},
|
||||||
toDate: function(date, options) {
|
toDate: function(date, opts) {
|
||||||
options = options || {};
|
var options = opts || {};
|
||||||
this.init(options);
|
this.init(options);
|
||||||
|
|
||||||
return Moment(date, this.convertFormat(options.parseFormat)).toDate();
|
return Moment(date, this.convertFormat(options.parseFormat)).toDate();
|
||||||
|
@ -81,8 +81,8 @@ Object.extend(document, (function() {
|
|||||||
})());
|
})());
|
||||||
|
|
||||||
var Observable = (function() {
|
var Observable = (function() {
|
||||||
function getEventName(name, namespace) {
|
function getEventName(nameA, namespace) {
|
||||||
name = name.substring(2);
|
var name = nameA.substring(2);
|
||||||
if(namespace) name = namespace + ':' + name;
|
if(namespace) name = namespace + ':' + name;
|
||||||
return name.underscore().split('_').join(':');
|
return name.underscore().split('_').join(':');
|
||||||
}
|
}
|
||||||
@ -576,7 +576,8 @@ var WysijaForm = {
|
|||||||
WysijaForm.locks.showingTools = false;
|
WysijaForm.locks.showingTools = false;
|
||||||
},
|
},
|
||||||
instances: {},
|
instances: {},
|
||||||
get: function(element, type) {
|
get: function(element, typ) {
|
||||||
|
var type = typ;
|
||||||
if(type === undefined) type = 'block';
|
if(type === undefined) type = 'block';
|
||||||
// identify element
|
// identify element
|
||||||
var id = element.identify();
|
var id = element.identify();
|
||||||
@ -895,7 +896,8 @@ WysijaForm.Block = Class.create({
|
|||||||
});
|
});
|
||||||
|
|
||||||
/* Invoked on item dropped */
|
/* Invoked on item dropped */
|
||||||
WysijaForm.Block.create = function(block, target) {
|
WysijaForm.Block.create = function(createBlock, target) {
|
||||||
|
var block = createBlock;
|
||||||
if($('form_template_' + block.type) === null) {
|
if($('form_template_' + block.type) === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -125,12 +125,13 @@ define('handlebars_helpers', ['handlebars'], function(Handlebars) {
|
|||||||
* @return {String} The truncated string.
|
* @return {String} The truncated string.
|
||||||
*/
|
*/
|
||||||
Handlebars.registerHelper('ellipsis', function (str, limit, append) {
|
Handlebars.registerHelper('ellipsis', function (str, limit, append) {
|
||||||
if (append === undefined) {
|
var strAppend = append;
|
||||||
append = '';
|
if (strAppend === undefined) {
|
||||||
|
strAppend = '';
|
||||||
}
|
}
|
||||||
var sanitized = str.replace(/(<([^>]+)>)/g, '');
|
var sanitized = str.replace(/(<([^>]+)>)/g, '');
|
||||||
if (sanitized.length > limit) {
|
if (sanitized.length > limit) {
|
||||||
return sanitized.substr(0, limit - append.length) + append;
|
return sanitized.substr(0, limit - strAppend.length) + strAppend;
|
||||||
} else {
|
} else {
|
||||||
return sanitized;
|
return sanitized;
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,10 @@ define('i18n',
|
|||||||
[
|
[
|
||||||
'mailpoet'
|
'mailpoet'
|
||||||
], function(
|
], function(
|
||||||
MailPoet
|
mp
|
||||||
) {
|
) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var MailPoet = mp;
|
||||||
|
|
||||||
var translations = {};
|
var translations = {};
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
define('iframe', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
define('iframe', ['mailpoet'], function(mp) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var MailPoet = mp;
|
||||||
MailPoet.Iframe = {
|
MailPoet.Iframe = {
|
||||||
marginY: 20,
|
marginY: 20,
|
||||||
autoSize: function(iframe) {
|
autoSize: function(iframe) {
|
||||||
@ -10,11 +11,12 @@ define('iframe', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
|||||||
iframe.contentWindow.document.body.scrollHeight
|
iframe.contentWindow.document.body.scrollHeight
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
setSize: function(iframe, i) {
|
setSize: function(sizeIframe, i) {
|
||||||
|
var iframe = sizeIframe;
|
||||||
if(!iframe) return;
|
if(!iframe) return;
|
||||||
|
|
||||||
iframe.style.height = (
|
iframe.style.height = (
|
||||||
parseInt(i) + this.marginY
|
parseInt(i, 10) + this.marginY
|
||||||
) + "px";
|
) + "px";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3,8 +3,9 @@ define(
|
|||||||
'jquery'
|
'jquery'
|
||||||
],
|
],
|
||||||
function(
|
function(
|
||||||
$
|
jQuery
|
||||||
) {
|
) {
|
||||||
|
var $ = jQuery;
|
||||||
// Combination of jQuery.deparam and jQuery.serializeObject by Ben Alman.
|
// Combination of jQuery.deparam and jQuery.serializeObject by Ben Alman.
|
||||||
/*!
|
/*!
|
||||||
* jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
|
* jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
define('modal', ['mailpoet', 'jquery'],
|
define('modal', ['mailpoet', 'jquery'],
|
||||||
function(MailPoet, jQuery) {
|
function(mp, jQuery) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var MailPoet = mp;
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
MailPoet Modal:
|
MailPoet Modal:
|
||||||
|
|
||||||
@ -459,9 +460,9 @@ define('modal', ['mailpoet', 'jquery'],
|
|||||||
jQuery('#mailpoet_modal_overlay').hide();
|
jQuery('#mailpoet_modal_overlay').hide();
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
popup: function(options) {
|
popup: function(opts) {
|
||||||
// get options
|
// get options
|
||||||
options = options || {};
|
var options = opts || {};
|
||||||
// set modal type
|
// set modal type
|
||||||
options.type = 'popup';
|
options.type = 'popup';
|
||||||
// set overlay state
|
// set overlay state
|
||||||
@ -473,9 +474,9 @@ define('modal', ['mailpoet', 'jquery'],
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
panel: function(options) {
|
panel: function(opts) {
|
||||||
// get options
|
// get options
|
||||||
options = options || {};
|
var options = opts || {};
|
||||||
// reset subpanels
|
// reset subpanels
|
||||||
this.subpanels = [];
|
this.subpanels = [];
|
||||||
// set modal type
|
// set modal type
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
define('mp2migrator', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
define('mp2migrator', ['mailpoet', 'jquery'], function(mp, jQuery) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var MailPoet = mp;
|
||||||
MailPoet.MP2Migrator = {
|
MailPoet.MP2Migrator = {
|
||||||
|
|
||||||
fatal_error: '',
|
fatal_error: '',
|
||||||
@ -28,7 +29,8 @@ define('mp2migrator', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
|||||||
cache: false
|
cache: false
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
jQuery("#logger").html('');
|
jQuery("#logger").html('');
|
||||||
result.split("\n").forEach(function (row) {
|
result.split("\n").forEach(function (resultRow) {
|
||||||
|
var row = resultRow;
|
||||||
if(row.substr(0, 7) === '[ERROR]' || row.substr(0, 9) === '[WARNING]' || row === MailPoet.I18n.t('import_stopped_by_user')) {
|
if(row.substr(0, 7) === '[ERROR]' || row.substr(0, 9) === '[WARNING]' || row === MailPoet.I18n.t('import_stopped_by_user')) {
|
||||||
row = '<span class="error_msg">' + row + '</span>'; // Mark the errors in red
|
row = '<span class="error_msg">' + row + '</span>'; // Mark the errors in red
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@ define([
|
|||||||
'underscore',
|
'underscore',
|
||||||
'handlebars',
|
'handlebars',
|
||||||
'handlebars_helpers'
|
'handlebars_helpers'
|
||||||
], function(Backbone, Marionette, Radio, jQuery, _, Handlebars) {
|
], function(Backbone, Marionette, BackboneRadio, jQuery, _, Handlebars) {
|
||||||
|
var Radio = BackboneRadio;
|
||||||
|
|
||||||
var AppView = Marionette.View.extend({
|
var AppView = Marionette.View.extend({
|
||||||
el: '#mailpoet_editor',
|
el: '#mailpoet_editor',
|
||||||
@ -28,7 +29,9 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
getChannel: function(channel) {
|
getChannel: function(channel) {
|
||||||
if (channel === undefined) channel = 'global';
|
if (channel === undefined) {
|
||||||
|
return Radio.channel('global');
|
||||||
|
}
|
||||||
return Radio.channel(channel);
|
return Radio.channel(channel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
define([
|
define([
|
||||||
'backbone.marionette'
|
'backbone.marionette'
|
||||||
], function(Marionette) {
|
], function(BackboneMarionette) {
|
||||||
|
var Marionette = BackboneMarionette;
|
||||||
var BehaviorsLookup = {};
|
var BehaviorsLookup = {};
|
||||||
Marionette.Behaviors.behaviorsLookup = function() {
|
Marionette.Behaviors.behaviorsLookup = function() {
|
||||||
return BehaviorsLookup;
|
return BehaviorsLookup;
|
||||||
|
@ -9,8 +9,9 @@ define([
|
|||||||
'mailpoet',
|
'mailpoet',
|
||||||
'spectrum'
|
'spectrum'
|
||||||
], function(Marionette, BehaviorsLookup, MailPoet, Spectrum) {
|
], function(Marionette, BehaviorsLookup, MailPoet, Spectrum) {
|
||||||
|
var BL = BehaviorsLookup;
|
||||||
|
|
||||||
BehaviorsLookup.ColorPickerBehavior = Marionette.Behavior.extend({
|
BL.ColorPickerBehavior = Marionette.Behavior.extend({
|
||||||
onRender: function() {
|
onRender: function() {
|
||||||
this.view.$('.mailpoet_color').spectrum({
|
this.view.$('.mailpoet_color').spectrum({
|
||||||
clickoutFiresChange: true,
|
clickoutFiresChange: true,
|
||||||
|
@ -11,7 +11,8 @@ define([
|
|||||||
'jquery',
|
'jquery',
|
||||||
'newsletter_editor/behaviors/BehaviorsLookup',
|
'newsletter_editor/behaviors/BehaviorsLookup',
|
||||||
'interact'
|
'interact'
|
||||||
], function(Marionette, _, jQuery, BehaviorsLookup, interact) {
|
], function(Marionette, _, jQuery, BL, interact) {
|
||||||
|
var BehaviorsLookup = BL;
|
||||||
|
|
||||||
BehaviorsLookup.ContainerDropZoneBehavior = Marionette.Behavior.extend({
|
BehaviorsLookup.ContainerDropZoneBehavior = Marionette.Behavior.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
@ -268,7 +269,7 @@ define([
|
|||||||
// 2. Remove visual markings of drop position visualization
|
// 2. Remove visual markings of drop position visualization
|
||||||
this.view.$('.mailpoet_drop_marker').remove();
|
this.view.$('.mailpoet_drop_marker').remove();
|
||||||
},
|
},
|
||||||
getDropPosition: function(eventX, eventY, unsafe) {
|
getDropPosition: function(eventX, eventY, is_unsafe) {
|
||||||
var SPECIAL_AREA_INSERTION_WIDTH = 0.00, // Disable special insertion. Default: 0.3
|
var SPECIAL_AREA_INSERTION_WIDTH = 0.00, // Disable special insertion. Default: 0.3
|
||||||
|
|
||||||
element = this.view.$el,
|
element = this.view.$el,
|
||||||
@ -290,7 +291,7 @@ define([
|
|||||||
|
|
||||||
insertionType, index, position, indexAndPosition;
|
insertionType, index, position, indexAndPosition;
|
||||||
|
|
||||||
unsafe = !!unsafe;
|
unsafe = !!is_unsafe;
|
||||||
|
|
||||||
if (this.getCollection().length === 0) {
|
if (this.getCollection().length === 0) {
|
||||||
return {
|
return {
|
||||||
|
@ -11,8 +11,9 @@ define([
|
|||||||
'newsletter_editor/behaviors/BehaviorsLookup',
|
'newsletter_editor/behaviors/BehaviorsLookup',
|
||||||
'interact'
|
'interact'
|
||||||
], function(Marionette, _, jQuery, BehaviorsLookup, interact) {
|
], function(Marionette, _, jQuery, BehaviorsLookup, interact) {
|
||||||
|
var BL = BehaviorsLookup;
|
||||||
|
|
||||||
BehaviorsLookup.DraggableBehavior = Marionette.Behavior.extend({
|
BL.DraggableBehavior = Marionette.Behavior.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
cloneOriginal: false,
|
cloneOriginal: false,
|
||||||
hideOriginal: false,
|
hideOriginal: false,
|
||||||
@ -46,7 +47,8 @@ define([
|
|||||||
// Scroll when dragging near edges of a window
|
// Scroll when dragging near edges of a window
|
||||||
autoScroll: true,
|
autoScroll: true,
|
||||||
|
|
||||||
onstart: function(event) {
|
onstart: function(startEvent) {
|
||||||
|
var event = startEvent;
|
||||||
|
|
||||||
if (that.options.cloneOriginal === true) {
|
if (that.options.cloneOriginal === true) {
|
||||||
// Use substitution instead of a clone
|
// Use substitution instead of a clone
|
||||||
@ -129,7 +131,8 @@ define([
|
|||||||
} else {
|
} else {
|
||||||
interactable.getDropModel = this.view.getDropFunc();
|
interactable.getDropModel = this.view.getDropFunc();
|
||||||
}
|
}
|
||||||
interactable.onDrop = function(options) {
|
interactable.onDrop = function(opts) {
|
||||||
|
var options = opts;
|
||||||
if (_.isObject(options)) {
|
if (_.isObject(options)) {
|
||||||
// Inject Draggable behavior if possible
|
// Inject Draggable behavior if possible
|
||||||
options.dragBehavior = that;
|
options.dragBehavior = that;
|
||||||
|
@ -7,8 +7,9 @@ define([
|
|||||||
'backbone.marionette',
|
'backbone.marionette',
|
||||||
'newsletter_editor/behaviors/BehaviorsLookup'
|
'newsletter_editor/behaviors/BehaviorsLookup'
|
||||||
], function(Marionette, BehaviorsLookup) {
|
], function(Marionette, BehaviorsLookup) {
|
||||||
|
var BL = BehaviorsLookup;
|
||||||
|
|
||||||
BehaviorsLookup.HighlightEditingBehavior = Marionette.Behavior.extend({
|
BL.HighlightEditingBehavior = Marionette.Behavior.extend({
|
||||||
modelEvents: {
|
modelEvents: {
|
||||||
'startEditing': 'enableHighlight',
|
'startEditing': 'enableHighlight',
|
||||||
'stopEditing': 'disableHighlight'
|
'stopEditing': 'disableHighlight'
|
||||||
|
@ -8,8 +8,9 @@ define([
|
|||||||
'newsletter_editor/behaviors/BehaviorsLookup',
|
'newsletter_editor/behaviors/BehaviorsLookup',
|
||||||
'interact'
|
'interact'
|
||||||
], function(Marionette, BehaviorsLookup, interact) {
|
], function(Marionette, BehaviorsLookup, interact) {
|
||||||
|
var BL = BehaviorsLookup;
|
||||||
|
|
||||||
BehaviorsLookup.ResizableBehavior = Marionette.Behavior.extend({
|
BL.ResizableBehavior = Marionette.Behavior.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
elementSelector: null,
|
elementSelector: null,
|
||||||
resizeHandleSelector: true, // true will use edges of the element itself
|
resizeHandleSelector: true, // true will use edges of the element itself
|
||||||
|
@ -8,8 +8,9 @@ define([
|
|||||||
'jquery',
|
'jquery',
|
||||||
'newsletter_editor/behaviors/BehaviorsLookup'
|
'newsletter_editor/behaviors/BehaviorsLookup'
|
||||||
], function(Marionette, jQuery, BehaviorsLookup) {
|
], function(Marionette, jQuery, BehaviorsLookup) {
|
||||||
|
var BL = BehaviorsLookup;
|
||||||
|
|
||||||
BehaviorsLookup.ShowSettingsBehavior = Marionette.Behavior.extend({
|
BL.ShowSettingsBehavior = Marionette.Behavior.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
ignoreFrom: '' // selector
|
ignoreFrom: '' // selector
|
||||||
},
|
},
|
||||||
|
@ -8,8 +8,9 @@ define([
|
|||||||
'underscore',
|
'underscore',
|
||||||
'newsletter_editor/behaviors/BehaviorsLookup'
|
'newsletter_editor/behaviors/BehaviorsLookup'
|
||||||
], function(Marionette, _, BehaviorsLookup) {
|
], function(Marionette, _, BehaviorsLookup) {
|
||||||
|
var BL = BehaviorsLookup;
|
||||||
|
|
||||||
BehaviorsLookup.SortableBehavior = Marionette.Behavior.extend({
|
BL.SortableBehavior = Marionette.Behavior.extend({
|
||||||
onRender: function() {
|
onRender: function() {
|
||||||
var collection = this.view.collection;
|
var collection = this.view.collection;
|
||||||
|
|
||||||
|
@ -8,8 +8,9 @@ define([
|
|||||||
'underscore',
|
'underscore',
|
||||||
'newsletter_editor/behaviors/BehaviorsLookup'
|
'newsletter_editor/behaviors/BehaviorsLookup'
|
||||||
], function(Marionette, _, BehaviorsLookup) {
|
], function(Marionette, _, BehaviorsLookup) {
|
||||||
|
var BL = BehaviorsLookup;
|
||||||
|
|
||||||
BehaviorsLookup.TextEditorBehavior = Marionette.Behavior.extend({
|
BL.TextEditorBehavior = Marionette.Behavior.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
selector: '.mailpoet_content',
|
selector: '.mailpoet_content',
|
||||||
toolbar1: "bold italic link unlink forecolor mailpoet_shortcodes",
|
toolbar1: "bold italic link unlink forecolor mailpoet_shortcodes",
|
||||||
|
@ -392,8 +392,9 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
App.on('start', function(App, options) {
|
App.on('start', function(App, options) {
|
||||||
App._ALCSupervisor = new Module.ALCSupervisor();
|
var Application = App;
|
||||||
App._ALCSupervisor.refresh();
|
Application._ALCSupervisor = new Module.ALCSupervisor();
|
||||||
|
Application._ALCSupervisor.refresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return Module;
|
return Module;
|
||||||
|
@ -194,8 +194,8 @@ define([
|
|||||||
move: true
|
move: true
|
||||||
},
|
},
|
||||||
getSettingsView: function() { return Module.BlockSettingsView; },
|
getSettingsView: function() { return Module.BlockSettingsView; },
|
||||||
initialize: function(options) {
|
initialize: function(opts) {
|
||||||
options = options || {};
|
var options = opts || {};
|
||||||
if (!_.isUndefined(options.tools)) {
|
if (!_.isUndefined(options.tools)) {
|
||||||
// Make a new block specific tool config object
|
// Make a new block specific tool config object
|
||||||
this.tools = jQuery.extend({}, this.tools, options.tools || {});
|
this.tools = jQuery.extend({}, this.tools, options.tools || {});
|
||||||
|
@ -266,7 +266,8 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
mainEmbedToolbar: function(toolbar) {
|
mainEmbedToolbar: function(toolbar) {
|
||||||
toolbar.view = new wp.media.view.Toolbar.Embed({
|
var tbar = toolbar;
|
||||||
|
tbar.view = new wp.media.view.Toolbar.Embed({
|
||||||
controller: this,
|
controller: this,
|
||||||
text: 'Add images'
|
text: 'Add images'
|
||||||
});
|
});
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
}
|
}
|
||||||
}(this, function(Marionette, Radio, _) {
|
}(this, function(Marionette, Radio, _) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var MarionetteApplication = Marionette.Application;
|
||||||
Marionette.Application.prototype._initChannel = function () {
|
MarionetteApplication.prototype._initChannel = function () {
|
||||||
this.channelName = _.result(this, 'channelName') || 'global';
|
this.channelName = _.result(this, 'channelName') || 'global';
|
||||||
this.channel = _.result(this, 'channel') || Radio.channel(this.channelName);
|
this.channel = _.result(this, 'channel') || Radio.channel(this.channelName);
|
||||||
};
|
};
|
||||||
|
@ -25,11 +25,12 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
App.on('before:start', function(App, options) {
|
App.on('before:start', function(App, options) {
|
||||||
|
var Application = App;
|
||||||
// Expose config methods globally
|
// Expose config methods globally
|
||||||
App.getConfig = Module.getConfig;
|
Application.getConfig = Module.getConfig;
|
||||||
App.setConfig = Module.setConfig;
|
Application.setConfig = Module.setConfig;
|
||||||
|
|
||||||
App.setConfig(options.config);
|
Application.setConfig(options.config);
|
||||||
});
|
});
|
||||||
|
|
||||||
return Module;
|
return Module;
|
||||||
|
@ -67,7 +67,8 @@ define([
|
|||||||
return _.filter(blocks, predicate);
|
return _.filter(blocks, predicate);
|
||||||
};
|
};
|
||||||
|
|
||||||
App.on('before:start', function(App, options) {
|
App.on('before:start', function(Application, options) {
|
||||||
|
var App = Application;
|
||||||
// Expose block methods globally
|
// Expose block methods globally
|
||||||
App.registerBlockType = Module.registerBlockType;
|
App.registerBlockType = Module.registerBlockType;
|
||||||
App.getBlockTypeModel = Module.getBlockTypeModel;
|
App.getBlockTypeModel = Module.getBlockTypeModel;
|
||||||
@ -80,7 +81,8 @@ define([
|
|||||||
Module.newsletter = new Module.NewsletterModel(_.omit(_.clone(options.newsletter), ['body']));
|
Module.newsletter = new Module.NewsletterModel(_.omit(_.clone(options.newsletter), ['body']));
|
||||||
});
|
});
|
||||||
|
|
||||||
App.on('start', function(App, options) {
|
App.on('start', function(Application, options) {
|
||||||
|
var App = Application;
|
||||||
var body = options.newsletter.body;
|
var body = options.newsletter.body;
|
||||||
var content = (_.has(body, 'content')) ? body.content : {};
|
var content = (_.has(body, 'content')) ? body.content : {};
|
||||||
|
|
||||||
|
@ -67,9 +67,10 @@ define([
|
|||||||
|
|
||||||
// For getting a promise after triggering save event
|
// For getting a promise after triggering save event
|
||||||
Module.saveAndProvidePromise = function(saveResult) {
|
Module.saveAndProvidePromise = function(saveResult) {
|
||||||
|
var result = saveResult;
|
||||||
var promise = Module.save();
|
var promise = Module.save();
|
||||||
if (saveResult !== undefined) {
|
if (saveResult !== undefined) {
|
||||||
saveResult.promise = promise;
|
result.promise = promise;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -331,10 +332,10 @@ define([
|
|||||||
Module.beforeExitWithUnsavedChanges = function(e) {
|
Module.beforeExitWithUnsavedChanges = function(e) {
|
||||||
if (saveTimeout) {
|
if (saveTimeout) {
|
||||||
var message = MailPoet.I18n.t('unsavedChangesWillBeLost');
|
var message = MailPoet.I18n.t('unsavedChangesWillBeLost');
|
||||||
e = e || window.event;
|
var event = e || window.event;
|
||||||
|
|
||||||
if (e) {
|
if (event) {
|
||||||
e.returnValue = message;
|
event.returnValue = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
@ -342,12 +343,13 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
App.on('before:start', function(App, options) {
|
App.on('before:start', function(App, options) {
|
||||||
App.save = Module.saveAndProvidePromise;
|
var Application = App;
|
||||||
App.getChannel().on('autoSave', Module.autoSave);
|
Application.save = Module.saveAndProvidePromise;
|
||||||
|
Application.getChannel().on('autoSave', Module.autoSave);
|
||||||
|
|
||||||
window.onbeforeunload = Module.beforeExitWithUnsavedChanges;
|
window.onbeforeunload = Module.beforeExitWithUnsavedChanges;
|
||||||
|
|
||||||
App.getChannel().on('save', function(saveResult) { App.save(saveResult); });
|
Application.getChannel().on('save', function(saveResult) { Application.save(saveResult); });
|
||||||
});
|
});
|
||||||
|
|
||||||
App.on('start', function(App, options) {
|
App.on('start', function(App, options) {
|
||||||
|
@ -358,10 +358,11 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
App.on('before:start', function(App, options) {
|
App.on('before:start', function(App, options) {
|
||||||
App.registerWidget = Module.registerWidget;
|
var Application = App;
|
||||||
App.getWidgets = Module.getWidgets;
|
Application.registerWidget = Module.registerWidget;
|
||||||
App.registerLayoutWidget = Module.registerLayoutWidget;
|
Application.getWidgets = Module.getWidgets;
|
||||||
App.getLayoutWidgets = Module.getLayoutWidgets;
|
Application.registerLayoutWidget = Module.registerLayoutWidget;
|
||||||
|
Application.getLayoutWidgets = Module.getLayoutWidgets;
|
||||||
});
|
});
|
||||||
|
|
||||||
App.on('start', function(App, options) {
|
App.on('start', function(App, options) {
|
||||||
|
@ -69,10 +69,11 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
App.on('before:start', function(App, options) {
|
App.on('before:start', function(App, options) {
|
||||||
|
var Application = App;
|
||||||
// Expose style methods to global application
|
// Expose style methods to global application
|
||||||
App.getGlobalStyles = Module.getGlobalStyles;
|
Application.getGlobalStyles = Module.getGlobalStyles;
|
||||||
App.setGlobalStyles = Module.setGlobalStyles;
|
Application.setGlobalStyles = Module.setGlobalStyles;
|
||||||
App.getAvailableStyles = Module.getAvailableStyles;
|
Application.getAvailableStyles = Module.getAvailableStyles;
|
||||||
|
|
||||||
var body = options.newsletter.body;
|
var body = options.newsletter.body;
|
||||||
var globalStyles = (_.has(body, 'globalStyles')) ? body.globalStyles : {};
|
var globalStyles = (_.has(body, 'globalStyles')) ? body.globalStyles : {};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
define('notice', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
define('notice', ['mailpoet', 'jquery'], function(mp, jQuery) {
|
||||||
"use strict";
|
"use strict";
|
||||||
/*==================================================================================================
|
/*==================================================================================================
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ define('notice', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
|||||||
MailPoet.Notice.system('You need to updated ASAP!');
|
MailPoet.Notice.system('You need to updated ASAP!');
|
||||||
|
|
||||||
==================================================================================================*/
|
==================================================================================================*/
|
||||||
|
var MailPoet = mp;
|
||||||
MailPoet.Notice = {
|
MailPoet.Notice = {
|
||||||
version: 1.0,
|
version: 1.0,
|
||||||
// default options
|
// default options
|
||||||
@ -103,12 +103,12 @@ define('notice', ['mailpoet', 'jquery'], function(MailPoet, jQuery) {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
setMessage: function(message) {
|
setMessage: function(message) {
|
||||||
message = this.formatMessage(message);
|
var formattedMessage = this.formatMessage(message);
|
||||||
|
|
||||||
// let's sugar coat the message with a fancy <p>
|
// let's sugar coat the message with a fancy <p>
|
||||||
message = '<p>'+message+'</p>';
|
formattedMessage = '<p>'+formattedMessage+'</p>';
|
||||||
// set message
|
// set message
|
||||||
return this.element.html(message);
|
return this.element.html(formattedMessage);
|
||||||
},
|
},
|
||||||
formatMessage: function(message) {
|
formatMessage: function(message) {
|
||||||
if (Array.isArray(message)) {
|
if (Array.isArray(message)) {
|
||||||
|
@ -2,13 +2,14 @@ define('num',
|
|||||||
[
|
[
|
||||||
'mailpoet'
|
'mailpoet'
|
||||||
], function(
|
], function(
|
||||||
MailPoet
|
mp
|
||||||
) {
|
) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var MailPoet = mp;
|
||||||
MailPoet.Num = {
|
MailPoet.Num = {
|
||||||
toLocaleFixed: function (num, precision) {
|
toLocaleFixed: function (num, precisionOpts) {
|
||||||
precision = precision || 0;
|
var precision = precisionOpts || 0;
|
||||||
var factor = Math.pow(10, precision);
|
var factor = Math.pow(10, precision);
|
||||||
return (Math.round(num * factor) / factor)
|
return (Math.round(num * factor) / factor)
|
||||||
.toLocaleString(
|
.toLocaleString(
|
||||||
|
@ -7,8 +7,9 @@ define(
|
|||||||
function(
|
function(
|
||||||
Backbone,
|
Backbone,
|
||||||
jQuery,
|
jQuery,
|
||||||
MailPoet
|
mp
|
||||||
) {
|
) {
|
||||||
|
var MailPoet = mp;
|
||||||
if(jQuery('#mailpoet_settings').length === 0) {
|
if(jQuery('#mailpoet_settings').length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -50,9 +51,9 @@ define(
|
|||||||
jQuery('#mailpoet_sending_method_setup').fadeIn();
|
jQuery('#mailpoet_sending_method_setup').fadeIn();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tabs: function(tab, section) {
|
tabs: function(tabStr, section) {
|
||||||
// set default tab
|
// set default tab
|
||||||
tab = tab || 'mta';
|
var tab = tabStr || 'mta';
|
||||||
|
|
||||||
// reset all active tabs
|
// reset all active tabs
|
||||||
jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active');
|
jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active');
|
||||||
|
@ -52,8 +52,9 @@ define(
|
|||||||
router.on('route:step1', function () {
|
router.on('route:step1', function () {
|
||||||
// set or reset temporary validation rule on all columns
|
// set or reset temporary validation rule on all columns
|
||||||
mailpoetColumns = jQuery.map(mailpoetColumns, function (column, columnIndex) {
|
mailpoetColumns = jQuery.map(mailpoetColumns, function (column, columnIndex) {
|
||||||
column.validation_rule = false;
|
var col = column;
|
||||||
return column;
|
col.validation_rule = false;
|
||||||
|
return col;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof (importData.step1) !== 'undefined') {
|
if (typeof (importData.step1) !== 'undefined') {
|
||||||
@ -302,10 +303,10 @@ define(
|
|||||||
advancedOptionComments = false,
|
advancedOptionComments = false,
|
||||||
// trim spaces, commas, periods,
|
// trim spaces, commas, periods,
|
||||||
// single/double quotes and convert to lowercase
|
// single/double quotes and convert to lowercase
|
||||||
detectAndCleanupEmail = function (email) {
|
detectAndCleanupEmail = function (emailString) {
|
||||||
var test;
|
var test;
|
||||||
// decode HTML entities
|
// decode HTML entities
|
||||||
email = jQuery('<div />').html(email).text();
|
var email = jQuery('<div />').html(emailString).text();
|
||||||
email = email
|
email = email
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
// left/right trim spaces, punctuation (e.g., " 'email@email.com'; ")
|
// left/right trim spaces, punctuation (e.g., " 'email@email.com'; ")
|
||||||
@ -536,12 +537,14 @@ define(
|
|||||||
data: segments,
|
data: segments,
|
||||||
width: '20em',
|
width: '20em',
|
||||||
templateResult: function (item) {
|
templateResult: function (item) {
|
||||||
item.subscriberCount = parseInt(item.subscriberCount);
|
var i = item;
|
||||||
return item.name + ' (' + item.subscriberCount.toLocaleString() + ')';
|
i.subscriberCount = parseInt(i.subscriberCount, 10);
|
||||||
|
return i.name + ' (' + i.subscriberCount.toLocaleString() + ')';
|
||||||
},
|
},
|
||||||
templateSelection: function (item) {
|
templateSelection: function (item) {
|
||||||
item.subscriberCount = parseInt(item.subscriberCount);
|
var i = item;
|
||||||
return item.name + ' (' + item.subscriberCount.toLocaleString() + ')';
|
i.subscriberCount = parseInt(i.subscriberCount, 10);
|
||||||
|
return i.name + ' (' + i.subscriberCount.toLocaleString() + ')';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.change(function () {
|
.change(function () {
|
||||||
@ -896,7 +899,8 @@ define(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jQuery.map(subscribersClone.subscribers, function (data, index) {
|
jQuery.map(subscribersClone.subscribers, function (dataSubscribers, index) {
|
||||||
|
var data = dataSubscribers;
|
||||||
var rowData = data[matchedColumn.index];
|
var rowData = data[matchedColumn.index];
|
||||||
if (index === fillerPosition || rowData.trim() === '') return;
|
if (index === fillerPosition || rowData.trim() === '') return;
|
||||||
var date = Moment(rowData, testedFormat, true);
|
var date = Moment(rowData, testedFormat, true);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "npm run lint6 && npm run lint5 && npm run lint-tests",
|
"lint": "npm run lint6 && npm run lint5 && npm run lint-tests",
|
||||||
"lint6": "eslint -c .eslintrc.es6.json --max-warnings 0 'assets/js/src/**/*.jsx'",
|
"lint6": "eslint -c .eslintrc.es6.json --max-warnings 0 'assets/js/src/**/*.jsx'",
|
||||||
"lint5": "eslint -c .eslintrc.es5.json --max-warnings 0 'assets/js/src/**/*.js'",
|
"lint5": "eslint -c .eslintrc.es5.json --ignore-pattern helpscout.js --max-warnings 0 'assets/js/src/**/*.js'",
|
||||||
"lint-tests": "eslint -c .eslintrc.tests.json --max-warnings 0 'tests/javascript'"
|
"lint-tests": "eslint -c .eslintrc.tests.json --max-warnings 0 'tests/javascript'"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
Reference in New Issue
Block a user