added sound
This commit is contained in:
1 parent
cab833315e
commit
53408a76d9
2 files changed
+6
-1
No files matched your search
@@ -150,6 +150,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
// ── Global Click Counter ─────────────────────────────────────
|
// ── Global Click Counter ─────────────────────────────────────
|
||||||
const clickBtn = document.getElementById('yuuka-click-btn');
|
const clickBtn = document.getElementById('yuuka-click-btn');
|
||||||
const clickDisplay = document.getElementById('click-counter-display');
|
const clickDisplay = document.getElementById('click-counter-display');
|
||||||
|
const clickSound = new Audio('sounds/yuuka_click.mp3');
|
||||||
|
|
||||||
if (clickBtn && clickDisplay && configured) {
|
if (clickBtn && clickDisplay && configured) {
|
||||||
const statsRef = db.collection('stats').doc('global_clicks');
|
const statsRef = db.collection('stats').doc('global_clicks');
|
||||||
@@ -168,6 +169,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
|
|
||||||
// Increment on click
|
// Increment on click
|
||||||
clickBtn.addEventListener('click', () => {
|
clickBtn.addEventListener('click', () => {
|
||||||
|
// Play sound
|
||||||
|
clickSound.currentTime = 0; // Reset to allow rapid clicking
|
||||||
|
clickSound.play().catch(e => console.error("Audio play failed:", e));
|
||||||
|
|
||||||
// Optimistic update for instant feel
|
// Optimistic update for instant feel
|
||||||
let current = parseInt(clickDisplay.textContent.replace(/,/g, '')) || 0;
|
let current = parseInt(clickDisplay.textContent.replace(/,/g, '')) || 0;
|
||||||
clickDisplay.textContent = (current + 1).toLocaleString();
|
clickDisplay.textContent = (current + 1).toLocaleString();
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 40px;
|
gap: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-text {
|
.hero-text {
|
||||||
|
|||||||
Reference in new issue
Block a user