Skip to content

50Projects-HTML-CSS-JavaScript : Day predictor #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,17 @@ In order to run this project you need:
details>
li>

<li>
<details>
<summary>Day Predictorsummary>
<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>
<ul>
<li><a href="https://tajulafreen.github.io/50Projects-HTML-CSS-JavaScript/Source-Code/DayPredictor/">Live Demoa>li>
<li><a href="https://github.com/tajulafreen/50Projects-HTML-CSS-JavaScript/tree/main/Source-Code/DayPredictor">Sourcea>li>
ul>
details>
li>

ol>

<p align="right">(<a href="#readme-top">back to topa>)p>
Expand Down
25 changes: 25 additions & 0 deletions Source-Code/DayPredictor/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Day Predictor

Today is:

  • Display day of the week.
  • Display a quote
    49 changes: 49 additions & 0 deletions Source-Code/DayPredictor/script.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    document.addEventListener('DOMContentLoaded', () => {
    // Grab day of the week from local computer
    const date = new Date();
    const dayOfWeekNumber = date.getDay();
    let nameOfDay;
    let quote;

    switch (dayOfWeekNumber) {
    case 0:
    nameOfDay = 'Sunday';
    quote = 'Time to chillax!';
    break;
    case 1:
    nameOfDay = 'Monday';
    quote = 'Monday morning blues!';
    break;
    case 2:
    nameOfDay = 'Tuesday';
    quote = 'Taco Time!';
    break;
    case 3:
    nameOfDay = 'Wednesday';
    quote = 'Two more days to the weekend.';
    break;
    case 4:
    nameOfDay = 'Thursday';
    quote = 'The weekend is almost here...';
    break;
    case 5:
    nameOfDay = 'Friday';
    quote = 'Weekend is here!';
    break;
    case 6:
    nameOfDay = 'Saturday';
    quote = 'Time to party!';
    break;
    default:
    nameOfDay = 'Unknown';
    quote = '';
    }

    // Display the day of the week
    const weekdayDiv = document.getElementById('weekday');
    weekdayDiv.innerHTML = `${nameOfDay}`;

    // Display quote
    const quoteDiv = document.getElementById('phrase');
    quoteDiv.innerHTML = `${quote}`;
    });
    41 changes: 41 additions & 0 deletions Source-Code/DayPredictor/style.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 50px;
    background: #fff;
    }

    #container {
    width: 500px;
    height: 350px;
    background-color: rgb(157, 255, 0);
    margin: auto;
    border-radius: 30px;
    padding: 20px;
    }

    h1 {
    font-size: 40px;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
    color: #f533e8;
    }

    ul {
    list-style-type: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    }

    #weekday {
    font-size: 40px;
    color: #dd5800;
    font-weight: 800;
    }

    #phrase {
    font-size: 40px;
    color: #00f;
    font-weight: 800;
    }
    Loading