-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
69 lines (69 loc) · 2.26 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Weather Forecast</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f8ff;
color: #333;
text-align: center;
padding: 50px;
}
h1 {
color: #4CAF50;
}
input {
padding: 10px;
width: 300px;
font-size: 16px;
}
button {
padding: 10px 20px;
margin-left: 10px;
font-size: 16px;
cursor: pointer;
}
.loading {
font-size: 20px;
color: #ff9800;
display: none;
}
.response {
margin-top: 20px;
font-size: 18px;
font-weight: bold;
}
.emoji {
font-size: 30px;
}
</style>
</head>
<body>
<h1>Weather Forecast</h1>
<p>Type your weather query below:</p>
<input type="text" id="query" placeholder="How's the weather today?">
<button onclick="getWeather()">Check Weather</button>
<div id="loadingMessage" class="loading">Getting request, determining weather outside for today, gathering information...</div>
<div id="response" class="response"></div>
<script>
function getWeather() {
const query = document.getElementById("query").value.toLowerCase();
const loadingMessage = document.getElementById("loadingMessage");
const response = document.getElementById("response");
loadingMessage.style.display = "block";
response.innerHTML = '';
setTimeout(() => {
loadingMessage.style.display = "none";
if (query.includes("weather") || query.includes("how's the weather")) {
response.innerHTML = "Just look outside the window bro <span class='emoji'>😊</span>";
} else {
response.innerHTML = "I couldn't quite understand that. Try asking about the weather!";
}
}, 3000);
}
</script>
</body>
</html>