build/modules/interactivity-router
full-page.js
1.3 KB
8 months ago
full-page.js.map
2.6 KB
10 months ago
full-page.min.asset.php
188 B
8 months ago
full-page.min.js
826 B
10 months ago
full-page.min.js.map
2.6 KB
10 months ago
index.js
43.4 KB
5 months ago
index.js.map
90.3 KB
5 months ago
index.min.asset.php
237 B
5 months ago
index.min.js
25.1 KB
5 months ago
index.min.js.map
93.7 KB
5 months ago
full-page.js in Gutenberg 23.2.0, at build/modules/interactivity-router/full-page.js
| 1 | // packages/interactivity-router/build-module/full-page.mjs |
| 2 | var isValidLink = (ref) => ref && ref instanceof window.HTMLAnchorElement && ref.href && (!ref.target || ref.target === "_self") && ref.origin === window.location.origin && !ref.pathname.startsWith("/wp-admin") && !ref.pathname.startsWith("/wp-login.php") && !ref.getAttribute("href").startsWith("#") && !new URL(ref.href).searchParams.has("_wpnonce"); |
| 3 | var isValidEvent = (event) => event && event.button === 0 && // Left clicks only. |
| 4 | !event.metaKey && // Open in new tab (Mac). |
| 5 | !event.ctrlKey && // Open in new tab (Windows). |
| 6 | !event.altKey && // Download. |
| 7 | !event.shiftKey && !event.defaultPrevented; |
| 8 | document.addEventListener("click", async (event) => { |
| 9 | const ref = event.target.closest("a"); |
| 10 | if (isValidLink(ref) && isValidEvent(event)) { |
| 11 | event.preventDefault(); |
| 12 | const { actions } = await import("@wordpress/interactivity-router"); |
| 13 | actions.navigate(ref.href); |
| 14 | } |
| 15 | }); |
| 16 | document.addEventListener( |
| 17 | "mouseenter", |
| 18 | async (event) => { |
| 19 | if (event.target?.nodeName === "A") { |
| 20 | const ref = event.target.closest("a"); |
| 21 | if (isValidLink(ref) && isValidEvent(event)) { |
| 22 | const { actions } = await import("@wordpress/interactivity-router"); |
| 23 | actions.prefetch(ref.href); |
| 24 | } |
| 25 | } |
| 26 | }, |
| 27 | true |
| 28 | ); |
| 29 | //# sourceMappingURL=full-page.js.map |
| 30 |