diff --git a/js/cesareBrowse.js b/js/cesareBrowse.js index 11810a3..dd5e21e 100644 --- a/js/cesareBrowse.js +++ b/js/cesareBrowse.js @@ -756,6 +756,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«",""); text = text.replace("»",""); + text = text.replaceAll("\n"," "); value["annotazione"] = text; } @@ -764,6 +765,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«",""); text = text.replace("»",""); + text = text.replaceAll("\n"," "); value["verso"] = text; } @@ -772,6 +774,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«",""); text = text.replace("»",""); + text = text.replaceAll("\n"," "); value["commentario"] = text; } @@ -780,6 +783,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«",""); text = text.replace("»",""); + text = text.replaceAll("\n"," "); value["frammentoNota"] = text; } @@ -788,6 +792,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«",""); text = text.replace("»",""); + text = text.replaceAll("\n"," "); value["AutoreCitazione"] = text; } @@ -796,6 +801,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«",""); text = text.replace("»",""); + text = text.replaceAll("\n"," "); value["FonteCitazione"] = text; } @@ -804,6 +810,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«", ""); text = text.replace("»", ""); + text = text.replaceAll("\n"," "); value["NotaFonteCitazione"] = text; } @@ -812,6 +819,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«", ""); text = text.replace("»", ""); + text = text.replaceAll("\n"," "); value["LuogoFonteCitazione"] = text; } @@ -820,6 +828,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«", ""); text = text.replace("»", ""); + text = text.replaceAll("\n"," "); value["TestoFonteCitazione"] = text; } @@ -828,6 +837,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«", ""); text = text.replace("»", ""); + text = text.replaceAll("\n"," "); value["URLFonteCitazione"] = text; } @@ -836,6 +846,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«", ""); text = text.replace("»", ""); + text = text.replaceAll("\n"," "); value["NaturaRiferimento"] = text; } @@ -844,6 +855,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«", ""); text = text.replace("»", ""); + text = text.replaceAll("\n"," "); value["RapportoCommentoCommentatoreText"] = text; } @@ -852,6 +864,7 @@ function resetFrasi(){ text = text.replace(/<(.|\n)*?>/g, ''); text = text.replace("«", ""); text = text.replace("»", ""); + text = text.replaceAll("\n"," "); value["RapportoSoggettoOggetto"] = text; } } @@ -876,25 +889,49 @@ function resetFrasi(){ commentArea.empty() var spanComment = $('<span />'); var id = cid.substr(9); + var nomeAutore = ""; + var titoloFonte = ""; + var luogoFonte = ""; + var commentoCommentatore = []; + var urlCommento = ""; + var esitoCommento = ""; for (var pos in commentsArray){ var comments = commentsArray[pos] if (comments.verso == id){ - console.log(comments) spanComment.append('<b>'+cantica+'</b><i>'+", Canto " + getRoman(parcid[2])+" Verso "+ parcid[3]+"</i><br>"); + if (comments.NomeAutoreCitazione == null){ + nomeAutore = 'riferimento'; + } + else{ + nomeAutore = comments.NomeAutoreCitazione; + } if (comments.AutoreCitazione != null){ - spanComment.append('<a href="'+comments.AutoreCitazione+'" target="_blank"><b>Autore:</b> <i>'+comments.NomeAutoreCitazione+ '</i>, </a>'); - //spanComment.append("Autore: " + comments.AutoreCitazione+"<br>"); + spanComment.append('<b>Autore:</b><a href="'+comments.AutoreCitazione+'" target="_blank"> <i>'+nomeAutore+ '</i>, </a>'); + }else{ + spanComment.append('<b>Autore:</b> <i>'+nomeAutore+'</i>'); + + } + if(comments.TitoloFonteCitazione == null){ + titoloFonte = "riferimento"; + }else{ + titoloFonte = comments.TitoloFonteCitazione; } if (comments.FonteCitazione != null){ - spanComment.append('<a href="'+comments.FonteCitazione+'" target="_blank"><b>Fonte:</b> <i> '+comments.TitoloFonteCitazione +'</i>, </a>'); - //spanComment.append("Fonte: " + comments.FonteCitazione+"<br>"); + spanComment.append('<b>Fonte:</b> <a href="'+comments.FonteCitazione+'" target="_blank"><i> '+titoloFonte +'</i>, </a>'); + }else{ + spanComment.append('<b>Fonte:</b><i> '+titoloFonte +'</i>'); + + } + if(comments.LuogoFonteCitazione == null){ + luogoFonte = "riferimento"; + }else{ + luogoFonte = comments.LuogoFonteCitazione; } if (comments.URLFonteCitazione != null){ - spanComment.append('<a href="'+comments.URLFonteCitazione+'" target="_blank"><b>URL Fonte</b>, </a>'); - //spanComment.append("URL Fonte: " + comments.URLFonteCitazione+"<br>"); - } - if (comments.LuogoFonteCitazione != null){ - spanComment.append("<b>Luogo Fonte:</b><i> " + comments.LuogoFonteCitazione+"</i><br>"); + spanComment.append('<b>Luogo Fonte:</b><a href="'+comments.URLFonteCitazione+'"target="_blank"<i> ' + luogoFonte+'</i>, </a><br>'); + }else{ + spanComment.append('<b>Luogo Fonte:</b><i> ' + luogoFonte+'</i><br>'); + } if (comments.NaturaRiferimento != null){ spanComment.append("<b>Natura Riferimento:</b><i> " + comments.NaturaRiferimento+"</i><br>"); @@ -906,7 +943,23 @@ function resetFrasi(){ spanComment.append("<b>Rapporto Soggetto/Oggetto: </b><i>" + comments.RapportoSoggettoOggetto+"</i><br>"); } if (comments.RapportoCommentoCommentatoreText != null && comments.RapportoCommentoCommentatoreText != "nan"){ - spanComment.append("<b>Rapporto Commento/Commentatore:</b><i> " + comments.RapportoCommentoCommentatoreText+"</i><br>"); + commentoCommentatore = comments.RapportoCommentoCommentatoreText.split(' '); + urlCommento = commentoCommentatore[1]; + urlCommento = urlCommento.replaceAll('"',""); + urlCommento = urlCommento.replaceAll("'",""); + urlCommento = urlCommento.replaceAll(',',""); + esitoCommento = commentoCommentatore[3]; + esitoCommento = esitoCommento.replaceAll('"',""); + esitoCommento = esitoCommento.replaceAll("'",""); + esitoCommento = esitoCommento.replaceAll('}]',""); + if (esitoCommento == ""){ + esitoCommento = "Rapporto nullo" + } + if(urlCommento == ""){ + spanComment.append('<b>Rapporto Commento/Commentatore: [</b>Commento nullo, '+esitoCommento+'] <br>'); + }else{ + spanComment.append('<b>Rapporto Commento/Commentatore: [</b><a href="'+urlCommento+'"target="_blank"<i>'+ "Commento"+'</i></a>, '+esitoCommento+'] <br>'); + } } if (comments.annotazione != null && comments.annotazione != "nan"){ var spanForm = $('<form />'); @@ -944,10 +997,10 @@ function resetFrasi(){ spanDiv.append('<label for="comment"><b>Nota Fonte:</b></label>'); spanDiv.append('<textarea readonly class="form-control" rows="2" id="NotaFonteCitazione"+comments.verso name="text">'+comments.NotaFonteCitazione+'</textarea>'); } + spanComment.append('<hr class="pt-0 center text-dark bg-dark" style="width: 35%;">'); } } spanComment.appendTo(commentArea); - commentArea.append('<hr class="pt-0 center text-dark bg-dark" style="width: 35%;">'); }) function hasComments(cid){