Skip to content

Commit 362a60f

Browse files
feat: data browser shows pod-os link next to each URL (#38)
Both browsers (--browser json and the JSON fallback in --browser folder) now render a small brand-purple ↗ icon after every URL in the JSON-LD pretty-print. Click the URL → direct navigation. Click ↗ → opens browser.pod-os.org with that URI pre-loaded. Default direct-navigation behavior is unchanged; the icon is an optional discoverable affordance. Fixes #37
1 parent 8a90248 commit 362a60f

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

data-browser-folder.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ body{font:14px/1.55 system-ui,-apple-system,sans-serif;margin:0;color:#222;backg
3535
.db-pre{padding:1.5em;background:#fff;border-radius:12px;box-shadow:0 2px 12px rgba(0,0,0,.08);overflow:auto;white-space:pre-wrap;word-break:break-all;margin:0}
3636
.db-pre a{color:#0a66c2;text-decoration:none}
3737
.db-pre a:hover{text-decoration:underline}
38+
.db-pre .pod-os{color:#7a4ed8;text-decoration:none;font-size:1em;font-weight:600;margin:0 .15em 0 .3em;opacity:.65;transition:opacity .15s}
39+
.db-pre .pod-os:hover{opacity:1;text-decoration:none}
3840
</style>`);
3941

4042
(function () {
@@ -111,7 +113,8 @@ body{font:14px/1.55 system-ui,-apple-system,sans-serif;margin:0;color:#222;backg
111113
if (!d) return `<div class="db-pre">No data.</div>`;
112114
const pretty = JSON.stringify(d, null, 2)
113115
.replace(/[<>&]/g, c => ({ '<': '&lt;', '>': '&gt;', '&': '&amp;' }[c]))
114-
.replace(/https?:\/\/[^"\s]+/g, '<a href="$&">$&</a>');
116+
.replace(/https?:\/\/[^"\s]+/g, m =>
117+
`<a href="${m}">${m}</a><a class="pod-os" href="https://browser.pod-os.org/?uri=${encodeURIComponent(m)}" target="_blank" rel="noopener" title="View in pod-os">↗</a>`);
115118
return `<pre class="db-pre">${pretty}</pre>`;
116119
}
117120

data-browser.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)