poni 2 years ago
parent b45ab8e359
commit f908e60804

@ -21,15 +21,15 @@ def index():
def api_datapoint():
metaDict = open('meta.json',)
meta = json.load(metaDict)
# metaDict = open('meta.json',)
# meta = json.load(metaDict)
picsDict = open('pics.json',)
pics = json.load(picsDict)
dictionary_to_return = {
'meta': meta,
# 'meta': meta,
'pics': pics
}

@ -19,11 +19,12 @@
<img src="https://shortpixel.com/img/spinner2.gif" alt="">
</div>
<div id="text">
<p class="marquee">
<!-- Here is where the text is rendered -->
<!-- <div id="text">
<p class="marquee">
</p>
</div>
</div> -->
<img id="pic" src="">
<div class="viewport">
@ -37,13 +38,13 @@
<script>
// TODO: list setup to museum
// TODO: check higher quality pics
// TODO: automation scripts in parallel
// TODO: credits at the end
// TODO: attempt on button to start everything
var fetchInterval = 3200
var scrollTime = 120
let n = 0
let scrollVal = 0
@ -51,7 +52,7 @@
// Automate scrolling
function pageScroll(scroll) {
window.scrollBy(0, scroll);
scrolldelay = setTimeout(pageScroll, 50, scroll);
scrolldelay = setTimeout(pageScroll, scrollTime, scroll);
}
@ -87,12 +88,14 @@
axios.get(url)
.then(function(response) {
if (response.data.pics[String(n)]) {
scrollVal = 1
if (n >= 20){
pageScroll(scrollVal)}
scrollVal = 3
if (n >= 5){
pageScroll(scrollVal)
}
// Inject the HTML page with the src of the scraped picture and the scraped text of the metadata from Google
// TODO: animazione stabile, ora accelera, test per vedere se non fa casino
document.querySelector(".marquee").insertAdjacentHTML("afterbegin", `${response.data.meta[String(n)]} --- `)
// document.querySelector(".marquee").insertAdjacentHTML("afterbegin", `${response.data.meta[String(n)]} --- `)
document.querySelector('.scene3D').innerHTML += `<div><img id="num${String(n)}" style='margin:${r(1)}% ${r(2)}% ${r(3)}% -${r(4)}%' src=${response.data.pics[String(n)]}></div>`
n++
} else {
@ -115,7 +118,7 @@
setTimeout(() => {
document.getElementById('loading').classList.add('animate__fadeOut')
var intervalID = window.setInterval(getData, 2000);
var intervalID = window.setInterval(getData, fetchInterval);
// setTimeout(() => {
// pageScroll(scrollVal)
// }, 7000);

Loading…
Cancel
Save