-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<!DOCTYPE html> | ||
<!-- saved from url=(0096)http://54.148.210.209/swiper1/animated/dist/plainhtmlquoteloadjsonfromapigatewayopensearch1.html --> | ||
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
|
||
<title>Wikistats Bulk Quotes Example</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> | ||
<!-- Link Swiper's CSS --> | ||
<link rel="stylesheet" href="./Wikistats_Bulk_Quotes_Example_files/water.css"> | ||
|
||
|
||
|
||
<style>body{background-color:#000}.quote{margin:0;background:#eee;padding:1em;border-radius:1em}.quote figcaption,.quote blockquote{margin:1em}.quote cite{font-size:10px}</style> | ||
<script></script> | ||
|
||
|
||
|
||
</head> | ||
|
||
<body> | ||
|
||
|
||
<button>Refresh Quotes | ||
<div id="plain"> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
<script> | ||
|
||
document.addEventListener("DOMContentLoaded", () => { | ||
const button = document.querySelector("button"); | ||
|
||
async function refreshQuote() { | ||
// Fetching 10 random quotes (bulk) | ||
// https://github.com/statistron/wikistats | ||
|
||
var url = "https://api.statistron.xyz/v1/wikistats?q=bulk"; | ||
fetch(url) | ||
.then((response) => response.json()) | ||
.then((jsonstat) => { | ||
console.log(jsonstat); | ||
|
||
//Check if div quote exists, if it does, remove it to display the next set of quotes | ||
|
||
var isdivquote = document.getElementsByClassName("div-quote"); | ||
if (isdivquote.length > 0) { | ||
document.querySelectorAll(".div-quote").forEach((el) => el.remove()); | ||
} | ||
|
||
// loop through the objects in the response array | ||
|
||
for (var i = 0; i < jsonstat.length; i += 1) { | ||
var div = document.createElement("div"); | ||
|
||
div.className = "div-quote"; | ||
|
||
div.innerHTML = | ||
'<figure class="quote"><blockquote>' + | ||
jsonstat[i].quote + | ||
"</blockquote><figcaption> —<cite>" + | ||
jsonstat[i].source + | ||
"</cite> </figcaption></figure> <br>"; | ||
|
||
document.body.appendChild(div); | ||
} | ||
}); | ||
} | ||
button.addEventListener("click", refreshQuote); | ||
|
||
// call refreshQuote | ||
refreshQuote(); | ||
}); | ||
|
||
</script> | ||
|
||
|
||
</button><div class="div-quote"><figure class="quote"><blockquote>When Rainier became prince in 1949, it had accounted for more than 95 percent.</blockquote><figcaption> —<cite>Rainier Iii, Prince Of Monaco | Wikipedia</cite> </figcaption></figure> <br></div><div class="div-quote"><figure class="quote"><blockquote>The first $9,275 that they earned falls into the first tax bracket ($0 $9275, which has a 10% tax rate).</blockquote><figcaption> —<cite>Income Tax In The United States | Wikipedia</cite> </figcaption></figure> <br></div><div class="div-quote"><figure class="quote"><blockquote>Over half (58.6%) of residents listed Pitjantjatjara as the language spoken at home; 14.3% listed Yankunytjatjara; and 18.7% gave English as their spoken language.</blockquote><figcaption> —<cite>Anangu Pitjantjatjara Yankunytjatjara | Wikipedia</cite> </figcaption></figure> <br></div><div class="div-quote"><figure class="quote"><blockquote>If the person cannot tell which of the 2 is the machine more than 50% of the time, then the machine is said to be intelligent.</blockquote><figcaption> —<cite>Turing Test | Wikipedia</cite> </figcaption></figure> <br></div><div class="div-quote"><figure class="quote"><blockquote>Analyzing the GDP of Curitiba, it appears that in the period from 1995 to 2000, the economy grew about 3% a year.</blockquote><figcaption> —<cite>Curitiba | Wikipedia</cite> </figcaption></figure> <br></div><div class="div-quote"><figure class="quote"><blockquote>At least 80% majority of the people are Sunni.</blockquote><figcaption> —<cite>Tikrit | Wikipedia</cite> </figcaption></figure> <br></div><div class="div-quote"><figure class="quote"><blockquote>48,179 people (53.6% of the population) lived in owner-occupied housing units and 39,662 people (44.1%) lived in rental housing units.</blockquote><figcaption> —<cite>Redding, California | Wikipedia</cite> </figcaption></figure> <br></div><div class="div-quote"><figure class="quote"><blockquote>In 2020, King Kong held a score of 98% Certified Fresh based on 66 reviews on Rotten Tomatoes.</blockquote><figcaption> —<cite>King Kong (1933 Movie) | Wikipedia</cite> </figcaption></figure> <br></div><div class="div-quote"><figure class="quote"><blockquote>The movie gained extremely negative reviews from critics and holds a 6% rating on Rotten Tomatoes.</blockquote><figcaption> —<cite>Kazaam | Wikipedia</cite> </figcaption></figure> <br></div></body></html> |