x with bypass validation
This commit is contained in:
parent
93f4d0df28
commit
3e1b075534
3 changed files with 96 additions and 18 deletions
71
index.html
71
index.html
|
|
@ -173,22 +173,6 @@
|
|||
border-color: var(--off-neon);
|
||||
}
|
||||
95.51% {
|
||||
box-shadow: var(--neon-shadow);
|
||||
border-color: var(--primary-neon);
|
||||
}
|
||||
96% {
|
||||
box-shadow: var(--neon-shadow);
|
||||
border-color: var(--primary-neon);
|
||||
}
|
||||
96.01% {
|
||||
box-shadow: none;
|
||||
border-color: var(--off-neon);
|
||||
}
|
||||
96.5% {
|
||||
box-shadow: none;
|
||||
border-color: var(--off-neon);
|
||||
}
|
||||
96.51% {
|
||||
box-shadow: var(--neon-shadow-bright);
|
||||
border-color: var(--primary-neon);
|
||||
}
|
||||
|
|
@ -279,6 +263,10 @@
|
|||
<h1 class="text-2xl font-bold text-center mb-4">Instinct</h1>
|
||||
<input type="email" id="email" placeholder="Enter your email" required>
|
||||
<button class="btn-place" onclick="navigateTo('page2')">Enter</button>
|
||||
<!-- Toggle for validation bypass -->
|
||||
<label>
|
||||
<input type="checkbox" id="bypassValidation" /> Bypass validation for testing
|
||||
</label>
|
||||
</div>
|
||||
<!-- Page 2: User Info -->
|
||||
<div id="page2" class="page">
|
||||
|
|
@ -323,7 +311,7 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
const WORKER_URL = 'https://example-worker.example.workers.dev/user'; // Replace with your worker URL
|
||||
const WORKER_URL = 'https://instinct-api.starfiles.workers.dev/user'; // Replace with your worker URL
|
||||
|
||||
async function navigateTo(pageId) {
|
||||
document.querySelectorAll('.page').forEach(page => {
|
||||
|
|
@ -331,7 +319,9 @@
|
|||
});
|
||||
document.getElementById(pageId).classList.add('active');
|
||||
if (pageId === 'page2') {
|
||||
await fetchUserData();
|
||||
if (!document.getElementById('bypassValidation').checked) {
|
||||
await fetchUserData();
|
||||
}
|
||||
} else if (pageId === 'page4') {
|
||||
startCountdown(5);
|
||||
}
|
||||
|
|
@ -393,6 +383,11 @@
|
|||
}
|
||||
|
||||
async function saveUserData() {
|
||||
if (document.getElementById('bypassValidation').checked) {
|
||||
navigateTo('page3'); // Skip validation and navigate to next page
|
||||
return;
|
||||
}
|
||||
|
||||
const userData = {
|
||||
email: document.getElementById('email').value,
|
||||
name: document.getElementById('name').value,
|
||||
|
|
@ -417,6 +412,46 @@
|
|||
function bet(option) {
|
||||
console.log('Bet on:', option);
|
||||
}
|
||||
|
||||
// Add to Home Screen Prompt
|
||||
let deferredPrompt;
|
||||
window.addEventListener('beforeinstallprompt', (e) => {
|
||||
e.preventDefault();
|
||||
deferredPrompt = e;
|
||||
showInstallPromotion();
|
||||
});
|
||||
|
||||
function showInstallPromotion() {
|
||||
const installBtn = document.createElement('button');
|
||||
installBtn.textContent = 'Add to Home Screen';
|
||||
installBtn.className = 'install-btn';
|
||||
document.body.appendChild(installBtn);
|
||||
|
||||
installBtn.addEventListener('click', () => {
|
||||
installBtn.style.display = 'none';
|
||||
deferredPrompt.prompt();
|
||||
deferredPrompt.userChoice.then((choiceResult) => {
|
||||
if (choiceResult.outcome === 'accepted') {
|
||||
console.log('User accepted the A2HS prompt');
|
||||
} else {
|
||||
console.log('User dismissed the A2HS prompt');
|
||||
}
|
||||
deferredPrompt = null;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Service Worker Registration
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/service-worker.js').then((registration) => {
|
||||
console.log('Service Worker registered with scope:', registration.scope);
|
||||
}, (err) => {
|
||||
console.log('Service Worker registration failed:', err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
21
manifest.json
Normal file
21
manifest.json
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "Instinct App",
|
||||
"short_name": "Instinct",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#000000",
|
||||
"theme_color": "#000000",
|
||||
"description": "An instinct-driven app",
|
||||
"icons": [
|
||||
{
|
||||
"src": "icon.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icon.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
]
|
||||
}
|
||||
22
service-worker.js
Normal file
22
service-worker.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(
|
||||
caches.open('instinct-app-cache').then((cache) => {
|
||||
return cache.addAll([
|
||||
'/',
|
||||
'/index.html',
|
||||
'/styles.css',
|
||||
'/script.js',
|
||||
'/icon.png',
|
||||
'/manifest.json',
|
||||
]);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
event.respondWith(
|
||||
caches.match(event.request).then((response) => {
|
||||
return response || fetch(event.request);
|
||||
})
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue