123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- //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 = 'http://dev.restore.ovi.cnr.it:8890/sparql/';
- 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);
- });
- $(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;
- window.open("lettera.html?link="+this.id);
- });
- $(document).on("click", ".object", function (ev) {
- var link = this.id;
- window.open("object.html?link="+this.id);
- });
- $(document).on("click", ".artwork", function (ev) {
- var link = this.id;
- window.open("OA.html?link="+this.id);
- });
- 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("<div class='modal-content'><div class='modal-close'><span class='close'>×</span></div><div id='myInput'>" +
- url + "</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
- });
- $(document).on("click", ".close", function (ev) {
- var link = this.id;
- $("#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("<div class='modal-content'><div class='modal-close'><span class='close'>×</span></div><div id='myInput'>" +
- author + " " + year + ", accesso effettuato: " + today + ", <" + url + "></div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
- });
- 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.replace(" Di ", " di ")
- 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);
- }
|