PageSourceSearch

https://veganbunnyelle.com/wp-content/plugins/jetpack/modules/subs…/subscribe-overlay.js?m=1729576758

js veganbunnyelle.com collected 2026-10-05 18:22:59 UTC 2,260 bytes, 73 lines download raw bytes

1const { domReady } = wp;
2
3domReady( function () {
4	const overlay = document.querySelector( '.jetpack-subscribe-overlay' );
5	const overlayDismissedCookie = 'jetpack_post_subscribe_overlay_dismissed';
6	const skipUrlParam = 'jetpack_skip_subscription_popup';
7	const hasOverlayDismissedCookie =
8		document.cookie && document.cookie.indexOf( overlayDismissedCookie ) > -1;
9
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() ) {
25		return;
26	}
27
28	const close = overlay.querySelector( '.jetpack-subscribe-overlay__close' );
29	close.onclick = function ( event ) {
30		event.preventDefault();
31		closeOverlay();
32	};
33
34	const toContent = overlay.querySelector( '.jetpack-subscribe-overlay__to-content' );
35	// User can edit overlay, and could remove to content link.
36	if ( toContent ) {
37		toContent.onclick = function ( event ) {
38			event.preventDefault();
39			closeOverlay();
40		};
41	}
42
43	// When the form is submitted, and next modal loads, it'll fire "subscription-modal-loaded" signalling that this form can be hidden.
44	const form = overlay.querySelector( 'form' );
45	if ( form ) {
46		form.addEventListener( 'subscription-modal-loaded', closeOverlay );
47	}
48
49	function closeOverlayOnEscapeKeydown( event ) {
50		if ( event.key === 'Escape' ) {
51			closeOverlay();
52		}
53	}
54
55	function openOverlay() {
56		overlay.classList.add( 'open' );
57		document.body.classList.add( 'jetpack-subscribe-overlay-open' );
58		setOverlayDismissedCookie();
59		window.addEventListener( 'keydown', closeOverlayOnEscapeKeydown );
60	}
61
62	function closeOverlay() {
63		overlay.classList.remove( 'open' );
64		document.body.classList.remove( 'jetpack-subscribe-overlay-open' );
65		window.removeEventListener( 'keydown', closeOverlayOnEscapeKeydown );
66	}
67
68	function setOverlayDismissedCookie() {
69		document.cookie = `${ overlayDismissedCookie }=true; path=/;`;
70	}
71
72	openOverlay();
73} );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.