Fix ESLint linebreak-style ES5
[MAILPOET-1031]
This commit is contained in:
@@ -77,7 +77,6 @@
|
|||||||
"keyword-spacing": 0,
|
"keyword-spacing": 0,
|
||||||
"eol-last": 0,
|
"eol-last": 0,
|
||||||
"dot-notation": 0,
|
"dot-notation": 0,
|
||||||
"linebreak-style": 0,
|
|
||||||
"indent": 0,
|
"indent": 0,
|
||||||
"prefer-template": 0,
|
"prefer-template": 0,
|
||||||
"func-names": 0
|
"func-names": 0
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
define('admin', [
|
define('admin', [
|
||||||
'jquery'
|
'jquery'
|
||||||
],
|
],
|
||||||
function(jQuery) {
|
function(jQuery) {
|
||||||
jQuery(function($) {
|
jQuery(function($) {
|
||||||
// dom ready
|
// dom ready
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@@ -1,87 +1,87 @@
|
|||||||
define([
|
define([
|
||||||
'mailpoet',
|
'mailpoet',
|
||||||
'jquery',
|
'jquery',
|
||||||
'parsleyjs'
|
'parsleyjs'
|
||||||
],
|
],
|
||||||
function(
|
function(
|
||||||
MailPoet,
|
MailPoet,
|
||||||
jQuery,
|
jQuery,
|
||||||
Parsley
|
Parsley
|
||||||
) {
|
) {
|
||||||
jQuery(function($) {
|
jQuery(function($) {
|
||||||
function isSameDomain(url) {
|
function isSameDomain(url) {
|
||||||
var link = document.createElement('a');
|
var link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
return (window.location.hostname === link.hostname);
|
return (window.location.hostname === link.hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
// setup form validation
|
// setup form validation
|
||||||
$('form.mailpoet_form').each(function() {
|
$('form.mailpoet_form').each(function() {
|
||||||
var form = $(this);
|
var form = $(this);
|
||||||
|
|
||||||
form.parsley().on('form:validated', function(parsley) {
|
form.parsley().on('form:validated', function(parsley) {
|
||||||
// clear messages
|
// clear messages
|
||||||
form.find('.mailpoet_message > p').hide();
|
form.find('.mailpoet_message > p').hide();
|
||||||
|
|
||||||
// resize iframe
|
// resize iframe
|
||||||
if(window.frameElement !== null) {
|
if(window.frameElement !== null) {
|
||||||
MailPoet.Iframe.autoSize(window.frameElement);
|
MailPoet.Iframe.autoSize(window.frameElement);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
form.parsley().on('form:submit', function(parsley) {
|
form.parsley().on('form:submit', function(parsley) {
|
||||||
var form_data = form.serializeObject() || {};
|
var form_data = form.serializeObject() || {};
|
||||||
// check if we're on the same domain
|
// check if we're on the same domain
|
||||||
if(isSameDomain(MailPoetForm.ajax_url) === false) {
|
if(isSameDomain(MailPoetForm.ajax_url) === false) {
|
||||||
// non ajax post request
|
// non ajax post request
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// ajax request
|
// ajax request
|
||||||
MailPoet.Ajax.post({
|
MailPoet.Ajax.post({
|
||||||
url: MailPoetForm.ajax_url,
|
url: MailPoetForm.ajax_url,
|
||||||
token: form_data.token,
|
token: form_data.token,
|
||||||
api_version: form_data.api_version,
|
api_version: form_data.api_version,
|
||||||
endpoint: 'subscribers',
|
endpoint: 'subscribers',
|
||||||
action: 'subscribe',
|
action: 'subscribe',
|
||||||
data: form_data.data
|
data: form_data.data
|
||||||
}).fail(function(response) {
|
}).fail(function(response) {
|
||||||
form.find('.mailpoet_validate_error').html(
|
form.find('.mailpoet_validate_error').html(
|
||||||
response.errors.map(function(error) {
|
response.errors.map(function(error) {
|
||||||
return error.message;
|
return error.message;
|
||||||
}).join('<br />')
|
}).join('<br />')
|
||||||
).show();
|
).show();
|
||||||
}).done(function(response) {
|
}).done(function(response) {
|
||||||
// successfully subscribed
|
// successfully subscribed
|
||||||
if (
|
if (
|
||||||
response.meta !== undefined
|
response.meta !== undefined
|
||||||
&& response.meta.redirect_url !== undefined
|
&& response.meta.redirect_url !== undefined
|
||||||
) {
|
) {
|
||||||
// go to page
|
// go to page
|
||||||
window.location.href = response.meta.redirect_url;
|
window.location.href = response.meta.redirect_url;
|
||||||
} else {
|
} else {
|
||||||
// display success message
|
// display success message
|
||||||
form.find('.mailpoet_validate_success').show();
|
form.find('.mailpoet_validate_success').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset form
|
// reset form
|
||||||
form.trigger('reset');
|
form.trigger('reset');
|
||||||
// reset validation
|
// reset validation
|
||||||
parsley.reset();
|
parsley.reset();
|
||||||
|
|
||||||
// resize iframe
|
// resize iframe
|
||||||
if (
|
if (
|
||||||
window.frameElement !== null
|
window.frameElement !== null
|
||||||
&& MailPoet !== undefined
|
&& MailPoet !== undefined
|
||||||
&& MailPoet['Iframe']
|
&& MailPoet['Iframe']
|
||||||
) {
|
) {
|
||||||
MailPoet.Iframe.autoSize(window.frameElement);
|
MailPoet.Iframe.autoSize(window.frameElement);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
Reference in New Issue
Block a user