Skip to content

Commit

Permalink
Merge pull request #5 from BelWue/fix-link
Browse files Browse the repository at this point in the history
fix JSON link
  • Loading branch information
debugloop authored May 10, 2022
2 parents 81bab74 + cd095de commit 381af50
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lookingglass/lookingglass.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,14 @@ function queryPrefix() {
// display a link to raw JSON output
if (lgSettings.routeinfoAPI.showAPILink) {
// check if an old link exists and remove it
var lastAPILink = document.querySelector("#lg-query-block").querySelector("#lg-api-link-block");
if (lastAPILink) {
lastAPILink.href = url;
var lastAPILinkBlock = document.querySelector("#lg-query-block").querySelector("#lg-api-link-block");
if (lastAPILinkBlock) {
lastAPILinkBlock.querySelector("#lg-api-link").href = url.href;
} else {
// copy the template and set the right URL
var apiLinkTemplate = document.querySelector("#lg-template-api-link");
var apiLink = document.importNode(apiLinkTemplate.content, true);
apiLink.querySelector("#lg-api-link").href = url;
apiLink.querySelector("#lg-api-link").href = url.href;
var querySection = document.querySelector("#lg-query-block");
querySection.appendChild(apiLink);
}
Expand Down

0 comments on commit 381af50

Please sign in to comment.