mirror of
https://gitlab.com/2-chainz/2-chainz-rest-site.git
synced 2025-06-16 15:17:24 +00:00
17 lines
433 B
JavaScript
17 lines
433 B
JavaScript
getQuote();
|
|
|
|
function getQuote() {
|
|
fetch("https://api.chainz.rest")
|
|
.then(resp => resp.json())
|
|
.then(function(data) {
|
|
document.getElementById("quote").innerHTML = data.quote;
|
|
|
|
const tweet = encodeURIComponent(
|
|
`"${data.quote}"-@2chainz via https://api.chainz.rest @ajzbc`
|
|
);
|
|
document.getElementById(
|
|
"tweet"
|
|
).href = `https://twitter.com/intent/tweet?text=${tweet}`;
|
|
});
|
|
}
|