📕 subnode [[@vera-wiki-anagora-org/download to upload]] in 📚 node [[download-to-upload]]

HTML scripts run within the Frame plugin sandbox can read information from various lineup resources but do not have any mechanism to save results. We recommend scripts offer a button to download results to be then immediately uploaded to an associated Assets folder.

This is particularly handy when a computation takes many seconds reading pages and rolling up summary results as a json file to be used elsewhere.

Method

Write an html page with javascript code within the <script> tag. Include a

for summary results and

Use Frame plugin messages to access parameters. Use <script type=module> and await to simplify these interactions.

See [[About Frame Integrations]]

Download computed results using the obscure but well accepted technique of attaching a dataurl to an anchor tag and programmatically clicking it.

function download(obj, file) { let code = encodeURIComponent(JSON.stringify(obj)) let href = "data:text/json;charset=utf-8,"+code let anchor = document.createElement('a') anchor.setAttribute("href", href) anchor.setAttribute("download", file) document.body.appendChild(anchor) // for firefox anchor.click() anchor.remove() }

Examples

In the wiki support for the sofi assessment method individuals will compose reports to be rolled up by the administrator once a week.

This page is where the administrator reviews and aggregates the assessments of Roster members.

Many scripts in the trails wiki benefit from having a rolled up summary of trail locations. Revising this json file is now part of the routine of adding new pages.

Scan trail pages for photograph or other notable locations marked on maps. Download revised marker.json to be share from this Asset.

📖 stoas
⥱ context