/*var final_transcript = ''; var recognizing = false;*/ var Parole = ""; /*if ('webkitSpeechRecognition' in window) { var recognition = new webkitSpeechRecognition(); recognition.continuous = false; recognition.interimResults = true; recognition.onstart = function () { recognizing = true; }; recognition.onerror = function (event) { console.log(event.error); }; recognition.onend = function () { recognizing = false; }; recognition.onresult = function (event) { var interim_transcript = ''; for (var i = event.resultIndex; i < event.results.length; ++i) { if (event.results[i].isFinal) { final_transcript += event.results[i][0].transcript; Parole = final_transcript; console.log(Parole); setTimeout(function () { $("#ClipArt1" ).click(); }, 3000); } else { interim_transcript += event.results[i][0].transcript; } } final_transcript = capitalize(final_transcript); final_span.innerHTML = linebreak(final_transcript); TextArea1.value = linebreak(final_transcript); interim_span.innerHTML = linebreak(interim_transcript); }; } var two_line = /\n\n/g; var one_line = /\n/g; function linebreak(s) { return s.replace(two_line, '
').replace(one_line, 'Nessun Oggetto Fisico trovato
'; $('#Man-Made_Object').append(message); } if ($("#Information_Object").is(':empty')) { var message = 'Nessun Oggetto Informativo trovato
'; $('#Information_Object').append(message); } if ($("#Person").is(':empty')) { var message = 'Nessuna Persona trovata
'; $('#Person').append(message); } if ($("#Place").is(':empty')) { var message = 'Nessun Luogo trovato
'; $('#Place').append(message); } } function rewrite_graph(graph) { var graph_name = "" if (graph == "http://147.213.76.182:8890/aspo/datini") { graph_name = "Archivio di Stato di Prato - Fondo Datini"; } else if (graph == "http://147.213.76.182:8890/aspo/ospedale") { graph_name = "Archivio di Stato di Prato - Fondo Ospedale Misericordia e Dolce"; } else if (graph == "http://147.213.76.182:8890/aspo/marcovaldi") { graph_name = "Archivio di Stato di Prato - Fondo Marcolvaldi"; } else if (graph == "http://147.213.76.182:8890/aspo/gettatelli") { graph_name = "Archivio di Stato di Prato - Fondo Ospedale Misericordia e Dolce"; } else if (graph == "http://147.213.76.182:8890/aspo/actors") { graph_name = "Archivio di Stato di Prato"; } else if (graph == "http://147.213.76.182:8890/mpp/martini") { graph_name = "Museo di Palazzo Pretorio di Prato"; } else if (graph == "http://147.213.76.182:8890/mpp/ospedale") { graph_name = "Museo di Palazzo Pretorio di Prato"; } else if (graph == "http://147.213.76.182:8890/mpp/datini") { graph_name = "Museo di Palazzo Pretorio di Prato"; } else if (graph == "http://147.213.76.182:8890/mpp/authors") { graph_name = "Museo di Palazzo Pretorio di Prato"; } else if (graph == "http://147.213.76.182:8890/ovi/datini") { graph_name = "Opera del Vocabolario Italiano"; } else if (graph == "http://147.213.76.182:8890/ovi/datini/trascr") { graph_name = "Opera del Vocabolario Italiano"; } else if (graph == "http://147.213.76.182:8890/places") { graph_name = "Luoghi"; } else if (graph == "http://147.213.76.182:8890/mpp/places") { graph_name = "Museo di Palazzo Pretorio di Prato"; } else if (graph == "http://147.213.76.182:8890/label/toponimi") { graph_name = "Toponimi Archivio di Stato di Prato"; } else if (graph == "http://147.213.76.182:8890/aspo/onomastica") { graph_name = "Archivio di Stato di Prato - Onomatica Datini"; } else if (graph == "http://147.213.76.182:8890/aspo/gettatelli/newdataset") { graph_name = "Archivio di Stato di Prato - Fondo Ospedale Misericordia e Dolce"; } else if (graph == "http://147.213.76.182:8890/aspo/onomastica/gruppi") { graph_name = "Archivio di Stato di Prato - Onomastica Datini"; } else if (graph == "http://147.213.76.182:8890/mpp/autori") { graph_name = "Museo di Palazzo Pretorio"; } else if (graph == "http://147.213.76.182:8890/aspo/onomastica/datini") { graph_name = "Archivio di Stato di Prato - Onomastica Datini"; } else if (graph == "http://147.213.76.182:8890/onomastica/ospedale") { graph_name = "Archivio di Stato di Prato - Fondo Ospedale Misericordia e Dolce"; } else if (graph == "http://147.213.76.182:8890/mpp/ulan/viaf") { graph_name = "Persone"; } else if (graph == "http://147.213.76.182:8890/places/microtoponimi") { graph_name = "Luoghi"; } else {graph_name = graph; } return graph_name; } function MMO_handle_json(json) { // console.log(json); mmoQueries = mmoQueries+1; if(mmoQueries==3){ $('#mmoLoader').css("display", "none"); } $('#wb_Shape1').text(""); $(".results").css("display", "block"); var n_mmo = $('#n_mmo').text(); var b = parseInt(n_mmo); var i = 0; $.each( json['results']['bindings'], function (index, value) { var object = ""; /*Inserisci VALUE TIPOLOGIA*/ var graph = value['graph']['value']; var graph_name = rewrite_graph(graph); var mmoType = ""; var mmoId = ""; var object_button = ""; var object_type = ""; if (value.hasOwnProperty('type')) { mmoType = value['type']['value']; } if (value.hasOwnProperty('identifier')) { mmoId = value['identifier']['value']; } if (mmoType.includes("Opera d'Arte")) { object_type = "artwork"; object_button += ''; } else { object_type = "object"; object_button += ''; } object += /*INIZIO DIV*/ 'Nessun Oggetto Fisico trovato
'; $('#Man-Made_Object').append(message); } else { $('#no_mmo').remove(""); } } function InfObj_handle_json(json) { // console.log(json); infQueries = infQueries+1; if(infQueries==3){ $('#infLoader').css("display", "none"); } var n_io = $('#n_io').text(); var b = parseInt(n_io); var i = 0; $.each( json['results']['bindings'], function (index, value) { var information = ""; /*Inserisci VALUE TIPOLOGIA*/ var graph = value['graph']['value']; var graph_name = rewrite_graph(graph); var tipo = ""; var id = ""; var infObject_button = ""; if (value['text']['type'] != 'uri') { var myString = value['text']['value']; var str = myString.replace(/<[^>]*>?/gm, ''); let string_text = str.toLowerCase(); let string_len = str.length; var word = Parole; let ind = string_text.indexOf(word); let length = word.length; var wl = ind + length; var resource_type = ""; var link_type = ""; /*var start = 0; var end = 0 var bb = pp - 50; var ee = pp + length + 150;*/ var pp = ind; before = str.substring(0, ind); after = str.substring(wl, string_len); let bb = before.lastIndexOf("."); let point = bb + pp; let ee = str.indexOf(".", point); if (bb < 0) { start = 0; } else { start = bb+1; } if (ee < 0) { end = string_len; } else { end = ee; } first_chunk = str.substring(start, ind); highlight = str.substring(ind, wl); second_chunk = str.substring(wl, end); var snippet = first_chunk + highlight + second_chunk ; //var snippet = first_chunk + " " + second_chunk ; if (value.hasOwnProperty('types')) { tipo = value['types']['value']; } if (value.hasOwnProperty('id')) { id = " (" + value['id']['value'] + ")"; } if (tipo.includes("lettera")) { link_name = value['subject']['value']; resource_type = "lettera"; link_type = "lettera"; infObject_button += ''; } else { link_name = value['Physical_Object']['value']; resource_type = "object"; link_type = "object"; infObject_button += ''; } //'' + graph_name + '
' +
//'' + value['label']['value'] + '
'+ snippet+'
' + 'In: ' + graph_name + ';Nessun Testo trovato
'; $('#Information_Object').append(message); } else { $('#no_io').remove(""); } } function Person_handle_json(json) { console.log(json); perQueries = perQueries+1; if(perQueries==3){ $('#perLoader').css("display", "none"); } var n_ps = $('#n_ps').text(); var b = parseInt(n_ps); var i = 0; $.each( json['results']['bindings'], function (index, value) { var person = ""; /*Inserisci VALUE TIPOLOGIA*/ var graph = value['graph']['value']; var graph_name = rewrite_graph(graph); person += /*INIZIO DIV*/ '' + graph_name + '
' +
'' + value['name']['value'] + '
Nessun Persona trovata
'; $('#Person').append(message); } else { $('#no_ps').remove(""); } } function Place_handle_json(json) { // console.log(json); lgQueries = lgQueries+1; if(lgQueries==1){ $('#lgLoader').css("display", "none"); } var n_pl = $('#n_pl').text(); var b = parseInt(n_pl); var i = 0; $.each( json['results']['bindings'], function (index, value) { var place = ""; /*Inserisci VALUE TIPOLOGIA*/ var graph = value['graph']['value']; var graph_name = rewrite_graph(graph); place += /*INIZIO DIV*/ '' + graph_name + '
' +
'' + value['label']['value'] + '
Nessun Luogo trovato
'; $('#Place').append(message); } else { $('#no_pl').remove(""); } } //onlick hyperlink button $(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("