Switched over to ExpressJS Hosting
++ CS212-Projects file copy ++ public folder ++ node stuff
This commit is contained in:
parent
a7acb7acc8
commit
60087976ca
473 changed files with 66395 additions and 0 deletions
12
public/cs212/testing/digital-clock/index.html
Normal file
12
public/cs212/testing/digital-clock/index.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset = "utf-8">
|
||||
<title> Digital Clock Using JavaScript </title>
|
||||
<link rel = "stylesheet" href = "styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id = "digital-clock"> </div>
|
||||
<script src = "script.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
56
public/cs212/testing/digital-clock/script.js
Normal file
56
public/cs212/testing/digital-clock/script.js
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
function Time() {
|
||||
|
||||
// Creating object of the Date class
|
||||
var date = new Date();
|
||||
|
||||
// Get current hour
|
||||
var hour = date.getHours();
|
||||
// Get current minute
|
||||
var minute = date.getMinutes();
|
||||
// Get current second
|
||||
var second = date.getSeconds();
|
||||
|
||||
// Variable to store AM / PM
|
||||
var period = "";
|
||||
|
||||
// Assigning AM / PM according to current hour
|
||||
if (hour >= 12) {
|
||||
period = "PM";
|
||||
} else {
|
||||
period = "AM";
|
||||
}
|
||||
|
||||
// Converting the hour in 12-hour format
|
||||
if (hour == 0) {
|
||||
hour = 12;
|
||||
} else {
|
||||
if (hour > 12) {
|
||||
hour = hour - 12;
|
||||
}
|
||||
}
|
||||
|
||||
// Updating hour, minute, and second
|
||||
// if they are less than 10
|
||||
hour = update(hour);
|
||||
minute = update(minute);
|
||||
second = update(second);
|
||||
|
||||
// Adding time elements to the div
|
||||
document.getElementById("digital-clock").innerText = hour + " : " + minute + " : " + second + " " + period;
|
||||
|
||||
// Set Timer to 1 sec (1000 ms)
|
||||
setTimeout(Time, 1000);
|
||||
}
|
||||
|
||||
// Function to update time elements if they are less than 10
|
||||
// Append 0 before time elements if they are less than 10
|
||||
function update(t) {
|
||||
if (t < 10) {
|
||||
return "0" + t;
|
||||
}
|
||||
else {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
Time();
|
||||
20
public/cs212/testing/digital-clock/styles.css
Normal file
20
public/cs212/testing/digital-clock/styles.css
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* Importing Open Sans Condensed Google font */
|
||||
@import url('https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&display=swap');
|
||||
|
||||
|
||||
#digital-clock {
|
||||
background-color: #66ffff;
|
||||
width: 35%;
|
||||
margin: auto;
|
||||
padding-top: 50px;
|
||||
padding-bottom: 50px;
|
||||
font-family: 'Open Sans Condensed', sans-serif;
|
||||
font-size: 64px;
|
||||
text-align: center;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
Footer
|
||||
© 2023 GitHub, Inc.
|
||||
Footer navigation
|
||||
Terms
|
||||
Priv
|
||||
Loading…
Add table
Add a link
Reference in a new issue