//INIZIO PREPARAZIOEN QUERY
// Raccatto i parametri dall'URL -- mi aspetto un parametro di nome 'link'!
thisUrlParams = {};
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
thisUrlParams[key] = value;
});
console.log('URL get params: ', thisUrlParams.params);
function prepareQueryURL(query){
sparqlEndpoint = endpoint;
sparqlUrlParams = '?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json&callback=?';
return sparqlEndpoint + sparqlUrlParams;
}
function doJsonQuery(query) {
queryURL = prepareQueryURL(query);
return $.ajax({
url: queryURL,
dataType: "json",
type: 'GET'
});
}
// Funzioni per raccattare + stringhificare l'output
queryStringOutput = "";
function stringifyResponse(val){
resultArray = val['results']['bindings'];
out = "";
for(i = 0; i < resultArray.length; i++){
out = out + JSON.stringify(resultArray[i])
}
queryStringOutput = (queryStringOutput + out).replace("}{",",");
}
//FINE PREPARAZIONE QUERY
$(document).on("click", ".luogo", function (ev) {
var link = this.id;
window.open("Luogo.html?link="+this.id, "_self");
});
$(document).on("click", ".persona", function (ev) {
var link = this.id;
window.open("Persona.html?link="+this.id, "_self");
});
$(document).on("click", ".lettera", function (ev) {
var link = this.id;
window.open("lettera.html?link="+this.id, "_self");
});
$(document).on("click", ".object", function (ev) {
var link = this.id;
window.open("object.html?link="+this.id, "_self");
});
$(document).on("click", ".artwork", function (ev) {
var link = this.id;
window.open("OA.html?link="+this.id, "_self");
});
function schedaASPO(info){
window.open(info);
}
$(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", ".close", function (ev) {
var link = this.id;
$("#myModal").css("display", "none");
});
$(document).on("click", ".back", function (ev) {
$("#myTab").css("display", "none");
});
function changeStyle() {
var element = document.getElementById("glass");
element.classList.toggle("img-magnifier-glass");
}
$(document).on("click", ".zoomImg", function (ev) {
if (!!document.getElementById("glass")) {
destroyMagnifier();
} else {
createMagnifier("expandedImg", 3);
}
});
$(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
new_str = splitStr.join(' ');
finalString = new_str.replaceAll(" Di ", " di ").replace(" Moglie ", " moglie ").replace(" E ", " e ");
return finalString;
}
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);
}
function expandImg(imgs) {
var expandImg = document.getElementById("expandedImg");
var imgText = document.getElementById("imgtext");
expandImg.src = imgs.src;
imgText.innerHTML = imgs.alt;
expandImg.parentElement.style.display = "block";
}
function toggleNews(id) {
$( "#" + id + " .newsText" ).toggle( "slow", function() {
});
}
var myIndex = 0;
//slide();
function slide() {
var i;
var x = document.getElementsByClassName("slide");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(slide, 12000);
}
function runOpenseadragon(tiles) {
console.log(tiles);
var viewer = OpenSeadragon({
id: "contentDiv",
prefixUrl: "https://cdn.jsdelivr.net/npm/openseadragon/build/openseadragon/images/",
maxZoomPixelRatio: 3,
toolbar: "toolbarDiv",
springStiffness: 10,
sequenceMode: true,
showReferenceStrip: true,
autoHideControls: false,
tileSources: tiles,
});
}