-
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.
good morning,afternoon, and evening code working.
- Loading branch information
Showing
3 changed files
with
113 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,38 @@ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
overflow: hidden; | ||
|
||
} | ||
|
||
img { | ||
|
||
} | ||
|
||
#img{ | ||
|
||
} | ||
|
||
/* Google font */ | ||
@import url('https://fonts.googleapis.com/css?family=Orbitron'); | ||
|
||
#clock { | ||
font-family: 'Orbitron', sans-serif; | ||
color: #66ff99; | ||
font-size: 56px; | ||
position: absolute; | ||
top: 50%; | ||
left: 34%; | ||
|
||
|
||
} | ||
p{ | ||
position: absolute; | ||
top: 40%; | ||
left: 34%; | ||
font-family: 'Orbitron', sans-serif; | ||
color: #66ff99; | ||
font-size: 20px; | ||
} | ||
|
||
|
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,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Final Project</title> | ||
<link rel="stylesheet" href="css/style.css"> | ||
</head> | ||
<body> | ||
<div id="clock"></div> | ||
<p id="good"> <span> <input type="text" editable name></span></p> | ||
|
||
<div id="img"></div> | ||
|
||
|
||
|
||
|
||
<script src="js/this.js"></script> | ||
</body> | ||
</html> |
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,55 @@ | ||
const numItemsToGenerate = 1; | ||
|
||
function renderItem(){ | ||
fetch(`https://source.unsplash.com/1600x900/?morning`).then((response)=> { | ||
let item = document.getElementById("img"); | ||
item.classList.add('item'); | ||
item.innerHTML = ` | ||
<img class="morning-image" src="${response.url}" alt="morning image"/> | ||
` | ||
document.documentElement.appendChild(item); | ||
}) | ||
} | ||
for(let i=0;i<numItemsToGenerate;i++){ | ||
renderItem(); | ||
}; | ||
|
||
|
||
|
||
function currentTime() { | ||
var date = new Date(); /* creating object of Date class */ | ||
var hour = date.getHours(); | ||
var min = date.getMinutes(); | ||
var sec = date.getSeconds(); | ||
var midday = "AM"; | ||
midday = (hour >= 12) ? "PM" : "AM"; /* assigning AM/PM */ | ||
hour = (hour == 0) ? 12 : ((hour > 12) ? (hour - 12): hour); /* assigning hour in 12-hour format */ | ||
hour = updateTime(hour); | ||
min = updateTime(min); | ||
sec = updateTime(sec); | ||
document.getElementById("clock").innerText = hour + " : " + min + " : " + sec + " " + midday; /* adding time to the div */ | ||
var t = setTimeout(currentTime, 1000); /* setting timer */ | ||
} | ||
|
||
function updateTime(k) { /* appending 0 before time elements if less than 10 */ | ||
if (k < 10) { | ||
return "0" + k; | ||
} | ||
else { | ||
return k; | ||
} | ||
} | ||
|
||
currentTime(); | ||
|
||
|
||
var today = new Date() | ||
var curHr = today.getHours() | ||
|
||
if (curHr < 12) { | ||
document.write('good morning').getElementById('good') | ||
} else if (curHr < 18) { | ||
document.write('good afternoon').getElementById('good') | ||
} else { | ||
document.write('good evening').getElementById('good') | ||
} |