Add timer

This commit is contained in:
Joey Yakimowich-Payne 2025-01-30 17:18:56 -07:00
commit 6d6a994109
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
4 changed files with 214 additions and 1 deletions

BIN
audio/done.wav Normal file

Binary file not shown.

View file

@ -18,6 +18,13 @@
<div id="topicsContainer" class="space-y-3 sm:space-y-4">
<!-- Topics will be inserted here -->
</div>
<div class="mt-6 text-center">
<button id="timerBtn" class="bg-green-600 hover:bg-green-700 text-white font-semibold py-2 sm:py-3 px-4 sm:px-6 rounded-lg shadow-lg transition duration-300 ease-in-out transform hover:scale-105">
Start Timer
</button>
<div id="timerDisplay" class="text-4xl sm:text-5xl font-bold text-blue-800 mt-4"></div>
</div>
</div>
<script src="js/index.js"></script>

View file

@ -556,5 +556,167 @@
"What's your favorite example of environmental restoration?",
"If you could restore any ecosystem instantly, which would you choose?",
"What's the most interesting urban innovation you've seen?",
"If you could redesign any aspect of city living, what would it be?"
"If you could redesign any aspect of city living, what would it be?",
"What's the most fascinating mystery of the ancient world to you?",
"If you could master any ancient craft or skill, what would it be?",
"What's your favorite example of accidental scientific discovery?",
"If you could design your own language, what unique features would it have?",
"What's the most interesting family tradition you've heard of?",
"If you could create a new holiday tradition, what would it involve?",
"What's the most remarkable act of kindness you've witnessed?",
"If you could solve any unsolved historical mystery, which would you choose?",
"What's your most memorable experience in nature?",
"If you could design a new national park, what would it feature?",
"What's the most interesting cultural ritual you've learned about?",
"If you could create a new form of art, what would it be?",
"What's the most fascinating psychological phenomenon you know?",
"If you could understand any aspect of dreams, what would it be?",
"What's your favorite example of animal problem-solving?",
"If you could design a new type of musical notation, how would it work?",
"What's the most interesting theory about consciousness you've heard?",
"If you could create a new form of meditation, what would it focus on?",
"What's your most memorable learning experience?",
"If you could design a new way to teach, what approach would you take?",
"What's the most interesting cultural fusion you've encountered?",
"If you could combine any two cuisines, which would you choose?",
"What's the most fascinating aspect of human memory to you?",
"If you could preserve any moment in perfect detail, which would it be?",
"What's your favorite example of architectural innovation?",
"If you could design a house anywhere in the world, where and what would it be?",
"What's the most interesting theory about time you've heard?",
"If you could experience time differently for a day, how would you want to perceive it?",
"What's the most remarkable adaptation in nature you know about?",
"If you could design a new species of plant, what would it be like?",
"What's your favorite example of human ingenuity?",
"If you could solve any everyday problem with technology, what would it be?",
"What's the most interesting cultural misunderstanding you've experienced?",
"If you could instantly understand any cultural perspective, which would you choose?",
"What's the most fascinating historical coincidence you know about?",
"If you could witness any two historical events simultaneously, which would they be?",
"What's your favorite example of natural symmetry?",
"If you could design a new geometric pattern, what would inspire it?",
"What's the most interesting social experiment you've participated in?",
"If you could study any aspect of human behavior, what would it be?",
"What's the most fascinating astronomical event you've witnessed?",
"If you could name a newly discovered galaxy, what would you call it?",
"What's your favorite example of biomimicry?",
"If you could copy any natural process for human use, what would it be?",
"What's the most interesting theory about human origins you've heard?",
"If you could trace your ancestry back to any time period, when would you choose?",
"What's the most fascinating mathematical pattern you've observed in nature?",
"If you could visualize any mathematical concept, what would it look like?",
"What's your favorite example of cultural preservation?",
"If you could protect any endangered cultural practice, what would it be?",
"What's the most interesting theory about the future of human evolution?",
"If you could guide human evolution, what traits would you enhance?",
"What's the most fascinating aspect of human creativity to you?",
"If you could understand the source of inspiration, how would you use that knowledge?",
"What's your favorite example of natural camouflage?",
"If you could design a new form of camouflage, what would it be like?",
"What's the most interesting theory about human consciousness you've heard?",
"If you could experience another person's consciousness, whose would you choose?",
"What's the most fascinating aspect of human language development?",
"If you could create a universal form of communication, how would it work?",
"What's your favorite example of animal intelligence?",
"If you could give any animal human-level intelligence, which would you choose?",
"What's the most interesting theory about dreams you've heard?",
"If you could design your own dreamworld, what would it include?",
"What's the most fascinating aspect of human emotion to you?",
"If you could create a new emotion, what would it feel like?",
"What's your favorite example of natural healing?",
"If you could design a new healing method, what would it involve?",
"What's the most interesting theory about parallel universes you've heard?",
"If you could visit a parallel universe, what would you hope to find?",
"What's the most fascinating aspect of human memory to you?",
"If you could enhance one aspect of your memory, what would it be?",
"What's your favorite example of natural architecture?",
"If you could design like nature does, what would you create?",
"What's the most interesting theory about the origin of life?",
"If you could recreate the conditions for life, what would you do differently?",
"What's the most fascinating aspect of human creativity to you?",
"If you could master any creative process instantly, what would it be?",
"What's your favorite example of natural mathematics?",
"If you could see mathematical patterns in nature, what would you look for?",
"What's the most interesting theory about human potential you've heard?",
"If you could unlock any human capability, what would it be?",
"What's the most fascinating aspect of cultural evolution to you?",
"If you could preserve any cultural knowledge, what would you choose?",
"What's your favorite example of natural music?",
"If you could compose like nature does, what would you create?",
"What's the most interesting theory about human connection you've heard?",
"If you could understand any aspect of human bonding, what would it be?",
"What's the most fascinating aspect of plant intelligence to you?",
"If you could communicate with plants, what would you ask them?",
"What's your favorite example of natural technology?",
"If you could replicate any natural process technologically, what would it be?",
"What's the most interesting theory about human creativity you've heard?",
"If you could understand the creative process completely, how would you use that knowledge?",
"What's the most fascinating aspect of animal communication to you?",
"If you could understand any animal language, which would you choose?",
"What's your favorite example of natural engineering?",
"If you could build like nature does, what would you create?",
"What's the most interesting theory about human intuition you've heard?",
"If you could enhance your intuitive abilities, how would you use them?",
"What's the most fascinating aspect of ecosystem balance to you?",
"If you could design a perfect ecosystem, what would it include?",
"What's your favorite example of natural chemistry?",
"If you could create like nature does, what would you make?",
"What's the most interesting theory about human development you've heard?",
"If you could optimize human development, what would you focus on?",
"What's the most fascinating aspect of natural cycles to you?",
"If you could create a new natural cycle, what would it be?",
"What's your favorite example of natural physics?",
"If you could understand any physical process completely, which would you choose?",
"What's the most interesting theory about human adaptation you've heard?",
"If you could adapt to any environment instantly, where would you go?",
"What's the most fascinating aspect of social evolution to you?",
"If you could guide social evolution, what changes would you make?",
"What's your favorite example of natural problem-solving?",
"If you could solve problems like nature does, what would you tackle first?",
"What's the most interesting theory about human potential you've encountered?",
"If you could unlock any human capability, what would you choose?",
"What's the most fascinating aspect of natural balance to you?",
"If you could create perfect balance in any system, what would you choose?",
"What's your favorite example of natural innovation?",
"If you could innovate like nature does, what would you create?",
"What's the most interesting theory about collective consciousness you've heard?",
"If you could tap into collective consciousness, how would you use it?",
"What's the most fascinating aspect of natural harmony to you?",
"If you could create harmony in any system, what would you choose?",
"What's your favorite example of natural resilience?",
"If you could build resilience like nature does, what would you strengthen?",
"What's the most interesting theory about human connection you've encountered?",
"If you could connect with anyone instantly, how would you use that ability?",
"What's the most fascinating aspect of natural wisdom to you?",
"If you could access nature's wisdom directly, what would you learn first?",
"What's your favorite example of natural transformation?",
"If you could transform like nature does, what changes would you make?",
"What's the most interesting theory about universal consciousness you've heard?",
"If you could experience universal consciousness, what would you hope to discover?",
"What's the most fascinating aspect of natural healing to you?",
"If you could heal like nature does, what would you restore first?",
"What's your favorite example of natural harmony?",
"If you could create harmony like nature does, what would you harmonize?",
"What's the most interesting theory about human potential you've discovered?",
"If you could realize your full potential instantly, what would you do first?",
"What's the most fascinating aspect of natural balance to you?",
"If you could balance any system perfectly, what would you choose?",
"What's your favorite example of natural wisdom?",
"If you could access wisdom like nature does, how would you use it?",
"What's the most interesting theory about consciousness evolution you've heard?",
"If you could evolve consciousness instantly, what would you aim for?",
"What's the most fascinating aspect of natural cycles to you?",
"If you could create a new cycle in nature, what would it be?",
"What's your favorite example of natural intelligence?",
"If you could think like nature does, how would you solve problems?",
"What's the most interesting theory about universal harmony you've heard?",
"If you could create universal harmony, where would you start?",
"What's the most fascinating aspect of natural creation to you?",
"If you could create like nature does, what would you bring into being?",
"What's your favorite example of natural adaptation?",
"If you could adapt like nature does, what changes would you make?",
"What's the most interesting theory about collective wisdom you've heard?",
"If you could access collective wisdom, how would you use it?",
"What's the most fascinating aspect of natural evolution to you?",
"If you could guide evolution, what direction would you choose?"
]

View file

@ -6,6 +6,12 @@ document.addEventListener('DOMContentLoaded', async () => {
const generateBtn = document.getElementById('generateBtn');
const topicsContainer = document.getElementById('topicsContainer');
// Add timer functionality
const timerBtn = document.getElementById('timerBtn');
const timerDisplay = document.getElementById('timerDisplay');
const alertSound = new Audio("audio/done.wav");
let timerInterval;
function getRandomTopics(count) {
const shuffled = [...topics].sort(() => 0.5 - Math.random());
return shuffled.slice(0, count);
@ -25,11 +31,49 @@ document.addEventListener('DOMContentLoaded', async () => {
});
}
function formatTime(seconds) {
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
return `${mins}:${secs.toString().padStart(2, '0')}`;
}
function startTimer(duration, callback) {
let timeLeft = duration;
timerDisplay.textContent = formatTime(timeLeft);
timerInterval = setInterval(() => {
timeLeft--;
timerDisplay.textContent = formatTime(timeLeft);
if (timeLeft <= 0) {
clearInterval(timerInterval);
alertSound.play();
callback?.();
}
}, 1000);
}
generateBtn.addEventListener('click', () => {
const selectedTopics = getRandomTopics(3);
displayTopics(selectedTopics);
});
timerBtn.addEventListener('click', () => {
// Clear any existing timer
clearInterval(timerInterval);
timerBtn.disabled = true;
timerBtn.classList.add('opacity-50');
// Start 15-second timer
startTimer(15, () => {
// After 15-second timer, start 1-minute timer
startTimer(60, () => {
timerBtn.disabled = false;
timerBtn.classList.remove('opacity-50');
});
});
});
// Generate initial topics
displayTopics(getRandomTopics(3));
});