Files
life_generators/quote.js
2023-10-01 17:35:21 +08:00

39 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const quoteElement = document.getElementById("quote");
const authorElement = document.getElementById("author");
const buttonElement = document.querySelector("button");
const quotes = [
{
quote: "To AC is human. To AK divine.",
author: "Moon"
},
{
quote: "Life is like riding a bicycle. To keep your balance, you must keep moving.",
author: "Albert Einstein"
},
{
quote: "A dream is what makes people love life even when it is painful.",
author: "Theodore Zeldin"
},
{
quote: "Dont quit. Suffer now and live the rest of your life as a champion.",
author: "Muhammad Ali"
},
];
function Appear() {
const index = Math.floor(Math.random() * quotes.length);
const { quote, author } = quotes[index];
console.log(index)
quoteElement.innerHTML = `<b style='font-size:16px;'>"</b>` + quote + `<b style='font-size:16px;'>"</b>` ;
authorElement.innerHTML = "- " + author;
}
function getQuote() {
let a = parseInt(Math.random() * 255);
let str = `rgba(${a}, ${Math.abs(a - 127)}, ${Math.abs(a - 255)}, 0.55)`;
console.log(str);
Update(str);
}
getQuote();