|
@@ -59,9 +59,15 @@ function myFunction_b(value, index, array) {
|
|
|
|
|
|
|
|
|
|
|
|
+function formatListAsLi(thisList){
|
|
|
+ toRet = "";
|
|
|
+ thisList.forEach(value => toRet += "<li>" + value + "</li>");
|
|
|
+ return toRet;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
-async function fillPageContents(){
|
|
|
+async function getPageInfo(){
|
|
|
var out = {};
|
|
|
|
|
|
|
|
@@ -84,33 +90,14 @@ async function fillPageContents(){
|
|
|
|
|
|
|
|
|
out.toponimi = await doJsonQuery(queryToponimo);
|
|
|
-
|
|
|
- console.log("PROT", Object.getPrototypeOf(out));
|
|
|
- var strunz = new Strunz();
|
|
|
- console.log("str", Object.getPrototypeOf(strunz));
|
|
|
+
|
|
|
return out;
|
|
|
}
|
|
|
|
|
|
-class Strunz{
|
|
|
- constructor(){
|
|
|
- this.puzzo = "";
|
|
|
- this.merda = "";
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
|
|
|
-function putValuesInHTML(){
|
|
|
-
|
|
|
-
|
|
|
- console.log("Stringified Response:", queryStringOutput);
|
|
|
-
|
|
|
- queryOutput = {};
|
|
|
-
|
|
|
- console.log('QO', queryOutput2);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+function updatePage(queryOutput){
|
|
|
+
|
|
|
if(queryOutput.titolo) document.getElementById("title").innerHTML = queryOutput.titolo.value;
|
|
|
if(queryOutput.mittente) document.getElementById("mittente_id").innerHTML = queryOutput.mittente.value;
|
|
|
if(queryOutput.destinatario) document.getElementById("destinatario_id").innerHTML = queryOutput.destinatario.value;
|
|
@@ -124,13 +111,18 @@ function putValuesInHTML(){
|
|
|
if(queryOutput.segnatura_OVI) document.getElementById("segnatura_id").innerHTML = queryOutput.segnatura_OVI.value;
|
|
|
if(queryOutput.edizione) document.getElementById("edizione_id").innerHTML = queryOutput.edizione.value;
|
|
|
if(queryOutput.testo_lemmatizzato) document.getElementById("trascrizione_id").innerHTML = queryOutput.testo_lemmatizzato.value;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- document.getElementById("antroponimi").innerHTML = "<li>MM</li>" + list_a;
|
|
|
- document.getElementById("toponimi").innerHTML = "<li>MM</li>" + list_b;
|
|
|
+
|
|
|
+ if(queryOutput.toponimi && queryOutput.toponimi.length){
|
|
|
+ const listaToponimi = queryOutput.toponimi.map(elem => elem.toponimo.value);
|
|
|
+ console.log(listaToponimi);
|
|
|
+ document.getElementById("toponimi").innerHTML = formatListAsLi(listaToponimi);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+async function initPage(){
|
|
|
+ const pageInfo = await getPageInfo();
|
|
|
+ updatePage(pageInfo);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-var pageContents = fillPageContents();
|
|
|
-console.log(pageContents);
|
|
|
+initPage();
|