Spaces:
Running
Running
Create scripts.js
Browse files- scripts.js +31 -0
scripts.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function orderNow() {
|
| 2 |
+
alert("Ваш заказ принят! Добро пожаловать в будущее чистой кожи с Revolut!");
|
| 3 |
+
}
|
| 4 |
+
|
| 5 |
+
function hoverEffect(element) {
|
| 6 |
+
element.style.transform = "scale(1.05)";
|
| 7 |
+
element.style.transition = "transform 0.3s ease";
|
| 8 |
+
element.addEventListener('mouseout', () => {
|
| 9 |
+
element.style.transform = "scale(1)";
|
| 10 |
+
});
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
// Имитация голосового управления (тренд 2070)
|
| 14 |
+
window.addEventListener('load', () => {
|
| 15 |
+
if ('speechSynthesis' in window) {
|
| 16 |
+
const msg = new SpeechSynthesisUtterance("Добро пожаловать в Revolut. Скажите 'Заказать', чтобы купить крем.");
|
| 17 |
+
window.speechSynthesis.speak(msg);
|
| 18 |
+
}
|
| 19 |
+
});
|
| 20 |
+
|
| 21 |
+
if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) {
|
| 22 |
+
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
| 23 |
+
recognition.lang = 'ru-RU';
|
| 24 |
+
recognition.onresult = (event) => {
|
| 25 |
+
const command = event.results[0][0].transcript.toLowerCase();
|
| 26 |
+
if (command.includes('заказать')) {
|
| 27 |
+
orderNow();
|
| 28 |
+
}
|
| 29 |
+
};
|
| 30 |
+
recognition.start();
|
| 31 |
+
}
|