From 3facf065684086eeda338b3e3397a2c168d3eea9 Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 18 Feb 2022 12:51:32 +0100 Subject: [PATCH] handle undert twelve --- ReadMe.md | 5 +++ email.php | 5 ++- images/Brauthaus.jpg | 4 +-- images/Draga.png | 4 +-- images/Fotoshooting.JPG | 4 +-- images/Julian.png | 4 +-- images/Kirche.png | 4 +-- images/LetsDance.JPG | 4 +-- images/catering.jpg | 4 +-- index.html | 14 ++++----- js/main.js | 70 ++++++++++++++++++++++++++++++++--------- 11 files changed, 83 insertions(+), 39 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 6747b6b..ebf2553 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -6,6 +6,11 @@ npx http-server +# Run php.exe test server: + +C:\Users\gulum\OneDrive\Desktop\php\php.exe -S localhost:8000 + + Thanks for downloading this theme! ## Other Useful Links diff --git a/email.php b/email.php index 54ae74f..686db3b 100644 --- a/email.php +++ b/email.php @@ -1,7 +1,6 @@ \ No newline at end of file +?> \ No newline at end of file diff --git a/images/Brauthaus.jpg b/images/Brauthaus.jpg index bf89e80..415fd13 100644 --- a/images/Brauthaus.jpg +++ b/images/Brauthaus.jpg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b36505be866c271ca1c559b3bcb4b739bfb6d9ba55d92267a439ae7f64007cc -size 166777 +oid sha256:21005fed52833c74bc205a1612a927a2f67cea0d0b6435084ab472432eaa4bc9 +size 30135 diff --git a/images/Draga.png b/images/Draga.png index 099ad33..509aca5 100644 --- a/images/Draga.png +++ b/images/Draga.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:27cf963c9543c1029ea236adffa1127389ef6c4067a8d3869396d12b02a1402a -size 2750814 +oid sha256:f5fda47e0ccf211d96b6f6dbdd8d8ef4d784df45881d6c544e33e9565ff08d43 +size 84998 diff --git a/images/Fotoshooting.JPG b/images/Fotoshooting.JPG index 816d282..5518d34 100644 --- a/images/Fotoshooting.JPG +++ b/images/Fotoshooting.JPG @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a8a8bb3109d6c6b1661e5b3307de5639d3bf37a1855a1971e4a0393c0de7e31a -size 6160384 +oid sha256:9d9a8996cfa3b977864ec03cbbeb15eea11e02309d5b08b01b90a8cbabbf63d2 +size 129691 diff --git a/images/Julian.png b/images/Julian.png index 5a83c5f..c0cfd09 100644 --- a/images/Julian.png +++ b/images/Julian.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e5ac99afd944feca3ad4e0afe44aa37ada74cb195346a97c3cb742c3d1445778 -size 4955034 +oid sha256:0e0cc51b6328260f5d07ff5a5b19902026c9f62ff7cf3e5c360d1730b60de7cd +size 88128 diff --git a/images/Kirche.png b/images/Kirche.png index a368a96..1a164d7 100644 --- a/images/Kirche.png +++ b/images/Kirche.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9a0093d36ccb374f6b6623149b010431aa665102301c86aa4a24f25fdc6d84d -size 22588999 +oid sha256:da0e37f88022403babab49047d8c3de3d27ab71b957b5d078fdded1cbede8e0f +size 90542 diff --git a/images/LetsDance.JPG b/images/LetsDance.JPG index 9be80c8..0abe96e 100644 --- a/images/LetsDance.JPG +++ b/images/LetsDance.JPG @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bc0c8d49ba678d4e612a13982fa25784e072ccf19d2ba0400e5909b53903eb06 -size 3779484 +oid sha256:026c5f7c9a42e7f39ce6da62961ad2fb3643947ad1ad955486cf17b824087dd9 +size 120736 diff --git a/images/catering.jpg b/images/catering.jpg index 52e7b1f..b9aef00 100644 --- a/images/catering.jpg +++ b/images/catering.jpg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a17783cd672fc3094a084c2e4cfbb503af4418f51e1c69c6abcdc98d041830b -size 227345 +oid sha256:99ddad5898375320e3849360263974df463403636b4af34ea7f2ed4f930076f4 +size 29797 diff --git a/index.html b/index.html index 609b3be..5f155b6 100644 --- a/index.html +++ b/index.html @@ -105,20 +105,20 @@
- groom + groom
-

Julian Nießner

+

Drazena Rimac

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove

- groom + groom
-

Drazena Rimac

+

Julian Nießner

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove

@@ -135,18 +135,18 @@
- +
- +
- +
diff --git a/js/main.js b/js/main.js index c94ddac..52f56c9 100644 --- a/js/main.js +++ b/js/main.js @@ -371,17 +371,59 @@ }()); -document.getElementById("finalSubmit").addEventListener("click", async function () { - var form = document.getElementById("attendForm"); - const formattedFormData = new FormData(form); - //formattedFormData.append('property', 'value'); - const response = await fetch('email.php',{ - method: 'POST', - body: formattedFormData - }); - const data = await response.text(); - //This should later print out the values submitted through the form - console.log(data); +document.getElementById("js-submitbtn").addEventListener("click", async function () { + event.preventDefault(); + + let inputs = document.querySelectorAll('.js-form-input'); + + console.log(inputs); + let from = inputs[0].value; + let message = inputs[1].value; + + if(StringLengthLT2(from)) + { + SubmitError("Name too short!"); + return; + } + + if(StringLengthLT2(message)) + { + SubmitError("message too short!"); + return; + } + + let contact = { + from: from, + email: "none", + message: message, + }; + + const response = await fetch("https://rismer.de:9999/contact", { + method: 'POST', // *GET, POST, PUT, DELETE, etc. + mode: 'cors', // no-cors, *cors, same-origin + cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached + //credentials: 'same-origin', // include, *same-origin, omit + headers: { + 'Content-Type': 'application/json' + // 'Content-Type': 'application/x-www-form-urlencoded', + }, + redirect: 'follow', // manual, *follow, error + referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url + body: JSON.stringify(contact) // body data type must match "Content-Type" header + }).catch(function (timeout) { SubmitError("API error. Call the phone number."); }); + + console.log("Request: " + JSON.stringify(contact)); + + if(response.ok) + { + let jsonResponse = await response.json(); + console.log("Response: " + jsonResponse); + SubmitSuccess(); + } + else + { + SubmitError(); + } }); // document.getElementById("js-submitbtn").addEventListener("click", async function () { @@ -527,8 +569,8 @@ document.getElementById("finalSubmit").addEventListener("click", async function } async function SubmitSuccess() { - let title = 'Teilgenommen'; - let text = "Wir freuen uns auf euch!"; + let title = 'Rückgemeldet'; + let text = "Nun gibt es kein zurück mehr!"; title = await translator.getTranslationByKey(document.documentElement.lang,"success_title"); text = await translator.getTranslationByKey(document.documentElement.lang,"success_text"); @@ -543,8 +585,6 @@ document.getElementById("finalSubmit").addEventListener("click", async function //document.querySelector('#myfrm').submit(); // manully submit }).catch(function (timeout) { }); - document.getElementById("attentant-container").remove(); - document.getElementById("overnight-div").remove(); document.getElementById("js-submitbtn").disabled = 'true'; document.getElementById("js-submitbtn").textContent = await translator.getTranslationByKey(document.documentElement.lang,"already_participating"); return;