You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.27.2/axios.min.js" integrity="sha512-odNmoc1XJy5x1TMVMdC7EMs3IVdItLPlCeL5vSUPN2llYKMJ2eByTTAIiiuqLg+GdNr9hF6z81p27DArRFKT7A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<title>Harvesting the Net</title>
</head>
<body>
<!-- Here is where the text is rendered -->
<div id="text">
<p class="marquee">
</p>
</div>
<script>
var fetchInterval = 1000 //3200
let n = 0
// Fetch data from a json read by Flask
function getData() {
url = "/api/datapoint";
axios.get(url)
.then(function(response) {
if (response.data.text[String(n)]) {
document.querySelector('.marquee').innerHTML += `<b> ${response.data.text[String(n)]} •</b>`
}
n++
})
.catch(function(error) {
console.log(error);
});
}
var intervalID = window.setInterval(getData, fetchInterval);
</script>
</body>
</html>