PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 12.4.2
Jetpack – WP Security, Backup, Speed, & Growth v12.4.2
12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 14.4.2 All 500 releases
jetpack / _inc / jetpack-connection-banner.js
jetpack-connection-banner.js
45 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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