Тест на вибір протеїну за чутливістю Чи є у вас проблеми з здуттям? Виберіть... Так Ні Уникаєте глютену? Виберіть... Так Ні Важко перетравлюєте бобові? Виберіть... Так Ні Отримати результат .protein-calculator { max-width: 420px; margin: 20px auto; padding: 20px; border-radius: 12px; background: #f8f8f8; font-family: Arial, sans-serif; } .protein-calculator label { display: block; margin-top: 12px; font-weight: bold; } .protein-calculator select, .protein-calculator button { width: 100%; padding: 10px; margin-top: 5px; border-radius: 8px; border: 1px solid #ccc; font-size: 15px; } .protein-calculator button { background: #5C8326; color: #D0D269; border: none; margin-top: 20px; cursor: pointer; font-weight: bold; } .protein-calculator button:hover { background: #1D5113; color: #D0D269; } #sensitivity-result { margin-top: 20px; padding: 15px; border-radius: 10px; background: #ffffff; font-size: 16px; line-height: 1.4; } .error-text { color: red; font-weight: bold; } function calculateSensitivity() { const q1 = document.getElementById( q1 ).value; const q2 = document.getElementById( q2 ).value; const q3 = document.getElementById( q3 ).value; const resultDiv = document.getElementById( sensitivity-result ); if (!q1 || !q2 || !q3) { resultDiv.innerHTML = Будь ласка, заповніть всі поля. ; return; } let scores = { amaranth: 0, pea: 0, pumpkin: 0, hemp: 0, potato: 0, soy: 0 }; // ===== ЛОГИКА ПОДБОРА ===== // 1. Вздутие — мягкие протеины, бобовые — хуже if (q1 === yes ) { scores.amaranth += 3; scores.potato += 3; scores.pumpkin += 2; scores.hemp += 1; // Соевый — бобовый → уменьшаем scores.soy -= 3; } else { scores.pea += 2; scores.soy += 2; scores.hemp += 1; } // 2. Избегаете глютен — все наши безглютеновые, но амарант — идеален if (q2 === yes ) { scores.amaranth += 2; scores.potato += 1; scores.pumpkin += 1; scores.hemp += 1; scores.soy += 1; } // 3. Бобовые тяжело — уменьшаем горох и сою if (q3 === yes ) { scores.pea -= 5; scores.soy -= 4; scores.pumpkin += 2; scores.hemp += 2; scores.potato += 2; scores.amaranth += 1; } else { scores.pea += 2; scores.soy += 2; } // ===== Определение лучшего варианта ===== let bestProtein = Object.keys(scores).sort((a, b) => scores[b] - scores[a])[0]; const names = { amaranth: Амарантовий протеїн , pea: Гороховий протеїн , pumpkin: Гарбузовий протеїн , hemp: Конопляний протеїн , potato: Картопляний протеїн , soy: Соєвий протеїн }; let explanation = ; if (bestProtein === amaranth ) explanation = Найм'якший варіант для шлунково-кишкового тракту, чудово підходить при здутті та чутливості до FODMAP. ; if (bestProtein === potato ) explanation = Дуже м'який, легко засвоюється, підходить при здутті та проблемах з травленням. ; if (bestProtein === pea ) explanation = Кремова текстура, приємний смак, підходить при нормальному травленні. ; if (bestProtein === pumpkin ) explanation = Найкращий варіант, якщо ви погано переносите бобові. ; if (bestProtein === hemp ) explanation = Підходить при чутливості до бобових, багатий клітковиною. ; if (bestProtein === soy ) explanation = Хороший універсальний протеїн, якщо немає чутливості до бобових. ; resultDiv.innerHTML = ` Ваш ідеальний варіант: ${names[bestProtein]} Чому: ${explanation} `; }