function handle_Letters(json, mittente, destinatario){ thead = '
\
Documento
\
Data di partenza
\
Data di arrivo
\
Luogo di partenza
\
Luogo di arrivo
\
'; var EventsTable = thead; $.each( json['results']['bindings'], function (index, value) { var uri_document = ""; var doc = ""; var time_span_from = ""; var time_span_to = ""; var uri_place_from = ""; var place_from = ""; var uri_place_to = ""; var place_to = ""; if(value.hasOwnProperty('uri_document')) { uri_document = value['uri_document']['value']; } if(value.hasOwnProperty('document')) { doc = value['document']['value']; } if(value.hasOwnProperty('time_span_from')) { time_span_from = value['time_span_from']['value']; } if(value.hasOwnProperty('time_span_to')) { time_span_to = value['time_span_to']['value']; } if(value.hasOwnProperty('uri_place_from')) { uri_place_from = value['uri_place_from']['value']; } if(value.hasOwnProperty('place_from')) { place_from = value['place_from']['value']; } if(value.hasOwnProperty('uri_place_to')) { uri_place_to = value['uri_place_to']['value']; } if(value.hasOwnProperty('place_to')) { place_to = value['place_to']['value']; } EventsTable += '
' + '
' + doc + '
' + '
' + time_span_from + '
' + '
' + time_span_to + '
' + '
' + place_from + '
' + '
' + place_to + '
' + '
'; }); document.getElementById("results_table").innerHTML = EventsTable; document.getElementById("results_title").innerHTML = "Lettere da " + mittente + " a " + destinatario; } function handleLemma(json, lemma) { let anni = []; thead = '
\
Documento
\
Esplora
\
'; var DocumentsTable = thead; var i = 0; var anno = ""; $.each( json['results']['bindings'], function (index, value) { var document = value['document']['value']; var uri_document = value['uri_document']['value']; var uri_info = ""; var type = ""; var date = ""; var year = ""; var month = ""; var day = ""; var sigla = ""; var text = "Nessun testo trovato"; var object_button = ""; if(value.hasOwnProperty('uri_infObj')) { uri_info = value['uri_infObj']['value']; } if(value.hasOwnProperty('types')) { type = value['types']['value']; } if(value.hasOwnProperty('time_span')) { date = value['time_span']['value']; } if(value.hasOwnProperty('year')) { year = value['year']['value']; } if(value.hasOwnProperty('month')) { month = value['month']['value']; } if(value.hasOwnProperty('day')) { day = value['day']['value']; } if(value.hasOwnProperty('text')) { text = value['text']['value']; } if(value.hasOwnProperty('sigla')) { sigla = value['sigla']['value']; } if (type.includes("lettera")) { object_button = ''; } else { object_button = ''; } DocumentsTable += '
' + '
' + document + '
' + '
' + object_button + '
' + '
'; var aaaa = ""; if (anno != year) { anno = year; aaaa = year; createYearPoint(aaaa); } anni.push(year); querySigla = prefixes + (queryManager['queryRES']['queryTrovaSigla']).replace('<{SIGLA}>', sigla).replace('<{LEMMA}>', lemma); doJsonQuery(querySigla).done(function(r) { manageTimeline(r, date, aaaa, month, day, document, uri_document, text); }); let element = [date, year, month, day, document, uri_document, text, uri_info]; createTimelineNode(element); i++; }); let uniqueyears = [...new Set(anni)]; var AnniList = "

Anni

"; document.getElementById("lemma_buttons").style.display = "flex"; document.getElementById("anni").innerHTML = AnniList; document.getElementById("results_table").innerHTML = DocumentsTable; document.getElementById("results_title").innerHTML = titleCase(lemma); } function manageTimeline(json, date, year, month, day, document, uri_document, text) { num = ""; $.each( json['results']['bindings'], function (index, value) { if(value.hasOwnProperty('id')) { num = value['id']['value']; } }); var testo = text; /*if (num != "") { var toReplace = "n='" + num + "'"; var toSearch = "[a-z]+"; testo = text.replaceAll(toReplace, "class='highlight'"); let rr = toSearch.replace("numero", num) let rer = new RegExp(rr); var pos = text.search(rer); var searchedString = text.match(rer); const regex = new RegExp(//); text.replace(regex, num); let regE = new RegExp("[0-9]+[]a$|[0-9]+[]" , 'g') var result = String("la tua stringa").match(regE ); var ss = pos-150; var ee = pos+150; var start = 0; var end = ee; if (ss<0) { start = 0; } else { start = ss; } testo = text.substring(start, end) console.log([start, end, testo]); } else { testo = text; }*/ } function createTimelineNode(array) { var data = array[0]; var anno = array[1]; var mese = array[2]; var giorno = array[3]; var titolo = array[4]; var testo = array[6]; var link = array[5]; var infObj = array[7] var TimelineNode = '
  • ' + '
    ' + ''+ data +'' + '
    ' + '
    ' + ' ' + '
    ' + '
    ' + '
    ' + '' + titolo + '' + '
    ' + '
    ' + '

    ' + testo + '

    ' + '
    ' + '
  • '; document.getElementById("docTimeline").innerHTML += TimelineNode; } function createYearPoint(anno) { var TimelineNode = '
  • ' + '
    ' + '' + anno + '' + '
  • '; document.getElementById("docTimeline").innerHTML += TimelineNode; } function handle_map(json) { console.log(json); const locations = []; const place_names = []; var lat = 0; var long = 0; var i=0; var myPlaces = ""; $.each( json['results']['bindings'], function (index, value) { const loc = [] var uri = value['place']['value']; var label = value['label']['value']; var coord = value['coordinates']['value']; const coordinates = coord.split(", "); loc.push(label); //myPlaces += "
    " + label + "
    "; loc.push(coordinates[0]); lat += parseInt(coordinates[0]); loc.push(coordinates[1]); long += parseInt(coordinates[1].replace(/^(\.)/,"0.").replace("-.", "-0.")); locations.push(loc); i++; }); console.log(locations); var latitude = lat/i; var longitude = long/i; //document.getElementById("list_places_person").innerHTML = myPlaces; var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png', cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade, Points © 2012 LINZ', cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}), latlng = new L.LatLng(latitude, longitude); var map = new L.Map('map', {center: latlng, zoom: 5, layers: [cloudmade]}); mapLink = 'OpenStreetMap'; var markers = new L.MarkerClusterGroup(); var markerList = []; var geo = new L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© ' + mapLink + ' Contributors', maxZoom: 18, }).addTo(map); function populate() { for (var i = 0; i < locations.length; i++) { var a = locations[i]; var title = a[0]; var marker = new L.Marker(new L.LatLng(a[1], a[2]), { title: title }); marker.bindPopup(title); markers.addLayer(marker); markerList.push(marker); } } populate(); map.addLayer(markers); $('.clickPlace').on('click', function(){ // parse lat and lng from the divs data attribute var latlng = $(this).data().point.split(','); var lat = latlng[0]; var lng = latlng[1]; var zoom = 10; // set the view map.setView([lat, lng], zoom); }); } // Mini-utility per formattare liste function formatListAsLi(thisList){ toRet = ""; thisList.forEach(value => toRet += "
  • " + value + "
  • "); return toRet; } // Buttons function createButton(buttonClass, text, onClickFunction){ htmlCode = '\ \ '.replace("", buttonClass).replace("", text).replace("", onClickFunction); return htmlCode; } function createButtonEVT(sigla){ htmlCode = '\ \ '.replace("", sigla); return htmlCode; } // function loadPageEVT(sigla) { window.location="http://restore.ovi.cnr.it/mockup/evt/#/imageText?p=" + sigla + "_01&el=diplomatic"; } function createEmbed(link) { image = link.replace("scheda", "imageView") + "/#main"; htmlCode = '\ \ '.replace("
    " + info + "
    "); } function show_OVI(){ document.getElementById("OVI_info").style.display = "block"; document.getElementById("ASPO_info").style.display = "none"; } function show_ASPO(){ document.getElementById("OVI_info").style.display = "none"; document.getElementById("ASPO_info").style.display = "block"; } $(document).on("click", ".close", function (ev) { var link = this.id; //alert(nome_autore); //$('#myModal').text(""); $("#myModal").css("display", "none"); }); $(document).on("click", ".hyp", function (ev) { var baseurl = window.location.origin+window.location.pathname; let slash = baseurl.lastIndexOf("/"); var type = $(this).val() + '.html'; var link = this.id; var url = baseurl.substr(0, slash+1) + type + "?link="+link; var link = this.id; $("#myModal").empty(); $("#myModal").css("display", "block"); $('#myModal').append("