';
}
document.getElementById("scheda_anagrafica").innerHTML = card;
document.getElementById("btn_scheda").innerHTML = button_obj;
}
function handle_Gettatelli(json) {
//console.log(json);
var generic = "";
var find = "";
var reunite = "";
var adoption = "";
$.each(
json['results']['bindings'],
function (index, value) {
var event_type = value['event_type']['value'];
var data = value['time_span']['value'];
if (event_type == "Evento generico") {
$("#generic_event").css("display", "flex");
generic = data;
}
else if (event_type == "Ritrovamento") {
$("#find_event").css("display", "flex");
find = data;
}
else if (event_type == "Ricongiungimento") {
$("#reunion_event").css("display", "flex");
reunite = data;
}
else if (event_type == "Adozione") {
$("#adoption_event").css("display", "flex");
adoption = data;
}
});
document.getElementById("anno").innerHTML = generic;
document.getElementById("ritrovamento").innerHTML = find;
document.getElementById("ricongiungimento").innerHTML = reunite;
document.getElementById("adozione").innerHTML = adoption;
}
function handle_Relazioni(json) {
//console.log(json);
var Relazioni = "";
const myArray = []
$.each(
json['results']['bindings'],
function (index, value) {
var tipo = value['relation_type']['value'];
var uri_person = value['uri_person']['value'];
var nome = value['name']['value'];
var principale = "";
var givenName = "";
var familyName = "";
var patronymic = "";
var provenence = "";
if (value.hasOwnProperty('givenName')) {
givenName = value['givenName']['value'];
}
if (value.hasOwnProperty('note')) {
principale = " principale";
}
if (value.hasOwnProperty('familyName')) {
familyName = value['familyName']['value'].toLowerCase();
familyName = familyName.charAt(0).toUpperCase() + familyName.slice(1)
}
if (value.hasOwnProperty('patronymic')) {
patronymic = value['patronymic']['value'];
}
if (value.hasOwnProperty('provenienza')) {
provenence = value['provenienza']['value'];
}
var type = tipo.charAt(0).toUpperCase() + tipo.slice(1) + principale;
if ((type == "Socio") || (type == "Socio principale")) {
type = "Società ";
}
if (type == "Mano lettera") {
type = "Altre collaborazioni"
}
var first_name = "";
if ((givenName != "") || (patronymic != "") || (familyName != "") || (provenence != "")) {
first_name = givenName + " " + patronymic + " " + familyName + " " + provenence;
} else {
first_name = nome;
}
myArray.push([type, first_name, uri_person]);
});
const checkRel = [];
for (var i=0; i", type).replace("", id);
return htmlCode;
}
function createColRelazione(text, link) {
htmlCode = '\
\
\
\
\
\
\
'.replace("", text).replace("", link);
return htmlCode;
}
function handle_Events(json) {
const events = [];
$.each(
json['results']['bindings'],
function (index, value) {
var event_type = value['event_type']['value'];
var role = value['role']['value'];
var uri_document = value['uri_document']['value'];
var document = value['document']['value'];
var time_span = "";
var uri_place = "";
var place = "";
if (value.hasOwnProperty('time_span')) {
time_span = value['time_span']['value'];
}
if (value.hasOwnProperty('uri_place')) {
uri_place = value['uri_place']['value'];
}
if (value.hasOwnProperty('place')) {
place = value['place']['value'];
place = titleCase(place);
}
const cells = [event_type, role, time_span, uri_place, place, uri_document, document];
events.push(cells);
});
var thead = '
' +
'
Evento
' +
'
Ruolo
' +
'
Data
' +
'
Luogo
' +
'
Documento
' +
'
';
var EventsTable = thead;
for (var i=0; i' +
'
' + events[i][0] + '
' +
'
' + events[i][1] + '
' +
'
' + events[i][2] + '
' +
'
' + events[i][4] + '
' +
'
' + events[i][6] + '
' +
'';
}
if (events.length != 0) {
document.getElementById("res_events").innerHTML = EventsTable;
} else {
document.getElementById("res_events").innerHTML = "Nessun evento trovato";
}
}
function handle_Compagnia(json) {
//console.log(json);
var denominazione = "";
var sede = "";
var uri_sede = "";
var uri_place = "";
$.each(
json['results']['bindings'],
function (index, value) {
if (value.hasOwnProperty('denomination')) {
$("#type_society").css("display", "flex");
denominazione = value['denomination']['value'];
}
if (value.hasOwnProperty('uri_place')) {
$("#sede").css("display", "flex");
uri_place = value['uri_place']['value'];
}
if (value.hasOwnProperty('uri_sede')) {
$("#sede").css("display", "flex");
uri_sede = value['uri_sede']['value'];
}
if (value.hasOwnProperty('sede')) {
sede = value['sede']['value'];
}
});
var workPlace_button = "";
if (uri_place != "") {
workPlace_button = '';
} else {
workPlace_button = '';
}
document.getElementById("society").innerHTML = denominazione;
document.getElementById("workPlace").innerHTML = sede;
document.getElementById("workPlace_btn").innerHTML = workPlace_button;
}
function handle_Artwork(json) {
//console.log(json);
const oa = [];
$.each(
json['results']['bindings'],
function (index, value) {
uri = value['subject']['value'];
label = value['label']['value'];
nct = value['nct']['value'];
var data = "";
if (value.hasOwnProperty('time_span')) {
data = value['time_span']['value'];
}
oa.push([uri, label, nct, data]);
});
var Artworks = "";
for (var i=0; i' + oa[i][1] + ' NCT: ' + oa[i][2];
if (oa[i][3] != "") {
artwork = artwork + " Data: " + oa[i][3];
}
var object_button = '';
Artworks += '
'+ artwork +'
' +
'
' + object_button +
'' +
'' +
'
';
}
document.getElementById("n_oa").innerHTML = oa.length;
document.getElementById("object_oa").innerHTML = Artworks;
if (oa.length==0) {
var messaggio = "
Nessun risultato trovato
";
document.getElementById("object_oa").innerHTML = messaggio;
}
}
function handle_Other_Documents(json) {
//console.log(json);
const doc = [];
$.each(
json['results']['bindings'],
function (index, value) {
uri = value['document']['value'];
label = value['label']['value'];
var data = "";
var id = "";
if (value.hasOwnProperty('time_span')) {
data = value['time_span']['value'];
}
if (value.hasOwnProperty('id')) {
id = value['id']['value'];
}
doc.push([uri, label, id, data]);
});
var Documents = "";
for (var i=0; i'+ doc[i][1] + '';
var object_button = '';
if (doc[i][2] != "") {
paper = paper + " Segnatura: " + doc[i][2];
}
if (doc[i][3] != "") {
paper = paper + " Data: " + doc[i][3];
}
paper = paper + '
';
Documents += '
'+ paper +
'
' + object_button +
'' +
'' +
'
';
}
document.getElementById("n_ass").innerHTML = doc.length;
document.getElementById("other_documents").innerHTML = Documents;
if (doc.length==0) {
var messaggio = "
Nessun risultato trovato
";
document.getElementById("other_documents").innerHTML = messaggio;
}
}
function handle_map(json) {
//console.log(json);
const locations = [];
const place_names = [];
const place_events = [];
const luoghi = [];
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'];
var evento = value['tipo']['value']
var count = value['count']['value']
place_events.push([uri, evento, count]);
if (!place_names.includes(uri)) {
place_names.push(uri);
const coordinates = coord.split(", ");
loc.push(uri);
label = titleCase(label);
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++;
}
});
for (var k=0; k";
for (var k=3; k" + dix + " occorrenze";
}
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);
});
}
$(document).on("click", ".luogo", function (ev) {
var link = this.id;
//alert(nome_autore);
//$('#myModal').text("");
window.open("Luogo.html?link="+this.id);
});
$(document).on("click", ".persona", function (ev) {
var link = this.id;
window.open("Persona.html?link="+this.id);
});
$(document).on("click", ".lettera", function (ev) {
var link = this.id;
//alert(nome_autore);
//$('#myModal').text("");
window.open("lettera.html?link="+this.id);
});
$(document).on("click", ".object", function (ev) {
var link = this.id;
//alert(nome_autore);
//$('#myModal').text("");
window.open("object.html?link="+this.id);
});
$(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("
×
" +
url + "
");
});
$(document).on("click", ".artwork", function (ev) {
var link = this.id;
//alert(nome_autore);
//$('#myModal').text("");
window.open("OA.html?link="+this.id);
});
$(document).on("click", ".close", function (ev) {
var link = this.id;
//alert(nome_autore);
//$('#myModal').text("");
$("#myModal").css("display", "none");
});
$(document).on("click", ".back", function (ev) {
$("#myTab").css("display", "none");
});
$(document).on("click", ".cit", function (ev) {
var author ="RESTORE. smart access to digital heritage and memory"
var year = new Date().getFullYear()
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();
today = dd + '/' + mm + '/' + yyyy;
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;
//alert(nome_autore);
//$('#myModal').text("");
$("#myModal").empty();
$("#myModal").css("display", "block");
$('#myModal').append("
");
});
function titleCase(str) {
var splitStr = str.toLowerCase().split(' ');
for (var i = 0; i < splitStr.length; i++) {
// You do not need to check if i is larger than splitStr length, as your for does that for you
// Assign it back to the array
splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
}
// Directly return the joined string
return splitStr.join(' ');
}
function copyToClipboard(text) {
var sampleTextarea = document.createElement("textarea");
document.body.appendChild(sampleTextarea);
sampleTextarea.value = text; //save main text in it
sampleTextarea.select(); //select textarea contenrs
document.execCommand("copy");
document.body.removeChild(sampleTextarea);
}
function myFunction(){
var copy = document.getElementById("myInput");
copyText = copy.textContent;
copyToClipboard(copyText);
//copyToClipboard(copyText.value);
}