forked from ShoroukAziz/notion_widgets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create time_left_in_this_week(start monday).html
- Loading branch information
1 parent
27f8bd0
commit 3d28d8f
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link href="https://fonts.googleapis.com/css2?family=Fjalla+One&display=swap" rel="stylesheet"> | ||
|
||
<title>Time Left this week</title> | ||
<style> | ||
|
||
body{ | ||
text-align: center; | ||
font-family: 'Fjalla One', sans-serif; | ||
background-color: #fff; | ||
} | ||
.box{ | ||
display: inline-block; | ||
display: inline-block; | ||
color: #fff; | ||
padding: 10px; | ||
border-radius: 5px; | ||
min-width: 40px; | ||
} | ||
#days{ | ||
background-color:#0f4d4f; | ||
} | ||
#hours{ | ||
background-color:#4CAF50; | ||
} | ||
#minutes{ | ||
background-color:#76250b; | ||
} | ||
h2{ | ||
display: inline-block; | ||
margin-right: 10px; | ||
margin-block-start: 5px; | ||
} | ||
h3{ | ||
text-align: center; | ||
|
||
} | ||
.small{ | ||
font-size: 15px; | ||
font-weight: lighter; | ||
} | ||
|
||
|
||
</style> | ||
</head> | ||
<body> | ||
|
||
<div id="counter"> | ||
<h3> | ||
Time left in This Week | ||
</h3> | ||
|
||
<h2 class="box" id="days"></h2> | ||
<h2 class="box" id="hours"></h2> | ||
<h2 class="box" id="minutes"></h2> | ||
</div> | ||
|
||
|
||
|
||
<script> | ||
function CountDownTimer () { | ||
left_days = document.getElementById("days"); | ||
left_hours = document.getElementById("hours"); | ||
left_minutes = document.getElementById("minutes"); | ||
|
||
} | ||
function showRemaining (){ | ||
now = new Date(); | ||
// days_in_this_month = new Date( now.getFullYear(), now.getMonth()+1, 0).getDate(); | ||
// week starts on Monday | ||
|
||
if(now.getDay() == 0 ){ | ||
d = 6 | ||
} | ||
else{ | ||
d = now.getDay() - 1 | ||
} | ||
days = 6 - d ; | ||
hours = 23 - now.getHours(); | ||
minutes = 59 - now.getMinutes(); | ||
left_days.innerHTML = days + "<br> <span class=\"small\"> days </span>" | ||
left_hours.innerHTML = hours + "<br> <span class=\"small\"> hours</span>"; | ||
left_minutes.innerHTML = minutes + "<br> <span class=\"small\">mins</span>"; | ||
} | ||
|
||
timer = setInterval (showRemaining, 1000) | ||
CountDownTimer() ; | ||
</script> | ||
</body> | ||
</html> |