blocks
2 years ago
build
2 years ago
fonts
3 years ago
genericons
6 years ago
lib
2 years ago
social-logos
2 years ago
accessible-focus.js
6 years ago
blogging-prompts.php
3 years ago
class.jetpack-provision.php
2 years ago
connect-button.js
3 years ago
crowdsignal-shortcode.js
3 years ago
crowdsignal-survey.js
6 years ago
facebook-embed.js
4 years ago
gallery-settings.js
6 years ago
genericons.php
5 years ago
jetpack-admin.js
3 years ago
jetpack-connection-banner.js
3 years ago
jetpack-deactivate-dialog.js
6 years ago
jetpack-modules.js
3 years ago
jetpack-modules.models.js
3 years ago
jetpack-modules.views.js
3 years ago
jetpack-recommendations-banner.js
3 years ago
jetpack-server-sandbox.php
4 years ago
polldaddy-shortcode.js
3 years ago
social-logos.php
3 years ago
twitter-timeline.js
6 years ago
jetpack-connection-banner.js
45 lines
| 1 | /* global jp_banner */ |
| 2 | |
| 3 | ( function ( $ ) { |
| 4 | var fullScreenContainer = $( '.jp-connect-full__container' ), |
| 5 | fullScreenDismiss = $( '.jp-connect-full__dismiss, .jp-connect-full__dismiss-paragraph' ), |
| 6 | wpWelcomeNotice = $( '#welcome-panel' ), |
| 7 | connectionBanner = $( '.jp-connection-banner' ), |
| 8 | connectionBannerDismiss = $( '.jp-connection-banner__dismiss' ); |
| 9 | |
| 10 | // Move the banner below the WP Welcome notice on the dashboard |
| 11 | $( window ).on( 'load', function () { |
| 12 | wpWelcomeNotice.insertBefore( connectionBanner ); |
| 13 | } ); |
| 14 | |
| 15 | // Dismiss the connection banner via AJAX |
| 16 | connectionBannerDismiss.on( 'click', function () { |
| 17 | $( connectionBanner ).hide(); |
| 18 | |
| 19 | var data = { |
| 20 | action: 'jetpack_connection_banner', |
| 21 | nonce: jp_banner.connectionBannerNonce, |
| 22 | dismissBanner: true, |
| 23 | }; |
| 24 | |
| 25 | $.post( jp_banner.ajax_url, data, function ( response ) { |
| 26 | if ( true !== response.success ) { |
| 27 | $( connectionBanner ).show(); |
| 28 | } |
| 29 | } ); |
| 30 | } ); |
| 31 | |
| 32 | /** |
| 33 | * Full-screen connection prompt |
| 34 | */ |
| 35 | fullScreenDismiss.on( 'click', function () { |
| 36 | $( fullScreenContainer ).hide(); |
| 37 | } ); |
| 38 | |
| 39 | $( document ).keyup( function ( e ) { |
| 40 | if ( e.code === 'Escape' ) { |
| 41 | $( fullScreenDismiss ).click(); |
| 42 | } |
| 43 | } ); |
| 44 | } )( jQuery ); |
| 45 |