// Generation Bridge Wiki - Main JavaScript // Mock data for terms const termsData = [ { id: 1, term: "No Cap", generation: "genz", meaning: "No lie, for real, truthfully", example: "This pizza is the best, no cap!", category: "slang", popularity: 95, tags: ["truth", "honesty", "slang"] }, { id: 2, term: "Lit", generation: "millennial", meaning: "Amazing, exciting, fun", example: "That party was so lit last night!", category: "slang", popularity: 85, tags: ["fun", "exciting", "awesome"] }, { id: 3, term: "Groovy", generation: "boomer", meaning: "Cool, fashionable, or pleasant", example: "That music is really groovy!", category: "slang", popularity: 60, tags: ["cool", "music", "vintage"] }, { id: 4, term: "Slay", generation: "genz", meaning: "To do something exceptionally well", example: "You absolutely slayed that presentation!", category: "slang", popularity: 98, tags: ["success", "fashion", "performance"] }, { id: 5, term: "Whatever", generation: "genx", meaning: "Indifference, dismissive", example: "You don't like my idea? Whatever.", category: "attitude", popularity: 70, tags: ["indifferent", "sarcastic", "dismissive"] }, { id: 6, term: "Bussin", generation: "genz", meaning: "Really good, especially food", example: "This burger is bussin!", category: "food", popularity: 88, tags: ["food", "delicious", "good"] }, { id: 7, term: "Rad", generation: "genx", meaning: "Radical, excellent, cool", example: "That skateboard trick was rad!", category: "slang", popularity: 65, tags: ["cool", "awesome", "extreme"] }, { id: 8, term: "Skibidi", generation: "genalpha", meaning: "Fun, silly, nonsensical (from YouTube series)", example: "Skibidi toilet is so funny!", category: "meme", popularity: 75, tags: ["meme", "funny", "youtube"] }, { id: 9, term: "Adulting", generation: "millennial", meaning: "Doing adult responsibilities", example: "I spent my Saturday doing taxes, adulting is hard.", category: "lifestyle", popularity: 90, tags: ["responsibility", "growing up", "life"] }, { id: 10, term: "Bet", generation: "genz", meaning: "Okay, agreement, or confirmation", example: "Want to hang out later? Bet.", category: "slang", popularity: 92, tags: ["agreement", "yes", "cool"] }, { id: 11, term: "FOMO", generation: "millennial", meaning: "Fear Of Missing Out", example: "I have serious FOMO seeing everyone's vacation photos.", category: "psychology", popularity: 88, tags: ["anxiety", "social", "missing out"] }, { id: 12, term: "Cool Beans", generation: "genx", meaning: "Agreeable, good idea", example: "Want to grab pizza? Cool beans!", category: "slang", popularity: 55, tags: ["agreement", "casual", "friendly"] } ]; // Translation dictionary const translationDictionary = { "awesome": { boomer: "groovy", genx: "rad", millennial: "lit", genz: "slaps" }, "cool": { boomer: "hip", genx: "cool", millennial: "chill", genz: "fire" }, "great": { boomer: "fabulous", genx: "excellent", millennial: "amazing", genz: "bussin" }, "bad": { boomer: "bummer", genx: "lame", millennial: "trash", genz: "mid" }, "friend": { boomer: "pal", genx: "buddy", millennial: "homie", genz: "fam" }, "very": { boomer: "real", genx: "totally", millennial: "super", genz: "lowkey" }, "yes": { boomer: "right on", genx: "for sure", millennial: "absolutely", genz: "bet" } }; // DOM Elements let searchInput, featuredTermsContainer, translateBtn, translateInput, fromGenSelect, toGenSelect, translationResult, translatedText, translationContext, generationButtons; // Initialize the app document.addEventListener('DOMContentLoaded', () => { initializeElements(); setupEventListeners(); loadFeaturedTerms(); }); function initializeElements() { searchInput = document.getElementById('mainSearch'); featuredTermsContainer = document.getElementById('featuredTerms'); translateBtn = document.getElementById('translateBtn'); translateInput = document.getElementById('translateInput'); fromGenSelect = document.getElementById('fromGen'); toGenSelect = document.getElementById('toGen'); translationResult = document.getElementById('translationResult'); translatedText = document.getElementById('translatedText'); translationContext = document.getElementById('translationContext'); generationButtons = document.querySelectorAll('.generation-btn'); } function setupEventListeners() { // Search functionality searchInput.addEventListener('input', handleSearch); searchInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') { performSearch(); } }); // Translation translateBtn.addEventListener('click', performTranslation); translateInput.addEventListener('keypress', (e) => { if (e.key === 'Enter' && e.ctrlKey) { performTranslation(); } }); // Generation buttons generationButtons.forEach(btn => { btn.addEventListener('click', () => { const gen = btn.dataset.gen; filterByGeneration(gen); }); }); // Navbar interactions document.addEventListener('click', (e) => { if (e.target.matches('[data-action]')) { handleNavbarAction(e.target.dataset.action); } }); } function loadFeaturedTerms() { // Sort by popularity and get top terms const topTerms = [...termsData] .sort((a, b) => b.popularity - a.popularity) .slice(0, 9); featuredTermsContainer.innerHTML = topTerms.map(term => createTermCard(term)).join(''); // Re-initialize feather icons for new content if (typeof feather !== 'undefined') { feather.replace(); } } function createTermCard(term) { const generationColors = { boomer: 'from-blue-500/30 to-blue-600/30', genx: 'from-purple-500/30 to-purple-600/30', millennial: 'from-pink-500/30 to-pink-600/30', genz: 'from-orange-500/30 to-orange-600/30', genalpha: 'from-green-500/30 to-teal-600/30' }; const generationEmojis = { boomer: '👴', genx: '🎸', millennial: '📱', genz: '💫', genalpha: '🚀' }; return `
${term.meaning}
"${term.example}"