Skip to content
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

Create novocabeçalho.html #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
172 changes: 172 additions & 0 deletions novocabeçalho.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@

<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Greetings</title>

<style>


body{
font-variant-caps: all-petite-caps;


}

.widget {
padding: 5px 5px ;
color: #000000;
display: flex;
justify-content:center;
align-items:center;
flex-direction: column;
max-width: 95%;
margin: auto;
border: 3px solid #000000;
border-radius: 5px;
box-shadow: 2px 2px 1px 0px #000000;

}


.greet{
font-size: 3em;
}

.date {

font-family: monospace;
font-size: 2em;
}

.clock {
font-family: monospace;
font-size: 2em;
}

.time {
display: inline-block;
min-width: 20px;
}

.colon {
font-size: 1em;
display: inline-block;
}






</style>
</head>
<body>




<div class="container>">
<div class="widget">

<div class="greet" id="greet"></div>

<div class="date" id="date"></div>
<div class="clock">
<div class="time" id="hour"></div>
<div class="colon">:</div>
<div class="time" id="min"></div>
<div class="colon">:</div>
<div class="time" id="sec"></div>
</div>




</div>
</div>




<script>

function dispalyGreetings(today){
hrs = today.getHours();
name=""
if (hrs < 12)
greet = 'Good Morning '+name;
else if (hrs >= 12 && hrs <= 17)
greet = 'Good Afternoon '+name;
else if (hrs >= 17 && hrs <= 24)
greet = 'Good Evening '+name;
document.getElementById('greet').innerHTML = greet;

}

function dispalyDate(today) {

const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];

var dayName = days[today.getDay()];
var monthName = monthNames[today.getMonth()];
var date = today.getDate();
var year = today.getFullYear();
document.getElementById('date').innerHTML =dayName+", "+monthName+" "+date+" "+year;

}


function dispalyClock(today) {

var hour = padZeros(twelveHour(today.getHours()));
var minutes = padZeros(today.getMinutes());
var seconds = padZeros(today.getSeconds());

if(today.getHours() >=12){
seconds+=" pm"
}
else{
seconds+=" am"
}

document.getElementById('hour').innerHTML = hour;
document.getElementById('min').innerHTML = minutes;
document.getElementById('sec').innerHTML = seconds;
}

function twelveHour(hour) {
if (hour > 12) {
return hour -= 12
} else if (hour === 0) {
return hour = 12;
} else {
return hour
}
}
function padZeros(num) {
if (num < 10) {
num = '0' + num
};
return num;
}

function dispalyWidget() {
var today = new Date();
dispalyGreetings(today);
dispalyDate(today);
dispalyClock(today);
setTimeout(dispalyWidget, 500);
}

dispalyWidget()

</script>

</body>
</html>