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