PluginProbe
Gutenberg / 23.2.0
Gutenberg v23.2.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
gutenberg / build / modules / interactivity-router / full-page.js
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

30 lines 1.3 KB Raw Download Zip
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