counter doesn't work - Follow Up Deployment
Browse files252 unmodified lines2532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053062562572582592603102612622633133143153163173183192642652662672682692702712722732742752762772782792801 unmodified line2822832842852862872882892902912922932941 unmodified line2962972982993003013028 unmodified lines311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367252 unmodified lines</audio>
<!-- Scripts --><script> // Background music control const bgMusic = document.getElementById('bg-music'); const muteBtn = document.getElementById('mute-btn');
document.addEventListener('DOMContentLoaded', function() { bgMusic.volume = 0.3; const playPromise = bgMusic.play(); if (playPromise !== undefined) { playPromise.catch(error => { console.log('Autoplay prevented:', error); }); } });
muteBtn.addEventListener('click', function () { if (bgMusic.paused) { bgMusic.play(); muteBtn.innerHTML = '<i class="fas fa-volume-up text-2xl bg-gradient-to-r from-purple-500 to-pink-500 bg-clip-text text-transparent"></i>'; } else { bgMusic.pause(); muteBtn.innerHTML = '<i class="fas fa-volume-mute text-2xl bg-gradient-to-r from-purple-500 to-pink-500 bg-clip-text text-transparent"></i>'; } });
// Click on horse document.getElementById('horse-image').addEventListener('click', function () { const currentSrc = this.src; const happySrc = this.dataset.happy; const seriousSrc = this.dataset.serious; this.src = currentSrc === happySrc ? seriousSrc : happySrc;
const horseSound = document.getElementById('horse-sound'); horseSound.currentTime = 0; horseSound.play();
registerClick(); // Firebase });
// Smooth scroll for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); });</script>
<!-- Firebase SDK --><!-- Scripts --><script src="https://www.gstatic.com/firebasejs/10.3.1/firebase-app.js"></script><script src="https://www.gstatic.com/firebasejs/10.3.1/firebase-database.js"></script>
<script> // 👉 Замінити цей блок на свої дані з Firebase Console // 👉 Заміни цей блок своїм firebaseConfig const firebaseConfig = { apiKey: "AIzaSyCVYIrFNTrzNAoDg7ILDkuuj6WOuIbshkw", authDomain: "dpth-token.firebaseapp.com", databaseURL: "https://dpth-token-default-rtdb.firebaseio.com/", projectId: "dpth-token", storageBucket: "dpth-token.firebasestorage.app", messagingSenderId: "342451304770", appId: "1:342451304770:web:2fa126439179c152cb70db", measurementId: "G-Q31X5D2S68" authDomain: "dpth-token.firebaseapp.com", databaseURL: "https://dpth-token-default-rtdb.firebaseio.com", projectId: "dpth-token", storageBucket: "dpth-token.firebasestorage.app", messagingSenderId: "342451304770", appId: "1:342451304770:web:2fa126439179c152cb70db", measurementId: "G-Q31X5D2S68" };
// 🔧 Ініціалізація Firebase const app = firebase.initializeApp(firebaseConfig); const db = firebase.database();
// 🌍 Визначення країни користувача let userCountry = "XX"; fetch('https://ipapi.co/json/') .then(res => res.json())1 unmodified line userCountry = data.country_code || "XX"; });
// 🧮 Запис кліку в базу function registerClick() { const ref = db.ref(`clicks_by_country/${userCountry}`); ref.transaction(current => (current || 0) + 1); }
// 📊 Оновлення лічильника та лідерборду const totalRef = db.ref("clicks_by_country"); totalRef.on("value", snapshot => { const data = snapshot.val() || {};1 unmodified line const sorted = Object.entries(data).sort((a, b) => b[1] - a[1]);
sorted.forEach(([_, count]) => total += count);
const counterEl = document.getElementById("click-counter"); if (counterEl) counterEl.textContent = total.toLocaleString();
8 unmodified lines lb.innerHTML = html; } });
// 🔊 Обробка звуку та зображення const bgMusic = document.getElementById('bg-music'); const muteBtn = document.getElementById('mute-btn');
document.addEventListener('DOMContentLoaded', function() { bgMusic.volume = 0.3; const playPromise = bgMusic.play(); if (playPromise !== undefined) { playPromise.catch(error => { console.log('Autoplay prevented:', error); }); } });
muteBtn.addEventListener('click', function () { if (bgMusic.paused) { bgMusic.play(); muteBtn.innerHTML = '<i class="fas fa-volume-up text-2xl bg-gradient-to-r from-purple-500 to-pink-500 bg-clip-text text-transparent"></i>'; } else { bgMusic.pause(); muteBtn.innerHTML = '<i class="fas fa-volume-mute text-2xl bg-gradient-to-r from-purple-500 to-pink-500 bg-clip-text text-transparent"></i>'; } });
// 🐴 Клік по зображенню коня const horseImage = document.getElementById('horse-image'); if (horseImage) { horseImage.addEventListener('click', function () { const currentSrc = this.src; const happySrc = this.dataset.happy; const seriousSrc = this.dataset.serious; this.src = currentSrc === happySrc ? seriousSrc : happySrc;
const horseSound = document.getElementById('horse-sound'); horseSound.currentTime = 0; horseSound.play();
registerClick(); // ✅ Запис у Firebase }); }
// 🧭 Smooth scroll document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); });</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ICEGUS/dpthtoken" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>index.html+66-59