PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 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 All 506 releases
← All changes | modules/subscriptions/subscribe-overlay/subscribe-overlay.js +17 -4 13.8.3 → 16.3-a.5 View file →
@@ -2,12 +2,27 @@
2 2
3 3 domReady( function () {
4 4 const overlay = document.querySelector( '.jetpack-subscribe-overlay' );
5 5 const overlayDismissedCookie = 'jetpack_post_subscribe_overlay_dismissed';
6 + const skipUrlParam = 'jetpack_skip_subscription_popup';
6 7 const hasOverlayDismissedCookie =
7 8 document.cookie && document.cookie.indexOf( overlayDismissedCookie ) > -1;
8 9
9 - if ( ! overlay || hasOverlayDismissedCookie ) {
10 + // Subscriber ended up here e.g. from emails:
11 + // we won't show the overlay to them in future since they most likely are already a subscriber.
12 + function skipOverlay() {
13 + const url = new URL( window.location.href );
14 + if ( url.searchParams.has( skipUrlParam ) ) {
15 + url.searchParams.delete( skipUrlParam );
16 + window.history.replaceState( {}, '', url );
17 + setOverlayDismissedCookie();
18 + return true;
19 + }
20 +
21 + return false;
22 + }
23 +
24 + if ( ! overlay || hasOverlayDismissedCookie || skipOverlay() ) {
10 25 return;
11 26 }
12 27
13 28 const close = overlay.querySelector( '.jetpack-subscribe-overlay__close' );
@@ -50,11 +65,9 @@
50 65 window.removeEventListener( 'keydown', closeOverlayOnEscapeKeydown );
51 66 }
52 67
53 68 function setOverlayDismissedCookie() {
54 - // Expires in 7 days
55 - const expires = new Date( Date.now() + 7 * 86400 * 1000 ).toUTCString();
56 - document.cookie = `${ overlayDismissedCookie }=true; expires=${ expires }; path=/;`;
69 + document.cookie = `${ overlayDismissedCookie }=true; path=/;`;
57 70 }
58 71
59 72 openOverlay();
60 73 } );