diff --git a/docs/index.js b/docs/index.js index 0610224..c39f3f7 100644 --- a/docs/index.js +++ b/docs/index.js @@ -27,6 +27,7 @@ const renderers = { "application/ld+json": {script:"recipe"}, + "text/rawhtml": {script:"parse"}, "javascript": {script:"bookmarklet"}, "web3": {script:"web3", mode:"frame"}, } diff --git a/docs/render/parse.js b/docs/render/parse.js new file mode 100644 index 0000000..9311450 --- /dev/null +++ b/docs/render/parse.js @@ -0,0 +1,9 @@ +// let title = params.title + +const parser = new DOMParser(); +const doc = parser.parseFromString(params.body, "text/html"); + +let ldjson = doc.querySelector('script[type="application/ld+json"]').innerText.trim(); +let f = new FileReader(); +f.onload = function(e) { top.location.href = ( '/#/' + e.target.result);}; +f.readAsDataURL(new Blob([ldjson],{type : 'application/ld+json;charset=utf-8'})); \ No newline at end of file