mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-22 11:03:43 +03:00
Fix lint issues
This commit is contained in:
parent
2a66f3f870
commit
3133f0896a
|
@ -25,7 +25,7 @@ jQuery( document ).ready( function( $ ) {
|
||||||
return {
|
return {
|
||||||
top: bounds.y + offsetTop + bounds.height,
|
top: bounds.y + offsetTop + bounds.height,
|
||||||
left: bounds.x + offsetLeft + bounds.width - modalWidth,
|
left: bounds.x + offsetLeft + bounds.width - modalWidth,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,15 +34,14 @@ jQuery( document ).ready( function( $ ) {
|
||||||
function openModal() {
|
function openModal() {
|
||||||
const position = getModalPosition();
|
const position = getModalPosition();
|
||||||
// Hide other content on this page while modal is open.
|
// Hide other content on this page while modal is open.
|
||||||
for ( i = 0; i < children.length; i++ ) {
|
for ( let i = 0; i < children.length; i++ ) {
|
||||||
if ( children[i].hasAttribute('data-no-inert') ) {
|
if ( children[ i ].hasAttribute( 'data-no-inert' ) ) {
|
||||||
console.log( 'no inert' );
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( children[i].getAttribute('inert') ) {
|
if ( children[ i ].getAttribute( 'inert' ) ) {
|
||||||
children[i].setAttribute('data-keep-inert', '');
|
children[ i ].setAttribute( 'data-keep-inert', '' );
|
||||||
} else {
|
} else {
|
||||||
children[i].setAttribute('inert', 'true');
|
children[ i ].setAttribute( 'inert', 'true' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,12 +57,12 @@ jQuery( document ).ready( function( $ ) {
|
||||||
*/
|
*/
|
||||||
function closeModal() {
|
function closeModal() {
|
||||||
// Reveal content again.
|
// Reveal content again.
|
||||||
for ( i = 0; i < children.length; i++ ) {
|
for ( let i = 0; i < children.length; i++ ) {
|
||||||
if ( !children[i].hasAttribute('data-keep-inert') ) {
|
if ( ! children[ i ].hasAttribute( 'data-keep-inert' ) ) {
|
||||||
children[i].removeAttribute('inert');
|
children[ i ].removeAttribute( 'inert' );
|
||||||
}
|
}
|
||||||
|
|
||||||
children[i].removeAttribute('data-keep-inert');
|
children[ i ].removeAttribute( 'data-keep-inert' );
|
||||||
}
|
}
|
||||||
|
|
||||||
modal.hidden = true;
|
modal.hidden = true;
|
||||||
|
@ -76,33 +75,33 @@ jQuery( document ).ready( function( $ ) {
|
||||||
} else {
|
} else {
|
||||||
document.body.focus();
|
document.body.focus();
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendRequest( event ) {
|
function sendRequest( event ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const email = $( event.target.querySelector('input[type="email"]') ).val();
|
const email = $( event.target.querySelector( 'input[type="email"]' ) ).val();
|
||||||
$( event.target.querySelector('.message') ).html( '' );
|
$( event.target.querySelector( '.message' ) ).html( '' );
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: FiveForTheFuture.ajaxurl,
|
url: FiveForTheFuture.ajaxurl,
|
||||||
data: {
|
data: {
|
||||||
action: 'send-manage-email',
|
action: 'send-manage-email',
|
||||||
pledge_id: FiveForTheFuture.pledgeId,
|
pledge_id: FiveForTheFuture.pledgeId,
|
||||||
email: email,
|
email,
|
||||||
_ajax_nonce: FiveForTheFuture.ajaxNonce,
|
_ajax_nonce: FiveForTheFuture.ajaxNonce,
|
||||||
},
|
},
|
||||||
success: function( response ) {
|
success( response ) {
|
||||||
if ( response.message ) {
|
if ( response.message ) {
|
||||||
const $message = $( '<div>' )
|
const $message = $( '<div>' )
|
||||||
.addClass( 'notice notice-alt' )
|
.addClass( 'notice notice-alt' )
|
||||||
.addClass( response.success ? 'notice-success' : 'notice-error' )
|
.addClass( response.success ? 'notice-success' : 'notice-error' )
|
||||||
.append( $( '<p>' ).html( response.message ) );
|
.append( $( '<p>' ).html( response.message ) );
|
||||||
|
|
||||||
$( event.target.querySelector('.message') ).html( $message );
|
$( event.target.querySelector( '.message' ) ).html( $message );
|
||||||
|
|
||||||
if ( response.success ) {
|
if ( response.success ) {
|
||||||
$( event.target.querySelector('input[type="submit"]') ).remove();
|
$( event.target.querySelector( 'input[type="submit"]' ) ).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -131,6 +130,3 @@ jQuery( document ).ready( function( $ ) {
|
||||||
|
|
||||||
$( modal.querySelector( 'form' ) ).submit( sendRequest );
|
$( modal.querySelector( 'form' ) ).submit( sendRequest );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue