ES5 space-infix-ops

This commit is contained in:
Amine Ben hammou
2017-09-21 09:09:29 +00:00
parent 28504fb5e3
commit b1a403d9b5
8 changed files with 50 additions and 51 deletions

View File

@ -56,7 +56,6 @@
"strict": 0,
"vars-on-top": 0,
"no-var": 0,
"space-infix-ops": 0,
"no-unused-vars": 0,
"object-shorthand": 0,
"new-parens": 0,

View File

@ -148,7 +148,7 @@ define('date',
for(var index = 0, token = ''; format.charAt(index); index += 1) {
token = format.charAt(index);
if (escapeToken === true) {
convertedFormat.push('['+token+']');
convertedFormat.push('[' + token + ']');
escapeToken = false;
} else {
if (token === '\\') {
@ -158,7 +158,7 @@ define('date',
} else if (replacements[token] !== undefined) {
convertedFormat.push(replacements[token]);
} else {
convertedFormat.push('['+token+']');
convertedFormat.push('[' + token + ']');
}
}
}

View File

@ -76,7 +76,7 @@ define(
for (; i <= keys_last; i++) {
key = keys[i] === '' ? cur.length : keys[i];
cur[key] = i < keys_last
? cur[key] || (keys[i+1] && isNaN(keys[i+1]) ? {} : [])
? cur[key] || (keys[i + 1] && isNaN(keys[i + 1]) ? {} : [])
: val;
cur = cur[key];
}

View File

@ -79,30 +79,30 @@ define('modal', ['mailpoet', 'jquery'],
options: {},
templates: {
overlay: '<div id="mailpoet_modal_overlay" style="display:none;"></div>',
popup: '<div id="mailpoet_popup" tabindex="-1">'+
'<div class="mailpoet_popup_wrapper">'+
'<a href="javascript:;" id="mailpoet_modal_close"></a>'+
'<div id="mailpoet_popup_title"><h2></h2></div>'+
'<div class="mailpoet_popup_body clearfix"></div>'+
'</div>'+
popup: '<div id="mailpoet_popup" tabindex="-1">' +
'<div class="mailpoet_popup_wrapper">' +
'<a href="javascript:;" id="mailpoet_modal_close"></a>' +
'<div id="mailpoet_popup_title"><h2></h2></div>' +
'<div class="mailpoet_popup_body clearfix"></div>' +
'</div>' +
'</div>',
loading: '<div id="mailpoet_loading" style="display:none;">'+
'<div id="mailpoet_modal_loading_1" class="mailpoet_modal_loading"></div>'+
'<div id="mailpoet_modal_loading_2" class="mailpoet_modal_loading"></div>'+
'<div id="mailpoet_modal_loading_3" class="mailpoet_modal_loading"></div>'+
loading: '<div id="mailpoet_loading" style="display:none;">' +
'<div id="mailpoet_modal_loading_1" class="mailpoet_modal_loading"></div>' +
'<div id="mailpoet_modal_loading_2" class="mailpoet_modal_loading"></div>' +
'<div id="mailpoet_modal_loading_3" class="mailpoet_modal_loading"></div>' +
'</div>',
panel: '<div id="mailpoet_panel">'+
'<a href="javascript:;" id="mailpoet_modal_close"></a>'+
'<div class="mailpoet_panel_wrapper" tabindex="-1">'+
'<div class="mailpoet_panel_body clearfix"></div>'+
'</div>'+
panel: '<div id="mailpoet_panel">' +
'<a href="javascript:;" id="mailpoet_modal_close"></a>' +
'<div class="mailpoet_panel_wrapper" tabindex="-1">' +
'<div class="mailpoet_panel_body clearfix"></div>' +
'</div>' +
'</div>',
subpanel: '<div class="mailpoet_panel_wrapper" tabindex="-1">'+
'<div class="mailpoet_panel_body clearfix"></div>'+
subpanel: '<div class="mailpoet_panel_wrapper" tabindex="-1">' +
'<div class="mailpoet_panel_body clearfix"></div>' +
'</div>'
},
getContentContainer: function () {
return jQuery('.mailpoet_'+this.options.type+'_body');
return jQuery('.mailpoet_' + this.options.type + '_body');
},
setRenderer: function (renderer) {
this.renderer = renderer;
@ -152,7 +152,7 @@ define('modal', ['mailpoet', 'jquery'],
// add proper overlay class
jQuery('#mailpoet_modal_overlay')
.removeClass('mailpoet_popup_overlay mailpoet_panel_overlay')
.addClass('mailpoet_'+this.options.type+'_overlay');
.addClass('mailpoet_' + this.options.type + '_overlay');
}
// set "success" callback if specified
@ -249,14 +249,14 @@ define('modal', ['mailpoet', 'jquery'],
loadTemplate: function () {
if(this.subpanels.length > 0) {
// hide panel
jQuery('.mailpoet_'+this.options.type+'_wrapper').hide();
jQuery('.mailpoet_' + this.options.type + '_wrapper').hide();
// add sub panel wrapper
jQuery('#mailpoet_'+this.options.type)
jQuery('#mailpoet_' + this.options.type)
.append(this.templates['subpanel']);
// add sub panel content
jQuery('.mailpoet_'+this.options.type+'_body').last()
jQuery('.mailpoet_' + this.options.type + '_body').last()
.html(this.subpanels[(this.subpanels.length - 1)].element);
// focus on sub panel
@ -264,11 +264,11 @@ define('modal', ['mailpoet', 'jquery'],
this.focus();
}
} else if (this.options.element) {
jQuery('.mailpoet_'+this.options.type+'_body').empty();
jQuery('.mailpoet_'+this.options.type+'_body')
jQuery('.mailpoet_' + this.options.type + '_body').empty();
jQuery('.mailpoet_' + this.options.type + '_body')
.append(this.options.element);
} else {
jQuery('.mailpoet_'+this.options.type+'_body')
jQuery('.mailpoet_' + this.options.type + '_body')
.html(
this.options.body_template(
this.options.data
@ -347,8 +347,8 @@ define('modal', ['mailpoet', 'jquery'],
case 'popup':
var screenWidth = jQuery(window).width(),
screenHeight = jQuery(window).height(),
modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(),
modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height();
modalWidth = jQuery('.mailpoet_' + this.options.type + '_wrapper').width(),
modalHeight = jQuery('.mailpoet_' + this.options.type + '_wrapper').height();
var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))),
left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2)));
@ -388,7 +388,7 @@ define('modal', ['mailpoet', 'jquery'],
jQuery('body').addClass('mailpoet_modal_opened');
// show popup
jQuery('#mailpoet_'+this.options.type).show();
jQuery('#mailpoet_' + this.options.type).show();
// display overlay
this.showOverlay();
@ -419,10 +419,10 @@ define('modal', ['mailpoet', 'jquery'],
},
focus: function () {
if(this.options.type == 'popup') {
jQuery('#mailpoet_'+this.options.type).focus();
jQuery('#mailpoet_' + this.options.type).focus();
} else {
// panel and subpanel
jQuery('#mailpoet_'+this.options.type+' .mailpoet_panel_wrapper')
jQuery('#mailpoet_' + this.options.type + ' .mailpoet_panel_wrapper')
.filter(':visible').focus();
}
return this;
@ -441,7 +441,7 @@ define('modal', ['mailpoet', 'jquery'],
this.opened = false;
// hide modal
jQuery('#mailpoet_'+this.options.type).hide();
jQuery('#mailpoet_' + this.options.type).hide();
// remove class on highlighted elements
this.highlightOff();
@ -587,8 +587,8 @@ define('modal', ['mailpoet', 'jquery'],
this.hideOverlay();
// remove extra modal
if(jQuery('#mailpoet_'+this.options.type).length > 0) {
jQuery('#mailpoet_'+this.options.type).remove();
if(jQuery('#mailpoet_' + this.options.type).length > 0) {
jQuery('#mailpoet_' + this.options.type).remove();
}
this.initialized = false;
@ -600,10 +600,10 @@ define('modal', ['mailpoet', 'jquery'],
if(this.subpanels.length > 0) {
// close subpanel
jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove();
jQuery('.mailpoet_' + this.options.type + '_wrapper').last().remove();
// show previous panel
jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show();
jQuery('.mailpoet_' + this.options.type + '_wrapper').last().show();
// remove last subpanels
this.subpanels.pop();

View File

@ -150,7 +150,7 @@ define([
// compensated for to position marker right in the middle of two
// blocks
if (dropPosition.position === 'before') {
$targetBlock = that.getChildren().findByModel(viewCollection.at(dropPosition.index-1)).$el;
$targetBlock = that.getChildren().findByModel(viewCollection.at(dropPosition.index - 1)).$el;
} else {
$targetBlock = that.getChildren().findByModel(viewCollection.at(dropPosition.index)).$el;
}

View File

@ -61,7 +61,7 @@ define([
},
templateContext: function () {
return _.extend({
totalHeight: parseInt(this.model.get('styles.block.padding'), 10)*2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px'
totalHeight: parseInt(this.model.get('styles.block.padding'), 10) * 2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px'
}, base.BlockView.prototype.templateContext.apply(this));
},
onRender: function () {
@ -75,7 +75,7 @@ define([
changePadding: function () {
this.$('.mailpoet_content').css('padding-top', this.model.get('styles.block.padding'));
this.$('.mailpoet_content').css('padding-bottom', this.model.get('styles.block.padding'));
this.$('.mailpoet_resize_handle_text').text(parseInt(this.model.get('styles.block.padding'), 10)*2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px');
this.$('.mailpoet_resize_handle_text').text(parseInt(this.model.get('styles.block.padding'), 10) * 2 + parseInt(this.model.get('styles.block.borderWidth')) + 'px');
}
});

View File

@ -48,7 +48,7 @@ define('notice', ['mailpoet', 'jquery'], function (mp, jQuery) {
},
createNotice: function () {
// clone element
this.element = jQuery('#mailpoet_notice_'+this.options.type).clone();
this.element = jQuery('#mailpoet_notice_' + this.options.type).clone();
// add data-id to the element
if (this.options.id) {
@ -68,7 +68,7 @@ define('notice', ['mailpoet', 'jquery'], function (mp, jQuery) {
} else if (typeof this.options.positionAfter === 'string') {
positionAfter = jQuery(this.options.positionAfter);
} else {
positionAfter = jQuery('#mailpoet_notice_'+this.options.type);
positionAfter = jQuery('#mailpoet_notice_' + this.options.type);
}
positionAfter.after(this.element);
@ -99,7 +99,7 @@ define('notice', ['mailpoet', 'jquery'], function (mp, jQuery) {
},
updateNotice: function () {
// update notice's message
jQuery('[data-id="'+this.options.id+'"').first().trigger(
jQuery('[data-id="' + this.options.id + '"').first().trigger(
'setMessage', this.options.message
);
},
@ -107,7 +107,7 @@ define('notice', ['mailpoet', 'jquery'], function (mp, jQuery) {
var formattedMessage = this.formatMessage(message);
// let's sugar coat the message with a fancy <p>
formattedMessage = '<p>'+formattedMessage+'</p>';
formattedMessage = '<p>' + formattedMessage + '</p>';
// set message
return this.element.html(formattedMessage);
},
@ -125,7 +125,7 @@ define('notice', ['mailpoet', 'jquery'], function (mp, jQuery) {
if (
this.options.id !== null
&&
jQuery('[data-id="'+this.options.id+'"]').length > 0
jQuery('[data-id="' + this.options.id + '"]').length > 0
) {
this.updateNotice();
} else {

View File

@ -47,7 +47,7 @@ define(
jQuery('.mailpoet_sending_methods, .mailpoet_sending_methods_help').hide();
// display selected sending method's settings
jQuery('.mailpoet_sending_method[data-group="'+ group +'"]').show();
jQuery('.mailpoet_sending_method[data-group="' + group + '"]').show();
jQuery('#mailpoet_sending_method_setup').fadeIn();
}
},
@ -62,11 +62,11 @@ define(
jQuery('.mailpoet_panel, .mailpoet_section').hide();
// set active tab
jQuery('a.nav-tab[href="#'+tab+'"]').addClass('nav-tab-active').blur();
jQuery('a.nav-tab[href="#' + tab + '"]').addClass('nav-tab-active').blur();
// show selected panel
if(jQuery('.mailpoet_panel[data-tab="'+ tab +'"]').length > 0) {
jQuery('.mailpoet_panel[data-tab="'+ tab +'"]').show();
if(jQuery('.mailpoet_panel[data-tab="' + tab + '"]').length > 0) {
jQuery('.mailpoet_panel[data-tab="' + tab + '"]').show();
}
// show "save settings" button