ES5 space-before-function-parens

This commit is contained in:
Amine Ben hammou
2017-09-21 08:35:12 +00:00
parent bf1d76a3a7
commit 680446b77e
52 changed files with 871 additions and 872 deletions

View File

@@ -3,24 +3,24 @@ define([
'jquery',
'parsleyjs'
],
function(
function (
MailPoet,
jQuery,
Parsley
) {
jQuery(function($) {
jQuery(function ($) {
function isSameDomain(url) {
var link = document.createElement('a');
link.href = url;
return (window.location.hostname === link.hostname);
}
$(function() {
$(function () {
// setup form validation
$('form.mailpoet_form').each(function() {
$('form.mailpoet_form').each(function () {
var form = $(this);
form.parsley().on('form:validated', function(parsley) {
form.parsley().on('form:validated', function (parsley) {
// clear messages
form.find('.mailpoet_message > p').hide();
@@ -30,7 +30,7 @@ function(
}
});
form.parsley().on('form:submit', function(parsley) {
form.parsley().on('form:submit', function (parsley) {
var form_data = form.serializeObject() || {};
// check if we're on the same domain
if(isSameDomain(window.MailPoetForm.ajax_url) === false) {
@@ -45,13 +45,13 @@ function(
endpoint: 'subscribers',
action: 'subscribe',
data: form_data.data
}).fail(function(response) {
}).fail(function (response) {
form.find('.mailpoet_validate_error').html(
response.errors.map(function(error) {
response.errors.map(function (error) {
return error.message;
}).join('<br />')
).show();
}).done(function(response) {
}).done(function (response) {
// successfully subscribed
if (
response.meta !== undefined