diff --git a/index.html b/index.html
index 20a8cfd..b58d0be 100644
--- a/index.html
+++ b/index.html
@@ -2,14 +2,375 @@
- Title
-
+
+ Mie - Steam Game
+
+
+
+
+
+
-
+ try {
+ const response = await fetch('https://mie.awww.workers.dev/subscribe', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ email: emailValue,
+ "h-captcha-response": hcaptchaResponse
+ })
+ });
+
+ const data = await response.text();
+
+ // Hide loading overlay
+ //QTModal.hide()
+
+ // Show response
+ alert(data);
+
+ // Clear the email input and reset hCaptcha on success
+ if (response.ok) {
+ emailInput.value = '';
+ if (window.hcaptcha && window.hcaptcha.reset) {
+ window.hcaptcha.reset(this.querySelector('.h-captcha'));
+ }
+ }
+
+ } catch (error) {
+ // Hide loading overlay
+ loadingOverlay.style.display = 'none';
+
+ // Show error
+ alert(error.message || JSON.stringify(error));
+ console.error('Error:', error);
+ }
+ });
+
diff --git a/index.js b/index.js
index 90693f2..25957a9 100644
--- a/index.js
+++ b/index.js
@@ -2,7 +2,7 @@ const $ = (selector) =>
{
const el = document.querySelector(selector)
el.render = (html) => el.innerHTML = html
- el.inject = (html) => el.insertAdjacentHTML('beforeend', html)
+ el.ontop = (html) => el.insertAdjacentHTML('beforebegin', html)
return el;
};
@@ -13,6 +13,6 @@ var QTModal = {
Loading...
`,
- show: () => $(`body`).inject(QTModal.html),
+ show: () => $(`body`).ontop(QTModal.html),
hide: () => $('#qtmodal')?.remove()
}
diff --git a/package.json b/package.json
index 16fa7ad..81476b3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "qtmodal",
- "version": "0.2.0",
+ "version": "0.3.0",
"description": "",
"main": "index.js",
"type": "module",