123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845 |
- var link = thisUrlParams.link;
- prefixes = queryManager['prefixes']['all'];
- queryURL = prefixes + (queryManager['querySchedaOpera']['queryInfo']).replace('{URI}', link);
- doJsonQuery(queryURL).done(function(data) { handle_OAdata(data); });
- queryPro = prefixes + (queryManager['querySchedaOpera']['queryProduction']).replace('{URI}', link);
- doJsonQuery(queryPro).done(function(data) { handle_Production(data); });
- queryBib = prefixes + (queryManager['querySchedaOpera']['queryBibliography']).replace('{URI}', link);
- doJsonQuery(queryBib).done(function(data) { handle_Bibliography(data); });
- queryPic = prefixes + (queryManager['querySchedaOpera']['queryPicture']).replace('{URI}', link);
- doJsonQuery(queryPic).done(function(data) { handle_Picture(data); });
- querySc = prefixes + (queryManager['querySchedaOpera']['querySchedeStoriche']).replace('{URI}', link);
- doJsonQuery(querySc).done(function(data) { handle_SchedeStoriche(data); });
- queryIcon = prefixes + (queryManager['querySchedaOpera']['queryIconclass']).replace('{URI}', link);
- doJsonQuery(queryIcon).done(function(data) { handle_Iconclass(data); });
- var img_pic = [];
- var img_cat = [];
- var img_sc = [];
- var img_g1858 = [];
- var img_g1888 = [];
- var img_p1912 = [];
- var img_m1956 = [];
- function handle_OAdata(json) {
- console.log(json['results']['bindings']);
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var graph = value['graph']['value'];
- var label = value['label']['value'];
- var uri = value['uri']['value'];
- var title = "";
- var type = "";
- var current_owner = "";
- var current_location = "";
- var subject = "";
- var dimensions = "";
- var materials = "";
- var condition = "";
- var note = "";
- var identifier = "";
- var unit = "";
- var inscription = "";
- var conn_subject = "";
- var src_picture = "";
- var picture = "";
- var dataset = get_dataset_name(graph);
-
- if (value.hasOwnProperty('title')) {
- $("#SGTT").css("display", "flex");
- title = value['title']['value'];
- }
- if (value.hasOwnProperty('identifier')) {
- $("#NCT").css("display", "flex");
- identifier = value['identifier']['value'];
- }
- if (value.hasOwnProperty('type')) {
- $("#OGTD").css("display", "flex");
- type = "<div class='d-flex'><div class='mr-3'><a href='" + value['uriType']['value'] + "'>" +
- value['type']['value'] + "</a></div></div>";
- }
- if (value.hasOwnProperty('current_owner')) {
- $("#LDCN").css("display", "flex");
- current_owner = "<div class='d-flex'><div class='mr-3'><a href='" + value['uriOwner']['value'] + "'>" +
- value['current_owner']['value'] + "</a></div></div>";
- }
- if (value.hasOwnProperty('current_location')) {
- $("#LDCS").css("display", "flex");
- current_location = value['current_location']['value'];
- }
- if (value.hasOwnProperty('unit')) {
- unit = value['unit']['value'];
- }
- if (value.hasOwnProperty('subject')) {
- $("#SGTI").css("display", "flex");
- subject = value['subject']['value'];
- }
- if (value.hasOwnProperty('dimensions')) {
- if (value['dimensions']['value'] != "") {
- $("#MIS").css("display", "flex");
- dimensions = value['dimensions']['value'];
- }
- }
- if (value.hasOwnProperty('condition')) {
- $("#STCC").css("display", "flex");
- condition = value['condition']['value'];
- }
- if (value.hasOwnProperty('note')) {
- $("#NSC").css("display", "flex");
- note = value['note']['value'];
- }
- if (value.hasOwnProperty('iscrizione')) {
- $("#ISCR").css("display", "flex");
- inscription = value['iscrizione']['value'];
- }
- if (value.hasOwnProperty('uriSubjectPer')) {
- $("#SGTI_C").css("display", "flex");
- var givenName = value['personName']['value'];
- var surname = value['personSurname']['value'];
- var patronymic = value['personPatronymic']['value'];
- var name = givenName + " " + patronymic + " " + titleCase(surname);
- conn_subject = "<div class='d-flex'><div class='mr-3'><a href='" + value['uriSubjectPer']['value'] + "'>" +
- name + "</a></div><div class='d-flex ml-auto'><div class='persona btn-icon' style='cursor:pointer' id='" +
- value['uriSubjectPer']['value'] + "'><i class='fa fa-user'></i><p class='btn-text'>PERSONA</p></div></div></div></div>";
-
- }
- if (value.hasOwnProperty('Materials')) {
- if (value['Materials']['value'] != "") {
- $("#MTC").css("display", "flex");
- mm = value['Materials']['value'];
- mat = mm.split("<br />");
- for (i in mat) {
- slice = mat[i].split("; ");
- /*materials += "<a href='" + slice[0] + "'>" + slice[1] + "</a><br />";*/
- materials += "<div class='d-flex'><div class='mr-3'><a href='" + slice[0] + "'>" +
- slice[1] + "</a></div>";
- }
- }
- }
- var subjects = document.getElementsByClassName("subject");
- for (i in subjects) {
- subjects[i].innerHTML = subject;
- }
- var Buttons = '<button title="Apri risorsa originale" class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri + '\')"> \
- <i class="fas fa-external-link-alt" aria-hidden="true"></i></button> \
- <button title="Citazione" type="button" value="artwork" id="' + uri + '" class="cit btn btn-default" alt="scheda" title="Citazione"><i class="fa fa-quote-right"></i></button> \
- <button title="Permalink" type="button" value="artwork" id="' + uri + '" class="hyp btn btn-default" alt="scheda" title="Hyperlink"><i class="fa fa-link"></i></button> \
- <a href="http://dev.restore.ovi.cnr.it/lodlive/?' + uri + '" target="_blank"><button type="button" title="Naviga il grafo" class="btn btn-default info" alt="LOD" title="LodLive"><i class="fa fa-share-alt"></i></button></a></div></div>';
- document.getElementById("grafo").innerHTML = dataset;
- document.getElementById("nome_oggetto").innerHTML = label;
- document.getElementById("identifier").innerHTML = identifier;
- document.getElementById("type").innerHTML = type;
- document.getElementById("owner").innerHTML = current_owner;
- document.getElementById("connected_subject").innerHTML = conn_subject;
- document.getElementById("dimensions").innerHTML = dimensions + unit;
- document.getElementById("materials").innerHTML = materials;
- document.getElementById("condition").innerHTML = condition;
- document.getElementById("description").innerHTML = note;
- document.getElementById("inscription").innerHTML = inscription;
- document.getElementById("link_buttons").innerHTML = Buttons;
-
- });
-
- }
- function handle_Picture(json) {
- console.log(json['results']['bindings']);
- var picture = "";
- const tavole = [];
- var tiles2 = [];
- var provenienza = "";
- var licenza = "";
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var src_picture = value['picture']['value'];
- var tipo = "";
- if (value.hasOwnProperty('type')) {
- tipo = value['type']['value'];
- }
- if (value.hasOwnProperty('provenienza')) {
- $("#IMG_PRO").css("display", "flex");
- provenienza = value['provenienza']['value'];
- }
- if (value.hasOwnProperty('license')) {
- $("#CC_OA").css("display", "flex");
- licenza = '<img src="' + value['license']['value'] + '" width="100" height="auto">';
- }
- let tv = [src_picture, tipo];
- tavole.push(tv);
- src_picture = value['picture']['value'];
- //picture += '<div class="row"> \
- // <img class="minImage viewImage" src="img/mpp_img/' + src_picture + '" onclick="expandImg(this);" /> \
- // </div>';
- img_pic.push({
- type: "image",
- url: "http://restore.ovi.cnr.it/beta/img/mpp_img/" + src_picture
- });
-
- });
- runOpenseadragon(img_pic);
- document.getElementById("imageInstitute").innerHTML = provenienza;
- document.getElementById("license").innerHTML = licenza;
- /*var front_pic = "";
- if (tavole.length > 1) {
- for (i in tavole) {
- if (tavole[i][1] == "Tavola d'insieme") {
- front_pic = tavole[i][0];
- }
- }
- } else {
- front_pic = tavole[0][0];
- }
- img_pic = "img/mpp_img/" + front_pic;*/
- //document.getElementById("image_artwork_min").innerHTML = picture;
- //document.getElementById("expandedImg").src = "img/mpp_img/" + front_pic;
- }
- function get_dataset_name(graph) {
- var string = "Scheda Opera d'Arte";
- if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/martini") {
- string = string + " / Collezione Martini";
- }
- else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/ospedale") {
- string = string + " / Collezione Ospedale";
- }
- else if (graph == "http://dev.restore.ovi.cnr.it:8890/mpp/datini") {
- string = string + " / Collezione Datini";
- }
- else {
- string = string;
- }
- return (string);
- }
- function handle_Production(json) {
- console.log(json['results']['bindings']);
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var partecipants = "";
- var teche = "";
- var time = "";
- var client = "";
- var artist = "";
- var artist_name = "";
-
- if (value.hasOwnProperty('techniques')) {
- if (value['techniques']['value'] != "") {
- $("#MTC").css("display", "flex");
- tt = value['techniques']['value'];
- tec = tt.split("<br />");
- for (i in tec) {
- slice = tec[i].split("; ");
- /*teche += "<a href='" + slice[0] + "'>" + slice[1] + "</a><br />";*/
- teche += "<div class='d-flex'><div class='mr-3'><a href='" + slice[0] + "'>" +
- slice[1] + "</a></div>";
- }
- }
- }
- if (value.hasOwnProperty('Partecipants')) {
- pp = value['Partecipants']['value'];
- people = pp.split("<br />");
- for (i in people) {
- slice = people[i].split("; ");
- if (slice[2] == "Committente") {
- $("#CMM").css("display", "flex");
- client += slice[1];
- } else {
- $("#AUT").css("display", "flex");
- artist_name += slice[1];
- artist += "<div class='d-flex'><div class='mr-3'><a href='" + slice[0] + "'>" +
- slice[1] + "</a></div><div class='d-flex ml-auto'><div class='persona btn-icon' style='cursor:pointer' id='" +
- slice[0] + "'><i class='fa fa-user'></i><p class='btn-text'>PERSONA</p></div></div></div></div>";
- }
- }
- }
-
- if (value.hasOwnProperty('time') && (value['time']['value'] != "")) {
- $("#DT").css("display", "flex");
- time = value['time']['value'];
- }
- var authors = document.getElementsByClassName("author");
- for (i in authors) {
- authors[i].innerHTML = artist;
- }
- var dates = document.getElementsByClassName("date");
- for (i in dates) {
- dates[i].innerHTML = time;
- }
-
-
- document.getElementById("technique").innerHTML = teche;
- document.getElementById("client").innerHTML = client;
-
- });
-
- }
- function handle_Bibliography(json) {
- console.log(json['results']['bindings']);
- var Biblio = "";
- var bibCit = "";
- var g1858Cit = "";
- var g1888Cit = "";
- var p1912Cit = "";
- const bibArray = [];
- var catImg = "";
- var g1858Img = "";
- var g1888Img = "";
- var p1912Img = "";
- var n_cat = 0;
- var n_g1858 = 0;
- var n_g1888 = 0;
- var n_p1912 = 0;
- var provenienzaCat = "";
- var provenienzaG1858 = "";
- var provenienzaG1888 = "";
- var provenienzaP1912 = "";
- var licenzaCat = "";
- var licenzaG1858 = "";
- var licenzaG1888 = "";
- var licenzaP1912 = "";
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var bib = value['bibliography']['value'];
- var pages = "";
- if (value.hasOwnProperty('pages')) {
- pages = value['pages']['value'];
- }
- if (value.hasOwnProperty('catalog')) {
- var type = "";
- if (value.hasOwnProperty('type')) {
- type = value['type']['value'];
- }
- if (type == "Guida Marchini 1958") {
- bibCit = value['bibliography']['value'] + " " + pages;
- cc = value['catalog']['value'];
- cat = cc.split(", ");
- for (i in cat) {
- n_cat+=1;
- var marchini = cat[i].replace(".jpg", " (1).jpg");
- var img_catalogo = "img/MPP_marchini_stampa/" + marchini;
- img_cat.push({
- type: "image",
- url: "http://restore.ovi.cnr.it/beta/" + img_catalogo
- });
- }
- if (value.hasOwnProperty('provenienza')) {
- $("#CAT_PRO").css("display", "flex");
- provenienzaCat = value['provenienza']['value'];
- }
-
- if (value.hasOwnProperty('license')) {
- $("#CC_CAT").css("display", "flex");
- licenzaCat = '<img src="' + value['license']['value'] + '" width="100" height="auto">';
- }
- }
-
- if (type == "Guida Guasti 1858") {
- g1858Cit = value['bibliography']['value'] + " " + pages;
- cc1858 = value['catalog']['value'];
- cat1858 = cc1858.split(", ");
- for (i in cat1858) {
- n_g1858+=1;
- var guasti1858 = cat1858[i];
- var img_guasti1858 = "img/MPP_Guasti_1858/" + guasti1858;
- img_g1858.push({
- type: "image",
- url: "http://restore.ovi.cnr.it/beta/" + img_guasti1858
- });
- }
- if (value.hasOwnProperty('provenienza')) {
- $("#G1_PRO").css("display", "flex");
- provenienzaG1858 = value['provenienza']['value'];
- }
-
- if (value.hasOwnProperty('license')) {
- $("#CC_G1").css("display", "flex");
- licenzaG1858 = '<img src="' + value['license']['value'] + '" width="100" height="auto">';
- }
- }
- if (type == "Guida Guasti 1888") {
- g1888Cit = value['bibliography']['value'] + " " + pages;
- cc1888 = value['catalog']['value'];
- cat1888 = cc1888.split(", ");
- for (i in cat1888) {
- n_g1888+=1;
- var guasti1888 = cat1888[i];
- var img_guasti1888 = "img/MPP_Guasti_1888/" + guasti1888;
- img_g1888.push({
- type: "image",
- url: "http://restore.ovi.cnr.it/beta/" + img_guasti1888
- });
- }
- if (value.hasOwnProperty('provenienza')) {
- $("#G2_PRO").css("display", "flex");
- provenienzaG1888 = value['provenienza']['value'];
- }
-
- if (value.hasOwnProperty('license')) {
- $("#CC_G2").css("display", "flex");
- licenzaG1888 = '<img src="' + value['license']['value'] + '" width="100" height="auto">';
- }
- }
- if (type == "Catalogo Papini 1912") {
- p1912Cit = value['bibliography']['value'] + " " + pages;
- cc1912 = value['catalog']['value'];
- cat1912 = cc1912.split(", ");
- for (i in cat1912) {
- n_p1912+=1;
- var papini1912 = cat1912[i];
- img_papini1912 = "img/MPP_Papini_1912/" + papini1912;
- img_p1912.push({
- type: "image",
- url: "http://restore.ovi.cnr.it/beta/" + img_papini1912
- });
- }
- if (value.hasOwnProperty('provenienza')) {
- $("#PAP_PRO").css("display", "flex");
- provenienzaP1912 = value['provenienza']['value'];
- }
-
- if (value.hasOwnProperty('license')) {
- $("#CC_PAP").css("display", "flex");
- licenzaP1912 = '<img src="' + value['license']['value'] + '" width="100" height="auto">';
- }
- }
- }
-
- var book = bib + " " + pages;
- bibArray.push(book);
-
- });
- console.log(catImg);
- bibArray.sort();
- for (k in bibArray) {
- Biblio += '<li>' + bibArray[k] + '</li>';
- }
- document.getElementById("bibliography").innerHTML = Biblio;
- document.getElementById("catalog_description").innerHTML = bibCit;
- document.getElementById("guasti1858_description").innerHTML = g1858Cit;
- document.getElementById("guasti1888_description").innerHTML = g1888Cit;
- document.getElementById("papini1912_description").innerHTML = p1912Cit;
- document.getElementById("catalogueInstitute").innerHTML = provenienzaCat;
- document.getElementById("guasti1Institute").innerHTML = provenienzaG1858;
- document.getElementById("guasti2Institute").innerHTML = provenienzaG1858;
- document.getElementById("papiniInstitute").innerHTML = provenienzaP1912;
- document.getElementById("license_cat").innerHTML = licenzaCat;
- document.getElementById("license_g1").innerHTML = licenzaG1858;
- document.getElementById("license_g2").innerHTML = licenzaG1888;
- document.getElementById("license_pap").innerHTML = licenzaP1912;
- if (n_cat == 0) {
- $("#btn_catalogo").css("display", "none");
- }
- if (n_g1858 == 0) {
- $("#btn_guasti1858").css("display", "none");
- }
- if (n_g1888 == 0) {
- $("#btn_guasti1888").css("display", "none");
- }
- if (n_p1912 == 0) {
- $("#btn_papini1912").css("display", "none");
- }
-
- }
- function handle_Iconclass(json) {
-
- console.log(json['results']['bindings']);
- var Icon = "";
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var uri_icon = value['uri_iconclass']['value'];
- var sigla_icon = value['iconclass']['value'];
-
- Icon += '<a href="' + uri_icon + '">' + sigla_icon + '</a><br />';
-
- });
-
- document.getElementById("iconclass").innerHTML = Icon;
- if (Icon != "") {
- $("#ICON").css("display", "flex");
- }
- }
- function handle_SchedeStoriche(json) {
- console.log(json['results']['bindings']);
- const schede = [];
- var m1956Img = "";
- var n_m1956 = 0;
- var provenienzaScheda = "";
- var provenienzaM1956 = "";
- var licenzaScheda = "";
- var licenzaM1956 = "";
- let suffix = ["0", "1", "2", "3", "4", "5"];
- $.each(
- json['results']['bindings'],
- function (index, value) {
- var type = value['type']['value'];
- var scheda = value['scheda']['value'];
- console.log([type, scheda]);
- if (type == "Scheda Storica") {
- var sc = scheda.replace(".jpg", "");
- schede.push(scheda);
- //img_sc = "img/schedeStoriche/" + sc + "/0.jpg";;
- for (i in suffix) {
- ss = suffix[i];
- var image_scheda = "img/schedeStoriche/" + sc + "/" + ss + ".jpg";
- createScheda(image_scheda);
- }
- if (value.hasOwnProperty('provenienza')) {
- $("#CAT_SC").css("display", "flex");
- provenienzaScheda = value['provenienza']['value'];
- }
-
- if (value.hasOwnProperty('license')) {
- $("#CC_SC").css("display", "flex");
- licenzaScheda = '<img src="' + value['license']['value'] + '" width="100" height="auto">';
- }
- }
- /* img_sc = "img/mpp_img/" + scheda;
- schede += '<div class="row"> \
- <img class="viewImage" src="img/mpp_img/' + scheda + '" onclick="expandImg(this);" /> \
- </div>';
- var dir = "img/schedeStoriche/" + scheda + "/";
- console.log(files);*/
- if (type == "Marchini 1956") {
- cc1956 = scheda;
- cat1956 = cc1956.split(", ");
- for (i in cat1956) {
- n_m1956 = n_m1956 + 1;
- var marchini1956 = cat1956[i];
- var img_marchini1956 = "img/MPP_Marchini_1956/" + marchini1956;
- img_m1956.push({
- type: "image",
- url: "http://restore.ovi.cnr.it/beta/" + img_marchini1956
- });
- }
- if (value.hasOwnProperty('provenienza')) {
- $("#M2_PRO").css("display", "flex");
- provenienzaM1956 = value['provenienza']['value'];
- }
-
- if (value.hasOwnProperty('license')) {
- $("#CC_M2").css("display", "flex");
- licenzaM1956 = '<img src="' + value['license']['value'] + '" width="100" height="auto">';
- }
- }
-
- });
- document.getElementById("cardInstitute").innerHTML = provenienzaScheda;
- document.getElementById("marchini2Institute").innerHTML = provenienzaM1956;
- document.getElementById("license_card").innerHTML = licenzaScheda;
- document.getElementById("license_m2").innerHTML = licenzaM1956;
- if (schede.length = 0) {
- $("#btn_schedastorica").css("display", "none");
- }
- console.log(n_m1956);
- if (n_m1956 == 0) {
- $("#btn_marchini1956").css("display", "none");
- }
-
- }
- function createScheda(image) {
- checkIfSchedaExists(image, (exists) => {
- if (exists) {
- var ImageScheda = '<div class="row"> \
- <img class="minImage viewImage" src="' + image + '" onclick="expandImg(this);"> \
- </div>';
- img_sc.push({
- type: "image",
- url: "http://restore.ovi.cnr.it/beta/" + image
- });
- } else {
- console.error('Image does not exists.')
- }
- });
- }
- function checkIfSchedaExists(url, callback) {
- const img = new Image();
- img.src = url;
-
- if (img.complete) {
- callback(true);
- } else {
- img.onload = () => {
- callback(true);
- };
-
- img.onerror = () => {
- callback(false);
- };
- }
- }
- function show_OA(){
- document.getElementById("OA_info").style.display = "block";
- document.getElementById("catalogo_info").style.display = "none";
- document.getElementById("scheda_info").style.display = "none";
- document.getElementById("guasti1858_info").style.display = "none";
- document.getElementById("guasti1888_info").style.display = "none";
- document.getElementById("papini1912_info").style.display = "none";
- document.getElementById("marchini1956_info").style.display = "none";
- document.getElementById("img_title").innerHTML = "Opera";
- clearViewer();
- runOpenseadragon(img_pic);
- }
- function show_CAT(){
- document.getElementById("OA_info").style.display = "none";
- document.getElementById("catalogo_info").style.display = "block";
- document.getElementById("scheda_info").style.display = "none";
- document.getElementById("guasti1858_info").style.display = "none";
- document.getElementById("guasti1888_info").style.display = "none";
- document.getElementById("papini1912_info").style.display = "none";
- document.getElementById("marchini1956_info").style.display = "none";
- document.getElementById("img_title").innerHTML = "Guida 1958";
- clearViewer();
- runOpenseadragon(img_cat);
- }
- function show_INV(){
- document.getElementById("OA_info").style.display = "none";
- document.getElementById("catalogo_info").style.display = "none";
- document.getElementById("scheda_info").style.display = "block";
- document.getElementById("guasti1858_info").style.display = "none";
- document.getElementById("guasti1888_info").style.display = "none";
- document.getElementById("papini1912_info").style.display = "none";
- document.getElementById("marchini1956_info").style.display = "none";
- document.getElementById("img_title").innerHTML = "Scheda Storica";
- clearViewer();
- runOpenseadragon(img_sc);
- }
- function show_G1858(){
- document.getElementById("OA_info").style.display = "none";
- document.getElementById("catalogo_info").style.display = "none";
- document.getElementById("scheda_info").style.display = "none";
- document.getElementById("guasti1858_info").style.display = "block";
- document.getElementById("guasti1888_info").style.display = "none";
- document.getElementById("papini1912_info").style.display = "none";
- document.getElementById("marchini1956_info").style.display = "none";
- document.getElementById("img_title").innerHTML = "Guida 1858";
- clearViewer();
- runOpenseadragon(img_g1858);
- }
- function show_G1888(){
- document.getElementById("OA_info").style.display = "none";
- document.getElementById("catalogo_info").style.display = "none";
- document.getElementById("scheda_info").style.display = "none";
- document.getElementById("guasti1858_info").style.display = "none";
- document.getElementById("guasti1888_info").style.display = "block";
- document.getElementById("papini1912_info").style.display = "none";
- document.getElementById("marchini1956_info").style.display = "none";
- document.getElementById("img_title").innerHTML = "Guida 1888";
- clearViewer();
- runOpenseadragon(img_g1888);
- }
- function show_P1912(){
- document.getElementById("OA_info").style.display = "none";
- document.getElementById("catalogo_info").style.display = "none";
- document.getElementById("scheda_info").style.display = "none";
- document.getElementById("guasti1858_info").style.display = "none";
- document.getElementById("guasti1888_info").style.display = "none";
- document.getElementById("papini1912_info").style.display = "block";
- document.getElementById("marchini1956_info").style.display = "none";
- document.getElementById("img_title").innerHTML = "Guida 1912";
- clearViewer();
- runOpenseadragon(img_p1912);
- }
- function show_M1956(){
- document.getElementById("OA_info").style.display = "none";
- document.getElementById("catalogo_info").style.display = "none";
- document.getElementById("scheda_info").style.display = "none";
- document.getElementById("guasti1858_info").style.display = "none";
- document.getElementById("guasti1888_info").style.display = "none";
- document.getElementById("papini1912_info").style.display = "none";
- document.getElementById("marchini1956_info").style.display = "block";
- document.getElementById("img_title").innerHTML = "Inventario 1956";
- clearViewer();
- runOpenseadragon(img_m1956);
- //document.getElementById("expandedImg").src = img_m1956;
- }
- let magnifierInterval;
- function createMagnifier(imgID, zoom){
- magnify(imgID, zoom);
- let glass = document.getElementById('glass');
- let img = document.getElementById(imgID);
- magnifierInterval = setInterval(
- function(){
- // console.log('LOOP in corso');
- glass.style.backgroundImage = "url('" + img.src + "')";
- },
- 500
- )
- }
- function destroyMagnifier(){
- clearInterval(magnifierInterval);
- const element = document.getElementById('glass');
- element.remove();
- }
- function magnify(imgID, zoom) {
- var img, glass, w, h, bw;
- img = document.getElementById(imgID);
- /*create magnifier glass:*/
- glass = document.createElement("DIV");
- glass.setAttribute("class", "img-magnifier-glass");
- glass.setAttribute("id", "glass");
- /*insert magnifier glass:*/
- img.parentElement.insertBefore(glass, img);
- /*set background properties for the magnifier glass:*/
- glass.style.backgroundImage = "url('" + img.src + "')";
- glass.style.backgroundRepeat = "no-repeat";
- glass.style.backgroundSize = (img.width * zoom) + "px " + (img.height * zoom) + "px";
- bw = 3;
- w = glass.offsetWidth / 2;
- h = glass.offsetHeight / 2;
- /*execute a function when someone moves the magnifier glass over the image:*/
- glass.addEventListener("mousemove", moveMagnifier);
- img.addEventListener("mousemove", moveMagnifier);
- /*and also for touch screens:*/
- glass.addEventListener("touchmove", moveMagnifier);
- img.addEventListener("touchmove", moveMagnifier);
- function moveMagnifier(e) {
- var pos, x, y;
- /*prevent any other actions that may occur when moving over the image*/
- e.preventDefault();
- /*get the cursor's x and y positions:*/
- pos = getCursorPos(e);
- x = pos.x;
- y = pos.y;
- /*prevent the magnifier glass from being positioned outside the image:*/
- if (x > img.width - (w / zoom)) {x = img.width - (w / zoom);}
- if (x < w / zoom) {x = w / zoom;}
- if (y > img.height - (h / zoom)) {y = img.height - (h / zoom);}
- if (y < h / zoom) {y = h / zoom;}
- /*set the position of the magnifier glass:*/
- glass.style.left = (x - w) + "px";
- glass.style.top = (y - h) + "px";
- /*display what the magnifier glass "sees":*/
- glass.style.backgroundPosition = "-" + ((x * zoom) - w + bw) + "px -" + ((y * zoom) - h + bw) + "px";
- }
- function getCursorPos(e) {
- var a, x = 0, y = 0;
- e = e || window.event;
- /*get the x and y positions of the image:*/
- a = img.getBoundingClientRect();
- /*calculate the cursor's x and y coordinates, relative to the image:*/
- x = e.pageX - a.left;
- y = e.pageY - a.top;
- /*consider any page scrolling:*/
- x = x - window.pageXOffset;
- y = y - window.pageYOffset;
- return {x : x, y : y};
- }
- }
- function clearViewer() {
- var div = document.getElementById("contentDiv");
-
- while(div.firstChild) {
- div.removeChild(div.firstChild);
- }
- }
|