poni 2 years ago
parent b45ab8e359
commit f908e60804

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

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

Loading…
Cancel
Save