From ba3becdcc556208c0fa76619822e207cc745ae9d Mon Sep 17 00:00:00 2001 From: Guillaume-Levrier Date: Sat, 16 Sep 2023 11:30:21 +0200 Subject: [PATCH] archotype issue located --- js/preload-index.js | 11 +++++++++-- js/types.js | 8 ++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/js/preload-index.js b/js/preload-index.js index ecebf10..fa44939 100644 --- a/js/preload-index.js +++ b/js/preload-index.js @@ -2932,18 +2932,25 @@ const archotype = (id) => { if (resolver) { node.style("cursor", d => d.domain ? "move" : "pointer") + + + + node.on("click", (e, d) => (d.domain) ? 0 : fetch( - `http://${resolver}/solr/netarchivebuilder/select?q=url:"${d.id}"` + `http://${resolver}/solr/netarchivebuilder/select?q=url:${JSON.stringify(d.id)}` ) .then((r) => r.json()) .then((r) => { + + console.log(`http://${resolver}/solr/netarchivebuilder/select?q=url:${JSON.stringify(d.id)}`) console.log(r) + if (r.response.numFound > 0) { var content = ""; - const doc = r.response.docs[0] + const doc = r.response.docs[r.response.docs.length - 1] for (const key in doc) { content += `
${key}
${doc[key]}

` diff --git a/js/types.js b/js/types.js index 3f7f6d5..65b826c 100644 --- a/js/types.js +++ b/js/types.js @@ -776,18 +776,22 @@ const archotype = (id) => { if (resolver) { node.style("cursor", d => d.domain ? "move" : "pointer") + node.on("click", (e, d) => (d.domain) ? 0 : fetch( - `http://${resolver}/solr/netarchivebuilder/select?q=url:"${d.id}"` + `http://${resolver}/solr/netarchivebuilder/select?q=url:${JSON.stringify(d.id)}` ) .then((r) => r.json()) .then((r) => { + + console.log(`http://${resolver}/solr/netarchivebuilder/select?q=url:${JSON.stringify(d.id)}`) console.log(r) + if (r.response.numFound > 0) { var content = ""; - const doc = r.response.docs[0] + const doc = r.response.docs[r.response.docs.length - 1] for (const key in doc) { content += `
${key}
${doc[key]}

`