ES5 no-unused-vars

This commit is contained in:
Amine Ben hammou
2017-09-25 21:39:30 +00:00
parent cb1730c4e2
commit c90e0e9f64
33 changed files with 112 additions and 162 deletions

View File

@ -47,7 +47,6 @@
"padded-blocks": 0,
"strict": 0,
"space-infix-ops": 0,
"no-unused-vars": 0,
"object-shorthand": 0,
"new-parens": 0,
"eol-last": 0,

View File

@ -56,12 +56,12 @@ Object.extend(document, (function () {
return wrapper;
}
return {
delegate: function (selector, eventName, handler, context) {
delegate: function(selector, eventName) {
var wrapper = createWrapper.apply(null, arguments);
if (wrapper) document.observe(eventName, wrapper);
return document;
},
stopDelegating: function (selector, eventName, handler) {
stopDelegating: function(selector, eventName) {
var length = arguments.length;
var wrapper;
switch(length) {
@ -168,22 +168,22 @@ Object.extend(window.Droppables, {
if (drop !== this.last_active) window.Droppables.activate(drop, element);
}
},
displayArea: function (draggable) {
if (!this.drops.length) return;
displayArea: function() {
if(!this.drops.length) return;
// hide controls when displaying drop areas.
WysijaForm.hideBlockControls();
this.drops.each(function (drop, iterator) {
if (drop.element.hasClassName('block_placeholder')) {
this.drops.each(function(drop) {
if(drop.element.hasClassName('block_placeholder')) {
drop.element.addClassName('active');
}
});
},
hideArea: function () {
if (!this.drops.length) return;
this.drops.each(function (drop, iterator) {
if (drop.element.hasClassName('block_placeholder')) {
hideArea: function() {
if(!this.drops.length) return;
this.drops.each(function(drop) {
if(drop.element.hasClassName('block_placeholder')) {
drop.element.removeClassName('active');
} else if (drop.element.hasClassName('image_placeholder')) {
drop.element.removeClassName('active');
@ -494,7 +494,6 @@ WysijaForm = {
setSettingsPosition: function () {
// get viewport offsets and dimensions
var viewportHeight = document.viewport.getHeight();
var blockPadding = 5;
window.$(WysijaForm.options.container).select('.wysija_settings').each(function (element) {
// get parent dimensions and position
@ -503,16 +502,8 @@ WysijaForm = {
var is_visible = (parentPos.top <= (WysijaForm.scroll.top + viewportHeight));
var buttonMargin = 5;
var relativeTop = buttonMargin;
var absoluteTop;
var parentTop;
var parentBottom;
if (is_visible) {
// desired position is set to center of viewport
absoluteTop = parseInt(WysijaForm.scroll.top + ((viewportHeight / 2) - (element.getHeight() / 2)), 10);
parentTop = parseInt(parentPos.top - blockPadding, 10);
parentBottom = parseInt(parentPos.top + parentDim.height - blockPadding, 10);
if(is_visible) {
// always center
relativeTop = parseInt((parentDim.height / 2) - (element.getHeight() / 2), 10);
}
@ -830,7 +821,6 @@ WysijaForm.Block = window.Class.create({
},
setupControls: function() {
var block;
var field;
// enable controls
this.controls = this.getControls();
@ -883,7 +873,6 @@ WysijaForm.Block = window.Class.create({
// TODO: refactor
block = window.$(event.target).up('.mailpoet_form_block') || null;
if(block !== null) {
field = WysijaForm.getFieldData(block);
this.editSettings();
}
}.bind(this));
@ -934,7 +923,6 @@ WysijaForm.Block.create = function (createBlock, target) {
var template;
var output;
var settings_segments;
var element;
if(window.$('form_template_' + block.type) === null) {
return false;
}
@ -966,14 +954,13 @@ WysijaForm.Block.create = function (createBlock, target) {
}
// if the drop target was the bottom placeholder
element = null;
if(target.identify() === 'block_placeholder') {
// insert block at the bottom
element = body.insert(output);
// block = body.childElements().last();
body.insert(output);
//block = body.childElements().last();
} else {
// insert block before the drop target
element = target.insert({
target.insert({
before: output
});
// block = target.previous('.mailpoet_form_block');

View File

@ -10,7 +10,7 @@ define('handlebars_helpers', ['handlebars'], function (Handlebars) {
return output;
});
Handlebars.registerHelper('number_format', function (value, block) {
Handlebars.registerHelper('number_format', function(value) {
return Number(value).toLocaleString();
});
Handlebars.registerHelper('date_format', function(timestamp, block) {
@ -39,7 +39,6 @@ define('handlebars_helpers', ['handlebars'], function (Handlebars) {
});
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
var values;
switch (operator) {
case '==':
return (v1 == v2) ? options.fn(this) : options.inverse(this);
@ -62,25 +61,24 @@ define('handlebars_helpers', ['handlebars'], function (Handlebars) {
case '||':
return (v1 || v2) ? options.fn(this) : options.inverse(this);
case 'in':
values = v2.split(',');
return (v2.indexOf(v1) !== -1) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
});
Handlebars.registerHelper('nl2br', function (value, block) {
Handlebars.registerHelper('nl2br', function(value) {
return value.gsub('\n', '<br />');
});
Handlebars.registerHelper('json_encode', function (value, block) {
Handlebars.registerHelper('json_encode', function(value) {
return JSON.stringify(value);
});
Handlebars.registerHelper('json_decode', function (value, block) {
Handlebars.registerHelper('json_decode', function(value) {
return JSON.parse(value);
});
Handlebars.registerHelper('url', function (value, block) {
Handlebars.registerHelper('url', function(value) {
var url = window.location.protocol + '//' + window.location.host + window.location.pathname;
return url + value;
@ -93,12 +91,12 @@ define('handlebars_helpers', ['handlebars'], function (Handlebars) {
return value;
}
});
Handlebars.registerHelper('lookup', function (obj, field, options) {
Handlebars.registerHelper('lookup', function(obj, field) {
return obj && obj[field];
});
Handlebars.registerHelper('rsa_key', function(value, block) {
Handlebars.registerHelper('rsa_key', function(value) {
var lines;
// extract all lines into an array
if(value === undefined) return '';
@ -113,8 +111,8 @@ define('handlebars_helpers', ['handlebars'], function (Handlebars) {
return lines.join('');
});
Handlebars.registerHelper('trim', function (value, block) {
if (value === null || value === undefined) return '';
Handlebars.registerHelper('trim', function(value) {
if(value === null || value === undefined) return '';
return value.trim();
});

View File

@ -179,8 +179,8 @@ define('modal', ['mailpoet', 'jquery'],
return this;
},
initOverlay: function (toggle) {
if (jQuery('#mailpoet_modal_overlay').length === 0) {
initOverlay: function() {
if(jQuery('#mailpoet_modal_overlay').length === 0) {
// insert overlay into the DOM
jQuery('body').append(this.templates.overlay);
// insert loading indicator into overlay
@ -438,7 +438,7 @@ define('modal', ['mailpoet', 'jquery'],
.removeClass('mailpoet_modal_highlight');
return this;
},
hideModal: function (callback) {
hideModal: function() {
// set modal as closed
this.opened = false;
@ -453,7 +453,7 @@ define('modal', ['mailpoet', 'jquery'],
return this;
},
showOverlay: function (force) {
showOverlay: function() {
jQuery('#mailpoet_modal_overlay').show();
return this;
},

View File

@ -1,12 +1,8 @@
define([
'backbone',
'backbone.marionette',
'backbone.radio',
'jquery',
'underscore',
'handlebars',
'handlebars_helpers'
], function (Backbone, Marionette, BackboneRadio, jQuery, _, Handlebars) {
'backbone.radio'
], function(Backbone, Marionette, BackboneRadio) {
var Radio = BackboneRadio;
var AppView = Marionette.View.extend({

View File

@ -8,7 +8,7 @@ define([
'newsletter_editor/behaviors/BehaviorsLookup',
'mailpoet',
'spectrum'
], function (Marionette, BehaviorsLookup, MailPoet, Spectrum) {
], function(Marionette, BehaviorsLookup, MailPoet) {
var BL = BehaviorsLookup;
BL.ColorPickerBehavior = Marionette.Behavior.extend({

View File

@ -25,7 +25,7 @@ define([
this.addDropZone();
}
},
addDropZone: function(_event) {
addDropZone: function() {
var that = this;
var view = this.view;
var domElement = that.$el.get(0);
@ -47,11 +47,11 @@ define([
interact(domElement).dropzone({
accept: acceptableElementSelector,
overlap: 'pointer', // Mouse pointer denotes location of a droppable
ondragenter: function (event) {
ondragenter: function() {
// 1. Visually mark block as active for dropping
view.$el.addClass('mailpoet_drop_active');
},
ondragleave: function (event) {
ondragleave: function() {
// 1. Remove visual markings of active dropping container
// 2. Remove visual markings of drop position visualization
that.cleanup();
@ -193,7 +193,6 @@ define([
var droppableModel = event.draggable.getDropModel();
var viewCollection = that.getCollection();
var droppedView;
var droppedModel;
var index;
var tempCollection;
var tempCollection2;

View File

@ -28,8 +28,8 @@ define([
throw "Missing 'drop' function for DraggableBehavior";
},
onDrop: function (model, view) {},
testAttachToInstance: function (model, view) { return true; }
onDrop: function() {},
testAttachToInstance: function() { return true; }
},
onRender: function() {
var that = this;
@ -51,10 +51,8 @@ define([
var event = startEvent;
var centerXOffset;
var centerYOffset;
var parentOffset;
var tempClone;
var clone;
var $original;
var $clone;
if (that.options.cloneOriginal === true) {
@ -62,7 +60,7 @@ define([
tempClone = (_.isFunction(that.options.onDragSubstituteBy)) ? that.options.onDragSubstituteBy(that) : undefined;
// Or use a clone
clone = tempClone || event.target.cloneNode(true);
$original = jQuery(event.target);
jQuery(event.target);
$clone = jQuery(clone);
$clone.addClass('mailpoet_droppable_active');

View File

@ -47,8 +47,7 @@ define([
right: false,
bottom: (typeof this.options.resizeHandleSelector === 'string') ? this.view.$(this.options.resizeHandleSelector).get(0) : this.options.resizeHandleSelector
}
})
.on('resizestart', function (event) {
}).on('resizestart', function() {
that.isBeingResized = true;
that.$el.addClass('mailpoet_resize_active');
}).on('resizemove', function(event) {
@ -59,11 +58,7 @@ define([
that.view.model.set(that.options.modelField, newLength + 'px');
})
.on('resizemove', function (event) {
var onResize = that.options.onResize.bind(that);
return onResize(event);
})
.on('resizeend', function (event) {
.on('resizeend', function() {
that.isBeingResized = null;
that.$el.removeClass('mailpoet_resize_active');
});

View File

@ -42,7 +42,7 @@ define([
relative_urls: false,
remove_script_host: false,
convert_urls: true,
urlconverter_callback: function (url, node, on_save, name) {
urlconverter_callback: function(url) {
if (url.match(/\[.+\]/g)) {
// Do not convert URLs with shortcodes
return url;
@ -56,8 +56,8 @@ define([
plugins: this.options.plugins,
setup: function (editor) {
editor.on('change', function (e) {
setup: function(editor) {
editor.on('change', function() {
that.view.triggerMethod('text:editor:change', editor.getContent());
});
@ -71,12 +71,12 @@ define([
}
});
editor.on('focus', function (e) {
editor.on('focus', function() {
that.view.triggerMethod('text:editor:focus');
that._isActivationClick = true;
});
editor.on('blur', function (e) {
editor.on('blur', function() {
that.view.triggerMethod('text:editor:blur');
});
}

View File

@ -266,7 +266,7 @@ define([
}
}).trigger('change');
},
toggleDisplayOptions: function(event) {
toggleDisplayOptions: function() {
var el = this.$('.mailpoet_automated_latest_content_display_options');
var showControl = this.$('.mailpoet_automated_latest_content_show_display_options');
if (el.hasClass('mailpoet_closed')) {
@ -277,7 +277,7 @@ define([
showControl.removeClass('mailpoet_hidden');
}
},
showButtonSettings: function (event) {
showButtonSettings: function() {
var buttonModule = ButtonBlock;
(new buttonModule.ButtonBlockSettingsView({
model: this.model.get('readMoreButton'),
@ -288,7 +288,7 @@ define([
}
})).render();
},
showDividerSettings: function (event) {
showDividerSettings: function() {
var dividerModule = DividerBlock;
(new dividerModule.DividerBlockSettingsView({
model: this.model.get('divider'),
@ -380,7 +380,7 @@ define([
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('automatedLatestContent', {
blockModel: Module.AutomatedLatestContentBlockModel,
blockView: Module.AutomatedLatestContentBlockView
@ -393,7 +393,7 @@ define([
});
});
App.on('start', function (App, options) {
App.on('start', function(App) {
var Application = App;
Application._ALCSupervisor = new Module.ALCSupervisor();
Application._ALCSupervisor.refresh();

View File

@ -10,9 +10,8 @@ define([
'backbone.supermodel',
'underscore',
'jquery',
'mailpoet',
'modal'
], function (App, Marionette, SuperModel, _, jQuery, MailPoet, Modal) {
'mailpoet'
], function(App, Marionette, SuperModel, _, jQuery, MailPoet) {
'use strict';
@ -21,9 +20,8 @@ define([
Module.BlockModel = SuperModel.extend({
stale: [], // Attributes to be removed upon saving
initialize: function () {
var that = this;
this.on('change', function () {
initialize: function() {
this.on('change', function() {
App.getChannel().trigger('autoSave');
});
},
@ -99,13 +97,13 @@ define([
this.on('dom:refresh', this.showBlock, this);
this._isFirstRender = true;
},
showTools: function (_event) {
showTools: function() {
if (!this.showingToolsDisabled) {
this.$('> .mailpoet_tools').addClass('mailpoet_display_tools');
this.toolsView.triggerMethod('showTools');
}
},
hideTools: function (e) {
hideTools: function() {
this.$('> .mailpoet_tools').removeClass('mailpoet_display_tools');
this.toolsView.triggerMethod('hideTools');
},
@ -264,7 +262,7 @@ define([
model: this.model.toJSON()
};
},
close: function (event) {
close: function() {
this.destroy();
},
changeField: function (field, event) {

View File

@ -132,7 +132,7 @@ define([
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('button', {
blockModel: Module.ButtonBlockModel,
blockView: Module.ButtonBlockView

View File

@ -23,9 +23,8 @@ define([
initialize: function () {
this.on('add change remove', function () { App.getChannel().trigger('autoSave'); });
},
parse: function (response) {
var self = this;
return _.map(response, function (block) {
parse: function(response) {
return _.map(response, function(block) {
var Type = App.getBlockTypeModel(block.type);
// TODO: If type has no registered model, use a backup one
return new Type(block, { parse: true });
@ -65,8 +64,8 @@ define([
}
return response;
},
getChildren: function () {
var models = this.get('blocks').map(function (model, index, list) {
getChildren: function() {
var models = this.get('blocks').map(function(model) {
return [model, model.getChildren()];
});
@ -337,7 +336,7 @@ define([
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('container', {
blockModel: Module.ContainerBlockModel,
blockView: Module.ContainerBlockView

View File

@ -5,9 +5,8 @@ define([
'newsletter_editor/App',
'newsletter_editor/blocks/base',
'underscore',
'jquery',
'mailpoet'
], function (App, BaseBlock, _, jQuery, MailPoet) {
'jquery'
], function(App, BaseBlock, _, jQuery) {
'use strict';
@ -119,7 +118,7 @@ define([
repaintDividerStyleOptions: function () {
this.$('.mailpoet_field_divider_style > div').css('border-top-color', this.model.get('styles.block.borderColor'));
},
applyToAll: function (event) {
applyToAll: function() {
App.getChannel().trigger('replaceAllDividers', this.model.toJSON());
},
updateValueAndCall: function (fieldToUpdate, callable, event) {
@ -139,7 +138,7 @@ define([
}
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('divider', {
blockModel: Module.DividerBlockModel,
blockView: Module.DividerBlockView

View File

@ -110,7 +110,7 @@ define([
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('footer', {
blockModel: Module.FooterBlockModel,
blockView: Module.FooterBlockView

View File

@ -110,7 +110,7 @@ define([
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('header', {
blockModel: Module.HeaderBlockModel,
blockView: Module.HeaderBlockView

View File

@ -351,9 +351,6 @@ define([
// retina screen devices
var targetImageWidth = 1320;
// For main image use the size, that's closest to being 660px in width
var sizeKeys = _.keys(sizes);
// Pick the width that is closest to target width
var increasingByWidthDifference = _.sortBy(
_.keys(sizes),
@ -416,7 +413,7 @@ define([
});
Module.ImageWidgetView = ImageWidgetView;
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('image', {
blockModel: Module.ImageBlockModel,
blockView: Module.ImageBlockView

View File

@ -94,7 +94,6 @@ define([
};
},
initialize: function() {
var that = this;
var POST_REFRESH_DELAY_MS = 500;
var refreshAvailablePosts = _.debounce(this.fetchAvailablePosts.bind(this), POST_REFRESH_DELAY_MS);
var refreshTransformedPosts = _.debounce(this._refreshTransformedPosts.bind(this), POST_REFRESH_DELAY_MS);
@ -163,7 +162,6 @@ define([
});
},
_insertSelectedPosts: function() {
var that = this;
var data = this.toJSON();
var index = this.collection.indexOf(this);
var collection = this.collection;
@ -245,7 +243,7 @@ define([
},
onRender: function() {
var that = this;
var blockView = this.model.request('blockView');
this.model.request('blockView');
this.showChildView('selectionRegion', this.selectionView);
this.showChildView('displayOptionsRegion', this.displayOptionsView);
@ -497,7 +495,7 @@ define([
model: this.model.toJSON()
};
},
showButtonSettings: function (event) {
showButtonSettings: function() {
var buttonModule = ButtonBlock;
(new buttonModule.ButtonBlockSettingsView({
model: this.model.get('readMoreButton'),
@ -508,7 +506,7 @@ define([
}
})).render();
},
showDividerSettings: function (event) {
showDividerSettings: function() {
var dividerModule = DividerBlock;
(new dividerModule.DividerBlockSettingsView({
model: this.model.get('divider'),
@ -584,7 +582,7 @@ define([
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('posts', {
blockModel: Module.PostsBlockModel,
blockView: Module.PostsBlockView

View File

@ -34,7 +34,7 @@ define([
text: defaultValues.get('title')
};
},
initialize: function (options) {
initialize: function() {
var that = this;
// Make model swap to default values for that type when iconType changes
this.on('change:iconType', function() {
@ -298,7 +298,7 @@ define([
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('social', {
blockModel: Module.SocialBlockModel,
blockView: Module.SocialBlockView

View File

@ -87,7 +87,7 @@ define([
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('spacer', {
blockModel: Module.SpacerBlockModel,
blockView: Module.SpacerBlockView

View File

@ -94,7 +94,7 @@ define([
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
App.registerBlockType('text', {
blockModel: Module.TextBlockModel,
blockView: Module.TextBlockView

View File

@ -98,7 +98,7 @@ define([
});
};
App.on('start', function (App, options) {
App.on('start', function() {
// Prefetch post types
Module.getPostTypes();
});

View File

@ -13,8 +13,8 @@ define([
// handled by other components.
Module.NewsletterModel = SuperModel.extend({
whitelisted: ['id', 'subject', 'preheader'],
initialize: function (options) {
this.on('change', function () {
initialize: function() {
this.on('change', function() {
App.getChannel().trigger('autoSave');
});
},

View File

@ -29,7 +29,7 @@ define([
}
});
App.on('start', function (App, options) {
App.on('start', function(App) {
App._appView.showChildView('headingRegion', new Module.HeadingView({ model: App.getNewsletter() }));
MailPoet.helpTooltip.show(document.getElementById('tooltip-designer-subject-line'), {
tooltipId: 'tooltip-designer-subject-line-ti',

View File

@ -76,7 +76,6 @@ define([
// Temporary workaround for html2canvas-alpha2.
// Removes 1px left transparent border from resulting canvas.
var oldContext = oldCanvas.getContext('2d');
var newCanvas = document.createElement('canvas');
var newContext = newCanvas.getContext('2d');
var leftBorderWidth = 1;
@ -95,7 +94,6 @@ define([
};
Module.saveTemplate = function(options) {
var that = this;
var promise = jQuery.Deferred();
promise.then(function (thumbnail) {
@ -121,8 +119,7 @@ define([
return promise;
};
Module.exportTemplate = function (options) {
var that = this;
Module.exportTemplate = function(options) {
return Module.getThumbnail(
jQuery('#mailpoet_editor_content > .mailpoet_block').get(0)
).then(function (thumbnail) {
@ -155,7 +152,7 @@ define([
'click .mailpoet_save_export': 'toggleExportTemplate',
'click .mailpoet_export_template': 'exportTemplate'
},
initialize: function (options) {
initialize: function() {
App.getChannel().on('beforeEditorSave', this.beforeSave, this);
App.getChannel().on('afterEditorSave', this.afterSave, this);
},
@ -170,7 +167,7 @@ define([
// TODO: Add a loading animation instead
this.$('.mailpoet_autosaved_at').text(MailPoet.I18n.t('saving'));
},
afterSave: function (json, response) {
afterSave: function(json) {
this.validateNewsletter(json);
// Update 'Last saved timer'
this.$('.mailpoet_editor_last_saved').removeClass('mailpoet_hidden');
@ -285,7 +282,7 @@ define([
this.hideOptionContents();
if (!this.$('.mailpoet_save_next').hasClass('button-disabled')) {
Module._cancelAutosave();
Module.save().done(function (response) {
Module.save().done(function() {
window.location.href = App.getConfig().get('urls.send');
});
}
@ -355,7 +352,7 @@ define([
}
};
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
var Application = App;
Application.save = Module.save;
Application.getChannel().on('autoSave', Module.autoSave);
@ -365,7 +362,7 @@ define([
Application.getChannel().reply('save', Application.save);
});
App.on('start', function (App, options) {
App.on('start', function(App) {
var saveView = new Module.SaveView();
App._appView.showChildView('bottomRegion', saveView);
});

View File

@ -6,9 +6,8 @@ define([
'backbone.marionette',
'backbone.supermodel',
'underscore',
'jquery',
'sticky-kit'
], function (
'jquery'
], function(
App,
CommunicationComponent,
MailPoet,
@ -16,8 +15,7 @@ define([
Marionette,
SuperModel,
_,
jQuery,
StickyKit
jQuery
) {
'use strict';
@ -90,7 +88,7 @@ define([
}
}
},
initialize: function (options) {
initialize: function() {
jQuery(window)
.on('resize', this.updateHorizontalScroll.bind(this))
.on('scroll', this.updateHorizontalScroll.bind(this));
@ -266,12 +264,11 @@ define([
}).always(function () {
MailPoet.Modal.loading(false);
}).done(function(response) {
var view;
this.previewView = new Module.NewsletterPreviewView({
previewUrl: response.meta.preview_url
});
view = this.previewView.render();
this.previewView.render();
this.previewView.$el.css('height', '100%');
MailPoet.Modal.popup({
@ -324,7 +321,7 @@ define([
App.getChannel().request('save').always(function () {
CommunicationComponent.previewNewsletter(data).always(function () {
MailPoet.Modal.loading(false);
}).done(function (response) {
}).done(function() {
MailPoet.Notice.success(
MailPoet.I18n.t('newsletterPreviewSent'),
{ scroll: true }
@ -363,7 +360,7 @@ define([
}
});
App.on('before:start', function (App, options) {
App.on('before:start', function(App) {
var Application = App;
Application.registerWidget = Module.registerWidget;
Application.getWidgets = Module.getWidgets;
@ -371,8 +368,7 @@ define([
Application.getLayoutWidgets = Module.getLayoutWidgets;
});
App.on('start', function(App, options) {
var stylesModel = App.getGlobalStyles();
App.on('start', function(App) {
var sidebarView = new SidebarView();
App._appView.showChildView('sidebarRegion', sidebarView);

View File

@ -83,7 +83,7 @@ define([
this.setGlobalStyles(globalStyles);
});
App.on('start', function (App, options) {
App.on('start', function(App) {
var stylesView = new Module.StylesView({ model: App.getGlobalStyles() });
App._appView.showChildView('stylesRegion', stylesView);
});

View File

@ -10,7 +10,7 @@
/*jshint unused:false */
/*global tinymce:true */
tinymce.PluginManager.add('mailpoet_shortcodes', function(editor, url) {
tinymce.PluginManager.add('mailpoet_shortcodes', function(editor) {
var appendLabelAndClose = function(shortcode) {
editor.insertContent(shortcode);
editor.windowManager.close();

View File

@ -1,12 +1,10 @@
define([
'mailpoet',
'jquery',
'parsleyjs'
'jquery'
],
function (
MailPoet,
jQuery,
Parsley
jQuery
) {
jQuery(function ($) {
function isSameDomain(url) {
@ -20,7 +18,7 @@ function (
$('form.mailpoet_form').each(function () {
var form = $(this);
form.parsley().on('form:validated', function (parsley) {
form.parsley().on('form:validated', function() {
// clear messages
form.find('.mailpoet_message > p').hide();

View File

@ -51,7 +51,7 @@ define(
jQuery('#mailpoet_sending_method_setup').fadeIn();
}
},
tabs: function (tabStr, section) {
tabs: function(tabStr) {
// set default tab
var tab = tabStr || 'mta';

View File

@ -3,15 +3,13 @@ define(
'underscore',
'jquery',
'mailpoet',
'handlebars',
'select2'
'handlebars'
],
function (
_,
jQuery,
MailPoet,
Handlebars,
select2
Handlebars
) {
if (!jQuery('#mailpoet_subscribers_export').length) {
return;
@ -158,7 +156,7 @@ define(
segments: (window.exportData.segments) ? segmentsContainerElement.val() : false,
subscriber_fields: subscriberFieldsContainerElement.val()
})
}).always(function (response) {
}).always(function() {
MailPoet.Modal.loading(false);
}).done(function (response) {
var resultMessage = MailPoet.I18n.t('exportMessage')

View File

@ -7,8 +7,7 @@ define(
'handlebars',
'papaparse',
'asyncqueue',
'moment',
'select2'
'moment'
],
function (
Backbone,
@ -18,8 +17,7 @@ define(
Handlebars,
Papa,
AsyncQueue,
Moment,
select2
Moment
) {
if (!jQuery('#mailpoet_subscribers_import').length) {
return;
@ -64,7 +62,7 @@ define(
var uploadElement;
var uploadProcessButtonElement;
// set or reset temporary validation rule on all columns
window.mailpoetColumns = jQuery.map(window.mailpoetColumns, function (column, columnIndex) {
window.mailpoetColumns = jQuery.map(window.mailpoetColumns, function (column) {
var col = column;
col.validation_rule = false;
return col;
@ -245,7 +243,7 @@ define(
api_key: mailChimpKeyInputElement.val(),
lists: mailChimpListsContainerElement.find('select').val()
}
}).always(function (response) {
}).always(function() {
MailPoet.Modal.loading(false);
}).done(function (response) {
window.importData.step1 = response.data;
@ -771,7 +769,7 @@ define(
title: MailPoet.I18n.t('addNewField'),
template: jQuery('#form_template_field_form').html()
});
jQuery('#form_field_new').parsley().on('form:submit', function (parsley) {
jQuery('#form_field_new').parsley().on('form:submit', function() {
// get data
var data = jQuery(this.$element).serializeObject();
@ -874,7 +872,7 @@ define(
return { id: columnId, index: elementIndex, validationRule: validationRule, element: element };
});
// iterate through the object of mailpoet columns
jQuery.map(window.mailpoetColumns, function (column, columnIndex) {
jQuery.map(window.mailpoetColumns, function (column) {
var firstRowData;
var validationRule;
var testedFormat;