Skip to content

Commit

Permalink
add link to file
Browse files Browse the repository at this point in the history
  • Loading branch information
Lomet committed Dec 22, 2024
1 parent 681b18c commit 33a5e83
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
margin: 10px 0;
padding: 5px;
}

a {
margin-left: 10px;
display: inline-block;
}
</style>
</head>

Expand All @@ -28,6 +33,7 @@ <h1>Available Chains</h1>
<!-- This placeholder will be replaced with real options -->
{{CHAIN_OPTIONS_PLACEHOLDER}}
</select>
<a id="jsonLink" href="#" target="_blank" style="display:none;">Open JSON File</a>

<h2>JSON Viewer</h2>
<div id="jsoneditor"></div>
Expand All @@ -37,6 +43,7 @@ <h2>JSON Viewer</h2>
const editor = new JSONEditor(container);

const dropdown = document.getElementById("chainDropdown");
const jsonLink = document.getElementById("jsonLink");

// Load JSON for the selected chain
function loadSelectedChain() {
Expand All @@ -46,6 +53,11 @@ <h2>JSON Viewer</h2>
return;
}

// Update the link to the JSON file
jsonLink.href = selectedValue;
jsonLink.style.display = "inline-block";

// Fetch and display the JSON data
fetch(selectedValue)
.then(response => {
if (!response.ok) {
Expand Down

0 comments on commit 33a5e83

Please sign in to comment.