cleaned up directory

This commit is contained in:
2024-04-30 00:41:42 -05:00
parent 357f513cdd
commit 37d711da06
28 changed files with 31 additions and 178 deletions

33
public/js/app.js Normal file
View File

@ -0,0 +1,33 @@
'use strict';
// Full year for footer
const todayDate = new Date();
jsyear.innerText = todayDate.getFullYear();
const quoteDisplay = document.querySelector(".quote");
let numQuotes;
let randomNum;
let intervalID;
let iteratorID = 0;
let currQuote;
fetch("https://cdn.fyrfli.link/FavouriteQuotes.json")
.then((response) => {
return response.json();
})
.then((data) => {
currQuote = getQuote(data);
for (let i = 0; i < 50; i++) {
quoteDisplay.innerText = currQuote;
intervalID = setInterval(() => {
currQuote = getQuote(data);
quoteDisplay.innerText = currQuote;
}, 12000);
}
});
function getQuote(data) {
let noQuotes = Object.entries(data).length;
let randNo = Math.floor(Math.random() * noQuotes);
return data[randNo].quote + "\n\n" + data[randNo].author.replace(/"/g, '');
}

23
public/js/layout.js Normal file
View File

@ -0,0 +1,23 @@
'use strict';
// Full year for footer
const todayDate = new Date();
jsyear.innerText = todayDate.getFullYear();
const quoteDisplay = document.querySelector(".quotes");
const debugDisplay = document.querySelector(".debug");
let i = 0;
let quote_section = "";
fetch("https://cdn.fyrfli.link/FavouriteQuotes.json")
.then((response) => {
return response.json();
})
.then((data) => {
while (i < Object.entries(data).length) {
quote_section = document.createElement("section")
quote_section.className = "quote";
quote_section.innerText = "\"" + data[i].quote + "\"\n\n" + data[i].author;
quoteDisplay.appendChild(quote_section);
i++;
}
});