first commit

This commit is contained in:
Roman Pyrih
2026-05-21 15:33:11 +02:00
commit acb036dbd9
8059 changed files with 2885104 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
// packages/block-library/build-module/form/view.mjs
var formSettings;
try {
formSettings = JSON.parse(
document.getElementById(
"wp-script-module-data-@wordpress/block-library/form/view"
)?.textContent
);
} catch {
}
document.querySelectorAll("form.wp-block-form").forEach(function(form) {
if (!formSettings || !form.action || !form.action.startsWith("mailto:")) {
return;
}
const redirectNotification = (status) => {
const urlParams = new URLSearchParams(window.location.search);
urlParams.append("wp-form-result", status);
window.location.search = urlParams.toString();
};
form.addEventListener("submit", async function(event) {
event.preventDefault();
const formData = Object.fromEntries(new FormData(form).entries());
formData.formAction = form.action;
formData._ajax_nonce = formSettings.nonce;
formData.action = formSettings.action;
formData._wp_http_referer = window.location.href;
formData.formAction = form.action;
try {
const response = await fetch(formSettings.ajaxUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams(formData).toString()
});
if (response.ok) {
redirectNotification("success");
} else {
redirectNotification("error");
}
} catch (error) {
redirectNotification("error");
}
});
});

View File

@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'version' => '5542f8ad251fe43ef09e');

View File

@@ -0,0 +1 @@
var o;try{o=JSON.parse(document.getElementById("wp-script-module-data-@wordpress/block-library/form/view")?.textContent)}catch{}document.querySelectorAll("form.wp-block-form").forEach(function(e){if(!o||!e.action||!e.action.startsWith("mailto:"))return;let r=n=>{let t=new URLSearchParams(window.location.search);t.append("wp-form-result",n),window.location.search=t.toString()};e.addEventListener("submit",async function(n){n.preventDefault();let t=Object.fromEntries(new FormData(e).entries());t.formAction=e.action,t._ajax_nonce=o.nonce,t.action=o.action,t._wp_http_referer=window.location.href,t.formAction=e.action;try{(await fetch(o.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t).toString()})).ok?r("success"):r("error")}catch{r("error")}})});