master push to gitlab

This commit is contained in:
Camille Frantz 2022-05-18 10:10:25 -05:00
parent 0ce4c9a6cb
commit edc1177984
4 changed files with 104 additions and 7 deletions

34
app.js
View File

@ -3,13 +3,41 @@ const todayDate = new Date();
jsyear.innerText = todayDate.getFullYear(); jsyear.innerText = todayDate.getFullYear();
const disp = document.querySelector(".display"); const disp = document.querySelector(".display");
const numIterations = 20;
let ctr = 0;
fetch("FavouriteQuotes.json") fetch("FavouriteQuotes.json")
.then((response) => { .then((response) => {
return response.json(); return response.json();
}) })
.then((data) => { .then((data) => {
numQuotes = Object.entries(data).length; // quotes = data;
num = Math.floor(Math.random() * numQuotes); doTheLoop(data);
disp.innerText = data[num].quote + "\n\n" + data[num].author.replace(/"/g, '');
}) })
// doTheLoop(quotes);
function doTheLoop(quotes) {
console.log("Entering doTheLoop");
numQuotes = Object.entries(quotes).length;
console.log(numQuotes);
getQuote(quotes, numQuotes);
timerID = setInterval(getQuote, 6000, quotes, numQuotes);
console.log("Timer ID: " + timerID);
setTimeout(() => {
console.log("Stopping");
clearInterval(timerID);
console.log("Stopped");
30000
});
}
function getQuote(quotes, numQuotes) {
console.log("Entering getQuote");
num = Math.floor(Math.random() * numQuotes);
disp.classList.remove(".hidden");
disp.classList.add(".anim");
disp.innerText = quotes[num].quote + "\n\n" + quotes[num].author.replace(/"/g, '');
disp.classList.remove(".anim");
// disp.classList.add(".hidden");
}

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -7,10 +7,11 @@
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" /> content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<title>read quote</title> <title>read quote</title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
</head> </head>
<body> <body>
<div class="display"></div> <div class="display hidden"></div>
<div class="instructions"> <div class="instructions">
<p>{{ Hit Reload to see a new quote }}</p> <p>{{ Hit Reload to see a new quote }}</p>
</div> </div>

View File

@ -1,6 +1,4 @@
body { body {
width: 80vw;
max-width: 500px;
margin: auto; margin: auto;
padding-top: 4rem; padding-top: 4rem;
background-color: beige; background-color: beige;
@ -8,7 +6,14 @@
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
} }
.hidden {
display: none;
}
.display { .display {
width: 80vw;
max-width: 500px;
margin-top: 12rem;
background: linear-gradient(to bottom right, #0c024d, #0dbcc5); background: linear-gradient(to bottom right, #0c024d, #0dbcc5);
background-attachment: fixed; background-attachment: fixed;
color: white; color: white;
@ -17,7 +22,67 @@
border-radius: 12px; border-radius: 12px;
} }
.anim {
animation: fadeIn linear 4s;
-webkit-animation: fadeIn linear 4s;
-moz-animation: fadeIn linear 4s;
-o-animation: fadeIn linear 4s;
-ms-animation: fadeIn linear 4s
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-moz-keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-webkit-keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-o-keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@-ms-keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.instructions { .instructions {
display: none;
margin-top: 2rem; margin-top: 2rem;
text-align: center; text-align: center;
border-bottom: 1px dotted #0c024d; border-bottom: 1px dotted #0c024d;
@ -26,9 +91,12 @@
} }
.footer { .footer {
display: block;
position: relative;
top: 30rem;
text-align: center; text-align: center;
font-size: 0.8rem; font-size: 0.8rem;
margin-top: 2rem; margin: 2rem auto;
} }
.footer a:any-link { .footer a:any-link {