⌂ Home

Sweets & Desserts

Explore sweet treats and yummy desserts on our display case shelves!

Welcome to our sweet shop! Sweets and desserts are yummy treats that we enjoy after meals or on special days like birthdays.

In this explorer, we will find 15 different sweets and desserts on the shop shelves. Let's learn their names in English and Hindi.

Ready to see some colorful, sweet treats? Let's check the shelves!

Sweet Celebrations!

Desserts are fun treats! We eat them in small amounts after healthy meals to celebrate happy days.

Sweet Display Case

Touch a Sweet Treat

Touch a sweet treat to see what it is!

Sweet Highlights

My Sweets Stand Items

Frequently Asked Questions

Related Explorers

Test Your Knowledge!

Which round, orange Indian sweet is made of crispy spirals soaked in sugar syrup?
Chocolate
Cookie
Jalebi
Ice Cream

Healthy Habits Tips

Always brush your teeth after eating sweet foods to keep your teeth strong, healthy and cavity-free!

Sweet Treat

Description of sweet dessert.

let currentLang = 'en'; let speechSynth = window.speechSynthesis; let isReading = false; let lockedPart = null; // AI Change: SEO/AEO Upgrades - FAQs data definitions (Bilingual) const faqs = [ { q_en: "What are the main types of sweet desserts that kids can discover in our visual bakery and kitchen explorer?", a_en: "Kids can discover delicious baked treats like cakes, cupcakes, and muffins, which are baked in the oven. They can also find cold treats like ice cream.

To learn more about how these treats are made at home, visit our interactive explore_bakery_kitchen.html guide.", q_hi: "बच्चे हमारे सचित्र बेकरी और रसोई अन्वेषक में किस प्रकार के मीठे डेसर्ट खोज सकते हैं?", a_hi: "बच्चे केक,कपकेक और मफिन जैसे स्वादिष्ट बेक्ड व्यंजन खोज सकते हैं, जिन्हें ओवन में पकाया जाता है। वे आइसक्रीम जैसे ठंडे व्यंजन भी पा सकते हैं।

यह जानने के लिए कि ये व्यंजन घर पर कैसे बनाए जाते हैं, हमारे इंटरैक्टिव explore_bakery_kitchen.html गाइड पर जाएं।" }, { q_en: "How is a soft birthday cake decorated to make it look special and colorful for preschool celebration parties?", a_en: "A soft birthday cake is covered in sweet cream frosting. Bakers use colorful sprinkles, fruit pieces, and beautiful candles to make it look extra special.

Eating birthday cake is a fun tradition. You can learn about preparing fruits on cake in our explore_fruits.html explorer.", q_hi: "जन्मदिन के नरम केक को प्रीस्कूल उत्सव पार्टियों के लिए विशेष और रंगीन बनाने के लिए कैसे सजाया जाता है?", a_hi: "जन्मदिन के नरम केक को मीठी मलाई की आइसिंग से ढका जाता है। बेकर्स इसे अतिरिक्त विशेष बनाने के लिए रंगीन छिड़काव, फलों के टुकड़े और सुंदर मोमबत्तियों का उपयोग करते हैं।

केक खाना एक मजेदार परंपरा है। आप हमारे explore_fruits.html एक्सप्लोरर में केक पर फलों को सजाने के बारे में सीख सकते हैं।" }, { q_en: "Why is it important for children to brush their teeth after eating sugary sweets and chocolate bars?", a_en: "Sugary foods and chocolates leave tiny sweet food particles on your teeth. If not cleaned, these sweet particles can attract germs and cause painful cavities.

Brushing your teeth twice a day helps keep your smile bright and healthy. Do this in the explore_bathroom.html sink.", q_hi: "बच्चों के लिए मीठी चीजें और चॉकलेट बार खाने के बाद अपने दांतों को ब्रश करना क्यों महत्वपूर्ण है?", a_hi: "मीठे खाद्य पदार्थ और चॉकलेट आपके दांतों पर छोटे मीठे कण छोड़ जाते हैं। यदि साफ न किया जाए, तो ये कण कीटाणुओं को आकर्षित कर सकते हैं और कैविटी पैदा कर सकते हैं।

दिन में दो बार ब्रश करने से आपकी मुस्कान चमकीली और स्वस्थ रहती है। इसे explore_bathroom.html सिंक में करें।" }, { q_en: "What is the difference between a crispy cookie and a soft baked muffin in our sweet shop display?", a_en: "A cookie is a flat, crispy biscuit often baked with sweet chocolate chips. It makes a crunchy sound when you take a bite of it.

A muffin is a soft, fluffy cake shaped like a dome. To learn about kitchen tools used for baking, check the explore_kitchen.html.", q_hi: "हमारी मिठाई की दुकान के डिस्प्ले में एक कुरकुरी कुकी और एक नरम पके हुए मफिन में क्या अंतर है?", a_hi: "कुकी एक चपटा, कुरकुरा बिस्कुट है जो अक्सर मीठी चॉकलेट चिप्स के साथ बेक किया जाता है। जब आप इसे काटते हैं तो यह कुरकुरी आवाज़ करता है।

मफिन एक नरम, फूला हुआ केक है जिसका आकार गुंबद जैसा होता है। बेकिंग के उपकरणों को जानने के लिए, explore_kitchen.html देखें।" }, { q_en: "How is traditional Indian jalebi made and what gives this famous sweet its signature bright orange color?", a_en: "Jalebi is made by frying fermenting flour batter in spiral shapes until they are crispy. These spirals are then soaked in sweet cardamom sugar syrup.

The beautiful orange color comes from adding a tiny drop of food color to the batter. They are cooked hot in the explore_kitchen.html.", q_hi: "पारंपरिक भारतीय जलेबी कैसे बनाई जाती है और इस प्रसिद्ध मिठाई को इसका विशिष्ट चमकीला नारंगी रंग क्या देता है?", a_hi: "जलेबी बनाने के लिए खमीर उठे हुए आटे के घोल को गोल आकार में कुरकुरा होने तक तला जाता है। फिर इन घेरों को इलायची वाली मीठी चाशनी में डुबोया जाता है।

सुंदर नारंगी रंग घोल में खाद्य रंग की एक छोटी बूंद मिलाने से आता है। इन्हें explore_kitchen.html में गरमागरम पकाया जाता है।" }, { q_en: "Why is wobbly jelly so much fun for toddlers and what does it taste like?", a_en: "Jelly is a soft, bouncy dessert that shakes and wobbles when you touch it. Toddlers love watching it move on their small plates.

It is made in delicious fruit flavors like strawberry, orange, and grape. You can learn about these fruits in the explore_fruits.html guide.", q_hi: "हिलती-डुलती जेली छोटे बच्चों के लिए इतनी मजेदार क्यों है और इसका स्वाद कैसा होता है?", a_hi: "जेली एक नरम, उछलने वाला मीठा व्यंजन है जो छूने पर हिलता है। छोटे बच्चों को इसे अपनी छोटी प्लेटों पर हिलते हुए देखना बहुत पसंद है।

यह स्ट्रॉबेरी, नारंगी और अंगूर जैसे स्वादिष्ट फलों के स्वादों में बनाई जाती है। आप इन फलों के बारे में explore_fruits.html में जान सकते हैं।" }, { q_en: "What makes gulab jamuns so soft and sweet and how are they served at Indian celebrations?", a_en: "Gulab jamuns are made from milk solids kneaded into soft dough balls, which are fried and soaked in warm, sweet sugar syrup containing rose water.

They are served warm and melt in your mouth. They are popular at festivals, which you can see in festival-symbols.html.", q_hi: "गुलाब जामुन को क्या इतना नरम और मीठा बनाता है और भारतीय समारोहों में उन्हें कैसे परोसा जाता है?", a_hi: "गुलाब जामुन मावे से बने नरम गोलों को तलकर और फिर गुलाब जल से युक्त गर्म, मीठी चाशनी में भिगोकर बनाए जाते हैं।

इन्हें गरमागरम परोसा जाता है और ये मुंह में पिघल जाते हैं। ये त्योहारों पर लोकप्रिय हैं, जिन्हें आप festival-symbols.html में देख सकते हैं।" }, { q_en: "How is mango ice cream prepared at home and is it a healthy summer treat for preschoolers?", a_en: "Mango ice cream is made by blending fresh milk, cream, and sweet ripe mango pulp, then freezing the mixture until it becomes smooth and cold.

It is a delicious summer treat. Eating fresh fruits from our explore_vegetables.html or fruit guides provides even healthier vitamins.", q_hi: "घर पर आम की आइसक्रीम कैसे तैयार की जाती है और क्या यह प्रीस्कूलर के लिए एक स्वस्थ ग्रीष्मकालीन उपचार है?", a_hi: "आम की आइसक्रीम ताजे दूध, क्रीम और पके आम के गूदे को मिलाकर बनाई जाती है, फिर मिश्रण को चिकना और ठंडा होने तक जमाया जाता है।

यह गर्मियों का एक स्वादिष्ट व्यंजन है। हमारे explore_vegetables.html या फलों के गाइड से ताजे फल खाने से और भी स्वस्थ विटामिन मिलते हैं।" } ]; // AI Change: SEO/AEO Upgrades - Related Explorers Data definition const relatedData = { en: [ { title: "Bakery & Kitchen", desc: "Discover bakery items and kitchen tools", url: "explore_bakery_kitchen.html", icon: "fa-solid fa-bread-slice" }, { title: "Kitchen Explorer", desc: "Discover tools and items in a household kitchen", url: "explore_kitchen.html", icon: "fa-solid fa-sink" }, { title: "Fruits Explorer", desc: "Learn about delicious and healthy fruits", url: "explore_fruits.html", icon: "fa-solid fa-apple-whole" }, { title: "Breakfast Explorer", desc: "Learn about yummy breakfast items and morning foods", url: "explore_breakfast.html", icon: "fa-solid fa-mug-hot" } ], hi: [ { title: "बेकरी और रसोई", desc: "बेकरी की चीजों और रसोई के उपकरणों की खोज करें", url: "explore_bakery_kitchen.html", icon: "fa-solid fa-bread-slice" }, { title: "रसोई अन्वेषक", desc: "घर की रसोई के उपकरणों और वस्तुओं की खोज करें", url: "explore_kitchen.html", icon: "fa-solid fa-sink" }, { title: "फल अन्वेषक", desc: "स्वादिष्ट और स्वस्थ फलों के बारे में जानें", url: "explore_fruits.html", icon: "fa-solid fa-apple-whole" }, { title: "नाश्ता अन्वेषक", desc: "स्वादिष्ट नाश्ते की वस्तुओं और सुबह के भोजन के बारे में जानें", url: "explore_breakfast.html", icon: "fa-solid fa-mug-hot" } ] }; const introTemplates = { en: [ name => `Look! That is the ${name}.`, name => `Say hello to the ${name}!`, name => `Here is the ${name}!`, name => `Check out the ${name}!`, name => `We found the ${name}!` ], hi: [ name => `देखो! वह है ${name}।`, name => `${name} को नमस्ते कहो!`, name => `यह रहा ${name}!`, name => `ज़रा इसे देखो, यह है ${name}!`, name => `हमें मिला ${name}!` ] }; const content = { en: { title: "Sweets & Desserts", byline: "Explore sweet treats and yummy desserts on our display case shelves!", headings: { build: "Sweet Celebrations!", explorer: "Sweet Display Case", parts: "Sweet Highlights", safety: "Healthy Habits Tips", subParts: "Touch a Sweet Treat", subKeyParts: "My Sweets Stand Items", subQuiz: "Test Your Knowledge!", instruction: "Touch a sweet treat to see what it is!", faq: "Frequently Asked Questions", related: "Related Explorers" }, intro: [ "Welcome to our sweet shop! Sweets and desserts are yummy treats that we enjoy after meals or on special days like birthdays.", "In this explorer, we will find 15 different sweets and desserts on the shop shelves. Let's learn their names in English and Hindi.", "Ready to see some colorful, sweet treats? Let's check the shelves!" ], basicConcept: "Desserts are fun treats! We eat them in small amounts after healthy meals to celebrate happy days.", partsList: [ "Ice Cream - A cold, creamy sweet treat in a cone or cup.", "Cake - A soft, fluffy baked cake with sweet icing.", "Cupcake - A mini cake in a little cup, decorated with colorful sprinkles.", "Cookie - A crispy baked biscuit, often filled with chocolate chips.", "Chocolate - A sweet brown treat made from cocoa beans.", "Pudding - A smooth, soft, and creamy dessert.", "Donut - A round ring-shaped sweet cake with a hole in the middle.", "Pie - A baked pastry shell with sweet fruit filling inside.", "Pastry - A flaky, light baked dessert layered with sweet cream.", "Candy - A small, sweet hard or chewy candy.", "Jelly - A wobbly, bouncy, fruit-flavored sweet treat.", "Muffin - A small dome-shaped soft cake, perfect for snack time.", "Gulab Jamun - Soft, golden-brown sweet balls soaked in warm sugar syrup.", "Jalebi - Crispy, orange-colored spiral sweets soaked in syrup.", "Halwa - A sweet, warm pudding made with flour, carrots, or semolina." ], quiz: { question: "Which round, orange Indian sweet is made of crispy spirals soaked in sugar syrup?", options: ["Chocolate", "Cookie", "Jalebi", "Ice Cream"], feedback: { correct: "Correct! Jalebis are crispy, orange spirals that are soaked in sweet syrup and delicious when served warm.", incorrect: "Not quite. This sweet is bright orange and looks like a group of crispy spirals. Try again!" } }, safety: "Always brush your teeth after eating sweet foods to keep your teeth strong, healthy and cavity-free!", parts: { ice_cream: { name: "Ice Cream", desc: "A cold, creamy sweet treat in a cone or cup." }, cake: { name: "Cake", desc: "A soft, fluffy baked cake with sweet icing." }, cupcake: { name: "Cupcake", desc: "A mini cake in a little cup, decorated with colorful sprinkles." }, cookie: { name: "Cookie", desc: "A crispy baked biscuit, often filled with chocolate chips." }, chocolate: { name: "Chocolate", desc: "A sweet brown treat made from cocoa beans." }, pudding: { name: "Pudding", desc: "A smooth, soft, and creamy dessert." }, donut: { name: "Donut", desc: "A round ring-shaped sweet cake with a hole in the middle." }, pie: { name: "Pie", desc: "A baked pastry shell with sweet fruit filling inside." }, pastry: { name: "Pastry", desc: "A flaky, light baked dessert layered with sweet cream." }, candy: { name: "Candy", desc: "A small, sweet hard or chewy candy." }, jelly: { name: "Jelly", desc: "A wobbly, bouncy, fruit-flavored sweet treat." }, muffin: { name: "Muffin", desc: "A small dome-shaped soft cake, perfect for snack time." }, gulab_jamun: { name: "Gulab Jamun", desc: "Soft, golden-brown sweet balls soaked in warm sugar syrup." }, jalebi: { name: "Jalebi", desc: "Crispy, orange-colored spiral sweets soaked in syrup." }, halwa: { name: "Halwa", desc: "A sweet, warm pudding made with flour, carrots, or semolina." } } }, hi: { title: "मिठाइयाँ और डेसर्ट", byline: "हमारी अलमारियों पर मीठे व्यंजनों और स्वादिष्ट डेसर्ट की खोज करें!", headings: { build: "मीठा जश्न!", explorer: "स्वीट डिस्प्ले केस", parts: "मीठी बातें", safety: "स्वस्थ आदतों के टिप्स", subParts: "एक मीठी वस्तु को छुएं", subKeyParts: "मेरी मिठाइयों की सूची", subQuiz: "अपने ज्ञान का परीक्षण करें!", instruction: "यह देखने के लिए कि वह क्या है, एक मीठी वस्तु को छुएं!", faq: "अक्सर पूछे जाने वाले प्रश्न", related: "संबंधित एक्सप्लोरर्स" }, intro: [ "हमारी मिठाई की दुकान में स्वागत है! मिठाइयाँ और डेसर्ट स्वादिष्ट व्यंजन हैं जिनका हम भोजन के बाद या जन्मदिन जैसे विशेष अवसरों पर आनंद लेते हैं।", "इस अन्वेषक में, हम दुकान की अलमारियों पर 15 अलग-अलग मिठाइयाँ पाएंगे। आइए अंग्रेजी और हिंदी में उनके नाम सीखें।", "तैयार हैं रंग-बिरंगे मीठे व्यंजनों को देखने के लिए? आइए अलमारियां देखें!" ], basicConcept: "डेसर्ट मज़ेदार व्यंजन हैं! खुशियों के दिनों का जश्न मनाने के लिए हम उन्हें स्वास्थ्यवर्धक भोजन के बाद कम मात्रा में खाते हैं।", partsList: [ "आइसक्रीम (Ice Cream) - कोन या कप में एक ठंडा, मलाईदार मीठा व्यंजन।", "केक (Cake) - मीठी आइसिंग के साथ एक नरम, फूला हुआ बेक किया हुआ केक।", "कपकेक (Cupcake) - छोटे कप में एक मिनी केक, जिसे रंगीन छिड़काव से सजाया गया है।", "कुकी (Cookie) - एक कुरकुरा बेक किया हुआ बिस्कुट, जो अक्सर चॉकलेट चिप्स से भरा होता है।", "चॉकलेट (Chocolate) - कोको बीन्स से बना एक मीठा भूरा व्यंजन।", "पुडिंग (Pudding) - एक चिकना, नरम और मलाईदार मीठा पकवान।", "डोनट (Donut) - बीच में छेद वाला एक गोल छल्ले के आकार का मीठा केक।", "पाई (Pie) - अंदर मीठे फलों से भरी हुई एक पकी हुई पेस्ट्री।", "पेस्ट्री (Pastry) - मीठी मलाईदार परतों वाली एक हल्की बेक की हुई पेस्ट्री।", "टॉफी (Candy) - एक छोटी, मीठी सख्त या चबाने वाली टॉफी।", "जेली (Jelly) - एक डगमगाने वाला, उछलने वाला, फलों के स्वाद वाला मीठा व्यंजन।", "मफिन (Muffin) - एक छोटा गुंबद के आकार का नरम केक, नाश्ते के लिए एकदम सही।", "गुलाब जामुन (Gulab Jamun) - चाशनी में डूबी हुई नरम, सुनहरी-भूरी मीठी गोलियां।", "जलेबी (Jalebi) - चाशनी में डूबी हुई कुरकुरी, नारंगी रंग की गोल घुमावदार मिठाई।", "हलवा (Halwa) - आटे, गाजर या सूजी से बना एक स्वादिष्ट गर्म मीठा हलवा।" ], quiz: { question: "चाशनी में डूबी हुई कुरकुरी नारंगी घुमावदार भारतीय मिठाई कौन सी है?", options: ["चॉकलेट", "कुकी", "जलेबी", "आइसक्रीम"], feedback: { correct: "सही जवाब! जलेबी कुरकुरी, नारंगी रंग की घुमावदार मिठाई होती है जिसे चाशनी में भिगोया जाता है और गरमागरम खाया जाता है।", incorrect: "नहीं, सही जवाब जलेबी है। फिर से प्रयास करें!" } }, safety: "मीठी चीजें खाने के बाद हमेशा अपने दांतों को ब्रश करें ताकि वे मजबूत, स्वस्थ और सड़न-मुक्त रहें!", parts: { ice_cream: { name: "आइसक्रीम", desc: "कोन या कप में एक ठंडा, मलाईदार मीठा व्यंजन।" }, cake: { name: "केक", desc: "मीठी आइसिंग के साथ एक नरम, फूला हुआ बेक किया हुआ केक।" }, cupcake: { name: "कपकेक", desc: "छोटे कप में एक मिनी केक, जिसे रंगीन छिड़काव से सजाया गया है।" }, cookie: { name: "कुकी", desc: "एक कुरकुरा बेक किया हुआ बिस्कुट, जो अक्सर चॉकलेट चिप्स से भरा होता है।" }, chocolate: { name: "चॉकलेट", desc: "कोको बीन्स से बना एक मीठा भूरा व्यंजन।" }, pudding: { name: "पुडिंग", desc: "एक चिकना, नरम और मलाईदार मीठा पकवान।" }, donut: { name: "डोनट", desc: "बीच में छेद वाला एक गोल छल्ले के आकार का मीठा केक।" }, pie: { name: "पाई", desc: "अंदर मीठे फलों से भरी हुई एक पकी हुई पेस्ट्री।" }, pastry: { name: "पेस्ट्री", desc: "मीठी मलाईदार परतों वाली एक हल्की बेक की हुई पेस्ट्री।" }, candy: { name: "टॉफी", desc: "एक छोटी, मीठी सख्त या चबाने वाली टॉफी।" }, jelly: { name: "जेली", desc: "एक डगमगाने वाला, उछलने वाला, फलों के स्वाद वाला मीठा व्यंजन।" }, muffin: { name: "मफिन", desc: "एक छोटा गुंबद के आकार का नरम केक, नाश्ते के लिए एकदम सही।" }, gulab_jamun: { name: "गुलाब जामुन", desc: "चाशनी में डूबी हुई नरम, सुनहरी-भूरी मीठी गोलियां।" }, jalebi: { name: "जलेबी", desc: "चाशनी में डूबी हुई कुरकुरी, नारंगी रंग की गोल घुमावदार मिठाई।" }, halwa: { name: "हलवा", desc: "आटे, गाजर या सूजी से बना एक स्वादिष्ट गर्म मीठा हलवा।" } } } }; // AI Change: SEO/AEO Upgrades - Render FAQ list dynamically function renderFaqs() { const faqContainer = document.getElementById('faqSection'); if (!faqContainer) return; faqContainer.innerHTML = faqs.map((faq, idx) => { const qText = currentLang === 'en' ? faq.q_en : faq.q_hi; const aText = currentLang === 'en' ? faq.a_en : faq.a_hi; return `

${aText}

`; }).join(''); } // AI Change: SEO/AEO Upgrades - FAQ Accordion and TTS handler function toggleFaq(index) { const panel = document.getElementById(`faq-panel-${index}`); const header = document.getElementById(`faq-header-${index}`); const item = document.getElementById(`faq-item-${index}`); if (!panel || !header || !item) return; const isExpanding = !item.classList.contains('active'); document.querySelectorAll('.faq-item').forEach((faqVal, idx) => { if (idx !== index) { faqVal.classList.remove('active'); const otherPanel = document.getElementById(`faq-panel-${idx}`); if (otherPanel) otherPanel.style.maxHeight = null; const otherHeader = document.getElementById(`faq-header-${idx}`); if (otherHeader) otherHeader.setAttribute('aria-expanded', 'false'); } }); if (isExpanding) { item.classList.add('active'); panel.style.maxHeight = panel.scrollHeight + "px"; header.setAttribute('aria-expanded', 'true'); if (window.speechSynthesis) { window.speechSynthesis.cancel(); const textToSpeak = faqs[index][currentLang === 'en' ? 'a_en' : 'a_hi'].replace(/<[^>]*>/g, ''); const utter = new SpeechSynthesisUtterance(textToSpeak); utter.lang = currentLang === 'en' ? 'en-US' : 'hi-IN'; utter.rate = 0.9; utter.onstart = () => { document.body.classList.add('speaking'); header.style.color = "var(--primary-blue)"; }; utter.onend = () => { document.body.classList.remove('speaking'); header.style.color = ""; }; utter.onerror = () => { document.body.classList.remove('speaking'); header.style.color = ""; }; window.speechSynthesis.speak(utter); } } else { item.classList.remove('active'); panel.style.maxHeight = null; header.setAttribute('aria-expanded', 'false'); if (window.speechSynthesis) { window.speechSynthesis.cancel(); } document.body.classList.remove('speaking'); } } // AI Change: SEO/AEO Upgrades - Render Related Explorers Cards dynamically function renderRelated() { const grid = document.getElementById('relatedGrid'); if (!grid) return; const items = relatedData[currentLang]; grid.innerHTML = items.map(item => `

${item.title}

${item.desc}

`).join(''); } function setLanguage(lang) { currentLang = lang; updateContent(); document.getElementById('toggle-lang-en').classList.toggle('active', lang === 'en'); document.getElementById('toggle-lang-hi').classList.toggle('active', lang === 'hi'); renderFaqs(); renderRelated(); } function updateContent() { const c = content[currentLang]; document.getElementById('articleTitle').innerText = c.title; document.getElementById('articleByline').innerText = c.byline; document.getElementById('headingBuild').innerHTML = ` ${c.headings.build}`; document.getElementById('headingExplorer').innerHTML = ` ${c.headings.explorer}`; document.getElementById('headingKeyParts').innerHTML = ` ${c.headings.parts}`; document.getElementById('headingSafety').innerHTML = ` ${c.headings.safety}`; // FAQ and Related links headings updates document.getElementById('headingFaq').innerHTML = ` ${c.headings.faq}`; document.getElementById('headingRelated').innerHTML = ` ${c.headings.related}`; document.getElementById('subheadingParts').innerText = c.headings.subParts; document.getElementById('subheadingKeyParts').innerText = c.headings.subKeyParts; document.getElementById('subheadingQuiz').innerText = c.headings.subQuiz; document.getElementById('instructionText').innerHTML = ` ${c.headings.instruction}`; const introDiv = document.getElementById('introSection'); introDiv.innerHTML = c.intro.map(p => `

${p}

`).join(''); document.getElementById('basicConcept').innerText = c.basicConcept; const list = document.getElementById('partsList'); list.innerHTML = c.partsList.map(li => `
  • ${li}
  • `).join(''); document.getElementById('quizQuestion').innerText = c.quiz.question; const options = document.querySelectorAll('.quiz-option'); options.forEach((opt, idx) => { opt.innerText = c.quiz.options[idx]; opt.className = 'quiz-option'; opt.id = `quiz-opt-${idx}`; }); const feedback = document.getElementById('quizFeedback'); feedback.className = 'quiz-feedback'; feedback.innerText = ''; feedback.classList.remove('show'); document.getElementById('safetySection').innerText = c.safety; // Toggle language-specific custom displays if any const isEn = currentLang === 'en'; document.querySelectorAll('.lang-en').forEach(el => el.style.display = isEn ? '' : 'none'); document.querySelectorAll('.lang-hi').forEach(el => el.style.display = isEn ? 'none' : ''); } function speakText(text, isIntro = false) { if (speechSynth.speaking) { speechSynth.cancel(); } const utter = new SpeechSynthesisUtterance(text); utter.lang = currentLang === 'en' ? 'en-US' : 'hi-IN'; utter.rate = 0.85; utter.onstart = function() { document.body.classList.add('speaking'); if (isIntro) { isReading = true; document.getElementById('tts-speak-hero').innerHTML = ' ' + (currentLang === 'en' ? 'Stop' : 'रुको'); document.getElementById('tts-speak-hero').classList.add('speaking'); } }; utter.onend = function() { document.body.classList.remove('speaking'); if (isIntro) { isReading = false; document.getElementById('tts-speak-hero').innerHTML = ' ' + (currentLang === 'en' ? 'Listen' : 'सुनो'); document.getElementById('tts-speak-hero').classList.remove('speaking'); } }; utter.onerror = function() { document.body.classList.remove('speaking'); if (isIntro) { isReading = false; document.getElementById('tts-speak-hero').innerHTML = ' ' + (currentLang === 'en' ? 'Listen' : 'सुनो'); document.getElementById('tts-speak-hero').classList.remove('speaking'); } }; speechSynth.speak(utter); } function toggleVoice() { if (isReading) { speechSynth.cancel(); isReading = false; document.getElementById('tts-speak-hero').innerHTML = ' ' + (currentLang === 'en' ? 'Listen' : 'सुनो'); document.getElementById('tts-speak-hero').classList.remove('speaking'); document.body.classList.remove('speaking'); return; } const c = content[currentLang]; speakText(c.basicConcept, true); } const tooltip = document.getElementById('tooltip'); const tooltipTitle = document.getElementById('tooltipTitle'); const tooltipDesc = document.getElementById('tooltipDesc'); const container = document.querySelector('.room-container'); let activePart = null; let hideTimeout = null; function showTooltipForPart(part) { if (!part) return; const partId = part.getAttribute('data-part'); const info = content[currentLang].parts[partId]; if (!info) return; tooltipTitle.textContent = info.name; tooltipDesc.textContent = info.desc; const partRect = part.getBoundingClientRect(); const containerRect = container.getBoundingClientRect(); const viewportWidth = window.innerWidth; const viewportHeight = window.innerHeight; const tooltipWidth = tooltip.offsetWidth; const tooltipHeight = tooltip.offsetHeight; const margin = 16; let x = partRect.left + partRect.width / 2 - tooltipWidth / 2; let y = partRect.top - tooltipHeight - 12; if (y < margin) { y = partRect.bottom + 12; } x = Math.max(margin, Math.min(x, viewportWidth - tooltipWidth - margin)); y = Math.max(margin, Math.min(y, viewportHeight - tooltipHeight - margin)); // [Rule 8 Comment] Replaced local container calculation with absolute coordinates relative to the full document scroll position const absoluteX = x + window.scrollX; const absoluteY = y + window.scrollY; tooltip.style.left = `${absoluteX}px`; tooltip.style.top = `${absoluteY}px`; tooltip.classList.add('show'); } /* [Rule 8 Comment] Interactive mouseenter/mouseleave and lockedPart click listener override */ document.querySelectorAll('.room-svg g[data-part]').forEach(group => { group.addEventListener('mouseenter', function() { if (document.body.classList.contains('speaking')) return; if (lockedPart) return; if (hideTimeout) { clearTimeout(hideTimeout); hideTimeout = null; } activePart = this; showTooltipForPart(this); }); group.addEventListener('mouseleave', function() { if (document.body.classList.contains('speaking')) return; if (lockedPart) return; hideTimeout = setTimeout(function() { activePart = null; tooltip.classList.remove('show'); }, 300); }); group.addEventListener('click', function(e) { e.stopPropagation(); if (document.body.classList.contains('speaking')) return; if (lockedPart) { lockedPart.classList.remove('active-glow'); } if (lockedPart === this) { lockedPart = null; tooltip.classList.remove('show'); if (speechSynth.speaking) { speechSynth.cancel(); } return; } lockedPart = this; this.classList.add('active-glow'); showTooltipForPart(this); const partId = this.getAttribute('data-part'); const info = content[currentLang].parts[partId]; if (!info) return; const templateList = introTemplates[currentLang]; const randomIndex = Math.floor(Math.random() * templateList.length); const prefix = templateList[randomIndex](info.name); const fullSentence = `${prefix} ${info.desc}`; speakText(fullSentence); }); }); /* [Rule 8 Comment] Global outside click reset listener to unlock interactive highlight glows */ document.addEventListener('click', function() { if (lockedPart) { lockedPart.classList.remove('active-glow'); lockedPart = null; tooltip.classList.remove('show'); if (speechSynth.speaking) { speechSynth.cancel(); } } }); const header = document.querySelector('.header'); const footer = document.querySelector('.footer'); let lastMouseY = 0; window.addEventListener('scroll', function() { if (window.scrollY > 60) { header.classList.add('shrunk'); } else { header.classList.remove('shrunk'); } const pageHeight = document.documentElement.scrollHeight; const windowHeight = window.innerHeight; const scrollPos = window.scrollY + windowHeight; if (scrollPos >= pageHeight - windowHeight * 0.04) { footer.classList.add('visible'); } else { if (lastMouseY < windowHeight * 0.96) { footer.classList.remove('visible'); } } }); window.addEventListener('mousemove', function(e) { lastMouseY = e.clientY; const windowHeight = window.innerHeight; if (e.clientY <= windowHeight * 0.04) { header.classList.add('reveal'); } else { header.classList.remove('reveal'); } if (e.clientY >= windowHeight * 0.96) { footer.classList.add('visible'); } else { const pageHeight = document.documentElement.scrollHeight; const scrollPos = window.scrollY + windowHeight; if (scrollPos < pageHeight - windowHeight * 0.04) { footer.classList.remove('visible'); } } }); function selectQuizOption(element, isCorrect) { const allOptions = document.querySelectorAll('.quiz-option'); allOptions.forEach(opt => { opt.classList.remove('correct', 'incorrect'); }); element.classList.add(isCorrect ? 'correct' : 'incorrect'); const feedback = document.getElementById('quizFeedback'); feedback.className = `quiz-feedback ${isCorrect ? 'correct' : 'incorrect'} show`; if (isCorrect) { feedback.textContent = content[currentLang].quiz.feedback.correct; } else { feedback.textContent = content[currentLang].quiz.feedback.incorrect; } } updateContent(); renderFaqs(); renderRelated();