Spaces:
Sleeping
Sleeping
Update script.js
Browse files
script.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
| 1 |
function showScreen(n) {
|
| 2 |
-
document.querySelectorAll('.screen').forEach(el =>
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
function handleSubmit() {
|
| 7 |
-
const resp = document.getElementById('response').value;
|
| 8 |
-
//
|
| 9 |
-
const feedback =
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
document.getElementById('feedbackText').innerText = feedback;
|
| 12 |
showScreen(4);
|
| 13 |
}
|
|
|
|
| 1 |
function showScreen(n) {
|
| 2 |
+
document.querySelectorAll('.screen').forEach(el => {
|
| 3 |
+
el.classList.remove('active');
|
| 4 |
+
});
|
| 5 |
+
document.getElementById(`screen${n}`).classList.add('active');
|
| 6 |
}
|
| 7 |
|
| 8 |
function handleSubmit() {
|
| 9 |
+
const resp = document.getElementById('response').value.trim();
|
| 10 |
+
// Placeholder for real AI feedback:
|
| 11 |
+
const feedback =
|
| 12 |
+
"✅ Great approach! You might calmly approach her, validate her feelings, " +
|
| 13 |
+
"use simple reassuring words, offer a familiar comfort item, " +
|
| 14 |
+
"and gently guide her back to bed.";
|
| 15 |
+
|
| 16 |
document.getElementById('feedbackText').innerText = feedback;
|
| 17 |
showScreen(4);
|
| 18 |
}
|