PageSourceSearch

https://urbanstickers.gr/wp-content/themes/wp-theme-boilerplate-de…/public/js/cart/cart.js?ver=1786969901

js urbanstickers.gr collected 2026-10-10 01:52:53 UTC 1,052 bytes, 40 lines download raw bytes

1/**
2 * Cart page
3 * - coupon popup open/close
4 *
5 * Event delegation on document: WooCommerce re-renders the whole cart
6 * markup after AJAX updates (qty change, coupon apply, shipping choice),
7 * so direct element listeners would be lost.
8 */
9document.addEventListener('click', (event) => {
10	const popup = document.getElementById('any-cart-coupon');
11	if (!popup) {
12		return;
13	}
14
15	if (event.target.closest('[data-coupon-open]')) {
16		popup.classList.add('is-open');
17		popup.setAttribute('aria-hidden', 'false');
18		const input = popup.querySelector('#coupon_code');
19		if (input) {
20			input.focus();
21		}
22		return;
23	}
24
25	if (event.target.closest('[data-coupon-close]')) {
26		popup.classList.remove('is-open');
27		popup.setAttribute('aria-hidden', 'true');
28	}
29});
30
31document.addEventListener('keydown', (event) => {
32	if (event.key !== 'Escape') {
33		return;
34	}
35	const popup = document.getElementById('any-cart-coupon');
36	if (popup && popup.classList.contains('is-open')) {
37		popup.classList.remove('is-open');
38		popup.setAttribute('aria-hidden', 'true');
39	}
40});

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.