diff --git a/data-browser.js b/data-browser.js index 70258cd..aabb7cc 100644 --- a/data-browser.js +++ b/data-browser.js @@ -1,9 +1,12 @@ // jspod minimal data browser — the page is the data. JSS embeds the // resource as JSON-LD in #dataisland; this single module: // 1. Injects its own ') +// 2. Renders a small nav (Up / Home / Account / Docs) above the data +// 3. Parses the JSON-LD and pretty-prints with 2-space indent +// 4. Renders into #mashlib with every URI as a clickable +document.head.insertAdjacentHTML('beforeend','') +const p=window.location.pathname +const up=(p==='/'||!p)?null:(s=>{const i=s.lastIndexOf('/');return i===0?'/':s.slice(0,i)+'/'})(p.replace(/\/$/,'')) +const nav='' const d=JSON.parse(document.getElementById('dataisland').textContent) -document.getElementById('mashlib').innerHTML='
'+JSON.stringify(d,null,2).replace(/https?:\/\/[^"\s]+/g,'$&')+'
' +document.getElementById('mashlib').innerHTML=nav+'
'+JSON.stringify(d,null,2).replace(/https?:\/\/[^"\s]+/g,'$&')+'
' diff --git a/package.json b/package.json index 269f2f0..4cf6f96 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jspod", - "version": "0.0.24", + "version": "0.0.25", "description": "JavaScript Solid Pod - Just works, batteries included", "type": "module", "main": "index.js",