Skip to content

Commit 824a1b5

Browse files
authored
Merge pull request #29 from tajulafreen/Day_Predictor
50Projects-HTML-CSS-JavaScript : Day predictor
2 parents 6ad943b + 7436fa8 commit 824a1b5

File tree

4 files changed

+126
-0
lines changed

4 files changed

+126
-0
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,17 @@ In order to run this project you need:
298298
</details>
299299
</li>
300300

301+
<li>
302+
<details>
303+
<summary>Day Predictor</summary>
304+
<p>A Simple Week Day Predictor App written in HTML, CSS, and JavaScript. This app displays the current day of the week along with a corresponding motivational quote, using local computer time.</p>
305+
<ul>
306+
<li><a href="https://tajulafreen.github.io/50Projects-HTML-CSS-JavaScript/Source-Code/DayPredictor/">Live Demo</a></li>
307+
<li><a href="https://github.com/tajulafreen/50Projects-HTML-CSS-JavaScript/tree/main/Source-Code/DayPredictor">Source</a></li>
308+
</ul>
309+
</details>
310+
</li>
311+
301312
</ol>
302313

303314
<p align="right">(<a href="#readme-top">back to top</a>)</p>

Source-Code/DayPredictor/index.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7+
<link rel="stylesheet" href="style.css" />
8+
<title>Day Predictor</title>
9+
</head>
10+
11+
<body>
12+
<div id="container">
13+
<h1>Today is:</h1>
14+
<ul>
15+
<li>
16+
<span id="weekday"> Display day of the week. </span>
17+
</li>
18+
<li>
19+
<span id="phrase">Display a quote</span>
20+
</li>
21+
</ul>
22+
</div>
23+
<script src="script.js"></script>
24+
</body>
25+
</html>

Source-Code/DayPredictor/script.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
document.addEventListener('DOMContentLoaded', () => {
2+
// Grab day of the week from local computer
3+
const date = new Date();
4+
const dayOfWeekNumber = date.getDay();
5+
let nameOfDay;
6+
let quote;
7+
8+
switch (dayOfWeekNumber) {
9+
case 0:
10+
nameOfDay = 'Sunday';
11+
quote = 'Time to chillax!';
12+
break;
13+
case 1:
14+
nameOfDay = 'Monday';
15+
quote = 'Monday morning blues!';
16+
break;
17+
case 2:
18+
nameOfDay = 'Tuesday';
19+
quote = 'Taco Time!';
20+
break;
21+
case 3:
22+
nameOfDay = 'Wednesday';
23+
quote = 'Two more days to the weekend.';
24+
break;
25+
case 4:
26+
nameOfDay = 'Thursday';
27+
quote = 'The weekend is almost here...';
28+
break;
29+
case 5:
30+
nameOfDay = 'Friday';
31+
quote = 'Weekend is here!';
32+
break;
33+
case 6:
34+
nameOfDay = 'Saturday';
35+
quote = 'Time to party!';
36+
break;
37+
default:
38+
nameOfDay = 'Unknown';
39+
quote = '';
40+
}
41+
42+
// Display the day of the week
43+
const weekdayDiv = document.getElementById('weekday');
44+
weekdayDiv.innerHTML = `${nameOfDay}`;
45+
46+
// Display quote
47+
const quoteDiv = document.getElementById('phrase');
48+
quoteDiv.innerHTML = `${quote}`;
49+
});

Source-Code/DayPredictor/style.css

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
body {
2+
font-family: Arial, Helvetica, sans-serif;
3+
margin: 50px;
4+
background: #fff;
5+
}
6+
7+
#container {
8+
width: 500px;
9+
height: 350px;
10+
background-color: rgb(157, 255, 0);
11+
margin: auto;
12+
border-radius: 30px;
13+
padding: 20px;
14+
}
15+
16+
h1 {
17+
font-size: 40px;
18+
font-weight: 900;
19+
text-transform: uppercase;
20+
text-align: center;
21+
color: #f533e8;
22+
}
23+
24+
ul {
25+
list-style-type: none;
26+
display: flex;
27+
flex-direction: column;
28+
align-items: center;
29+
}
30+
31+
#weekday {
32+
font-size: 40px;
33+
color: #dd5800;
34+
font-weight: 800;
35+
}
36+
37+
#phrase {
38+
font-size: 40px;
39+
color: #00f;
40+
font-weight: 800;
41+
}

0 commit comments

Comments
 (0)