-
Notifications
You must be signed in to change notification settings - Fork 799
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:Automattic/jetpack into e2e-separ…
…ate-node-project
- Loading branch information
Showing
65 changed files
with
1,724 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
## Ignore composer.lock and vendor folders for our library packages | ||
/**/composer.lock | ||
/**/vendor/ | ||
|
||
## Test package added through unit testing. Maybe temporary. | ||
/test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
projects/plugins/jetpack/_inc/jetpack-recommendations-banner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* global jp_banner */ | ||
|
||
( function ( $ ) { | ||
var recommendationsBanner = $( '#jp-recommendations-banner-main' ); | ||
var recommendationsBannerForm = $( '#jp-recommendations-banner__form' ); | ||
var recommendationsBannerContinue = $( '#jp-recommendations-banner__continue-button' ); | ||
var recommendationsBannerDismiss = $( '#jp-recommendations-banner__notice-dismiss' ); | ||
|
||
recommendationsBannerForm.on( 'change', function ( event ) { | ||
if ( | ||
'checkbox' === event.target.type && | ||
event.target.parentElement && | ||
'label' === event.target.parentElement.tagName.toLowerCase() | ||
) { | ||
var isChecked = $( 'label.checked input[name="' + event.target.name + '"]' ).length > 0; | ||
if ( isChecked ) { | ||
event.target.parentElement.classList.remove( 'checked' ); | ||
} else { | ||
event.target.parentElement.classList.add( 'checked' ); | ||
} | ||
} | ||
} ); | ||
|
||
recommendationsBannerContinue.on( 'click', function () { | ||
var fieldNames = [ 'personal', 'business', 'store', 'other' ]; | ||
var formData = {}; | ||
fieldNames.forEach( function ( name ) { | ||
formData[ name ] = $( "input[name='" + name + "']" ).prop( 'checked' ); | ||
} ); | ||
|
||
$.post( | ||
jp_banner.ajax_url, | ||
{ | ||
action: 'jetpack_recommendations_banner', | ||
nonce: jp_banner.nonce, | ||
personal: formData.personal, | ||
business: formData.business, | ||
store: formData.store, | ||
other: formData.other, | ||
}, | ||
function ( response ) { | ||
if ( true === response.success ) { | ||
window.location.assign( jp_banner.recommendations_url ); | ||
} | ||
} | ||
); | ||
} ); | ||
|
||
recommendationsBannerDismiss.on( 'click', function () { | ||
$( recommendationsBanner ).hide(); | ||
|
||
var data = { | ||
action: 'jetpack_recommendations_banner', | ||
nonce: jp_banner.nonce, | ||
dismissBanner: true, | ||
}; | ||
|
||
$.post( jp_banner.ajax_url, data, function ( response ) { | ||
if ( true !== response.success ) { | ||
$( recommendationsBanner ).show(); | ||
} | ||
} ); | ||
} ); | ||
} )( jQuery ); |
Oops, something went wrong.