From 36923832eacc220ebbe04e29601ce4d0763ccdfe Mon Sep 17 00:00:00 2001 From: curvesy Date: Fri, 17 Nov 2023 04:23:10 +0330 Subject: [PATCH 1/3] add faucet pages to footer.handlebars --- Gruntfile.js | 2 +- sitemap.xml | 6 ++++++ src/js/faucet.js | 15 +++++++++++++++ src/pages/faucet.handlebars | 26 ++++++++++++++++++++++++++ src/templates/footer.handlebars | 3 +++ 5 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 src/js/faucet.js create mode 100644 src/pages/faucet.handlebars diff --git a/Gruntfile.js b/Gruntfile.js index ac2d35f..91a15eb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -41,7 +41,7 @@ module.exports = function (grunt) { build: { files: { 'build/js/vendors.min.js': ['./node_modules/jquery/dist/jquery.min.js'], - 'build/js/bundle.min.js': ['./src/js/menu.js', './src/js/accordion.js', './src/js/mailChimp.js', './src/js/scroll.js'] + 'build/js/bundle.min.js': ['./src/js/menu.js', './src/js/accordion.js', './src/js/mailChimp.js', './src/js/faucet.js', './src/js/scroll.js'] } } }, diff --git a/sitemap.xml b/sitemap.xml index 373e4c7..4d24cfa 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -17,6 +17,12 @@ 2023-08-24 quarterly 1.1.0 + + + https://muzikie.com/faucet + 2023-08-24 + quarterly + 1.1.0 https://muzikie.com/privacy diff --git a/src/js/faucet.js b/src/js/faucet.js new file mode 100644 index 0000000..a5001d7 --- /dev/null +++ b/src/js/faucet.js @@ -0,0 +1,15 @@ +document.getElementById('faucetForm').addEventListener('submit', async function (event) { + event.preventDefault(); + + try { + const response = await fetch(this.action, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(Object.fromEntries(new FormData(this))), // Send the data as JSON + }); + } catch (error) { + console.error('Error:', error.message); + } +}); diff --git a/src/pages/faucet.handlebars b/src/pages/faucet.handlebars new file mode 100644 index 0000000..1dba901 --- /dev/null +++ b/src/pages/faucet.handlebars @@ -0,0 +1,26 @@ +{{> head title="faucet" }} +
+
+
+
+
+

All tokens are for testing purposes only

+

Please enter your address to receive 3000 LSK tokens for free +
+
+

+
+ +
+ + +
+
+
+
+
+{{> footer}} +{{> desktopNavigation}} +{{> mobileNavigation}} +{{> backToTop}} +{{> closing}} \ No newline at end of file diff --git a/src/templates/footer.handlebars b/src/templates/footer.handlebars index 30ebc53..dceb65c 100644 --- a/src/templates/footer.handlebars +++ b/src/templates/footer.handlebars @@ -15,6 +15,9 @@ + From 1443a1ed3102efe7b806419bb85aac1265ad6c36 Mon Sep 17 00:00:00 2001 From: reyraa Date: Sat, 18 Nov 2023 10:32:09 +0100 Subject: [PATCH 2/3] Add error messages to the faucet --- Gruntfile.js | 2 +- src/js/faucet.js | 17 ++++++++---- src/pages/faucet.handlebars | 52 ++++++++++++++++++++++++++----------- 3 files changed, 50 insertions(+), 21 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 91a15eb..d6987b5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -41,7 +41,7 @@ module.exports = function (grunt) { build: { files: { 'build/js/vendors.min.js': ['./node_modules/jquery/dist/jquery.min.js'], - 'build/js/bundle.min.js': ['./src/js/menu.js', './src/js/accordion.js', './src/js/mailChimp.js', './src/js/faucet.js', './src/js/scroll.js'] + 'build/js/bundle.min.js': ['./src/js/faucet.js','./src/js/menu.js', './src/js/accordion.js', './src/js/mailChimp.js', './src/js/faucet.js', './src/js/scroll.js'] } } }, diff --git a/src/js/faucet.js b/src/js/faucet.js index a5001d7..9966c22 100644 --- a/src/js/faucet.js +++ b/src/js/faucet.js @@ -1,15 +1,22 @@ -document.getElementById('faucetForm').addEventListener('submit', async function (event) { - event.preventDefault(); - +async function sendTokens (e) { + e.preventDefault(); + const formBody = JSON.stringify(Object.fromEntries(new FormData(this))); try { const response = await fetch(this.action, { method: 'POST', headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify(Object.fromEntries(new FormData(this))), // Send the data as JSON + body: formBody, // Send the data as JSON }); + const data = await response.json(); + document.getElementById('faucet-feedback').textContent = data.success ? 'Sent. Check your wallet!' : 'Something went wrong. Try again later.'; } catch (error) { - console.error('Error:', error.message); + document.getElementById('faucet-feedback').textContent = error.message; } +}; + +document.addEventListener('DOMContentLoaded', () => { + const form = document.getElementById('faucet-form'); + form.addEventListener('submit', sendTokens); }); diff --git a/src/pages/faucet.handlebars b/src/pages/faucet.handlebars index 1dba901..71474c2 100644 --- a/src/pages/faucet.handlebars +++ b/src/pages/faucet.handlebars @@ -1,21 +1,43 @@ {{> head title="faucet" }} -
+
-
-
-
-

All tokens are for testing purposes only

-

Please enter your address to receive 3000 LSK tokens for free -
-
-

-
- -
- - +
+
+
+
+

All tokens are for testing purposes only

+

+ Please enter your address to receive 50 MZK tokens for free +

- +
+
+
+
+
+
+
+ + +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
From d713c7a72c6fd38784c08400b8ec0b12e3bb5c89 Mon Sep 17 00:00:00 2001 From: reyraa Date: Sat, 18 Nov 2023 10:33:52 +0100 Subject: [PATCH 3/3] Set the transfer value --- src/pages/faucet.handlebars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/faucet.handlebars b/src/pages/faucet.handlebars index 71474c2..ed7f407 100644 --- a/src/pages/faucet.handlebars +++ b/src/pages/faucet.handlebars @@ -7,7 +7,7 @@

All tokens are for testing purposes only

- Please enter your address to receive 50 MZK tokens for free + Please enter your address to receive 10 MZK tokens for free