mirror of
https://github.com/runyanjake/olomana.git
synced 2025-10-04 21:27:29 -07:00
71 lines
2.4 KiB
JavaScript
71 lines
2.4 KiB
JavaScript
const quotes = [
|
|
{
|
|
text: "The only way to do great work is to love what you do.",
|
|
author: "Steve Jobs",
|
|
link: "https://en.wikipedia.org/wiki/Steve_Jobs"
|
|
},
|
|
{
|
|
text: "Success is not final, failure is not fatal: It is the courage to continue that counts.",
|
|
author: "Winston Churchill",
|
|
link: "https://en.wikipedia.org/wiki/Winston_Churchill"
|
|
},
|
|
{
|
|
text: "In the end, it's not the years in your life that count. It's the life in your years.",
|
|
author: "Abraham Lincoln",
|
|
link: "https://en.wikipedia.org/wiki/Abraham_Lincoln"
|
|
},
|
|
{
|
|
text: "I should be on in a few minutes.",
|
|
author: "Jake, in the moments before baiting",
|
|
link: "https://www.youtube.com/channel/UCZctf3QSXXk9a5KzrAJ2bmw"
|
|
},
|
|
{
|
|
text: "It's good news!",
|
|
author: "Sujay",
|
|
link: "https://anditsgood.news/"
|
|
},
|
|
{
|
|
text: "It's bad news.",
|
|
author: "Sujay",
|
|
link: "https://anditsgood.news/"
|
|
},
|
|
{
|
|
text: "Meow",
|
|
author: "Tobee",
|
|
link: "https://gallery.whitney.rip/library/albums/as3wif72i18kzs9q/tobee-and-maymay"
|
|
},
|
|
{
|
|
text: "Meow",
|
|
author: "MayMay",
|
|
link: "https://gallery.whitney.rip/library/albums/as3wif72i18kzs9q/tobee-and-maymay"
|
|
},
|
|
];
|
|
const failureMessageQOTD = 'Failed to fetch the quote of the day. Please try again later.';
|
|
|
|
async function getQOTD() {
|
|
var daysSinceEpoch = new Date().getTime() / (1000 * 60 * 60 * 24);
|
|
const idx = Math.floor(daysSinceEpoch % quotes.length);
|
|
return quotes[idx];
|
|
}
|
|
|
|
async function renderQOTD() {
|
|
const quoteData = await getQOTD();
|
|
const quoteElement = document.getElementById('quote-content');
|
|
|
|
console.log(`Rendering Today's Quote: "${quoteData.text}" - ${quoteData.author}`);
|
|
|
|
try {
|
|
if(quoteData) {
|
|
const html = `<p>"${quoteData.text}" - <a href="${quoteData.link}">${quoteData.author}</a></p>`;
|
|
quoteElement.innerHTML = html;
|
|
} else {
|
|
quoteSection.innerHTML = `<p>${failureMessageQOTD}</p>`;
|
|
}
|
|
} catch (error) {
|
|
console.error('Error rendering Quote of the Day:', error);
|
|
quoteSection.innerHTML = `<p>${failureMessageQOTD}</p>`;
|
|
}
|
|
}
|
|
|
|
console.log("Thanks for checking out PWS!");
|
|
document.addEventListener('DOMContentLoaded', renderQOTD); |