diff --git a/docs/render/bookmarklet.js b/docs/render/bookmarklet.js index 7ece218..996aed2 100644 --- a/docs/render/bookmarklet.js +++ b/docs/render/bookmarklet.js @@ -20,7 +20,7 @@ loadSyle(script.replace("js", "css")).then(() => { el("div", {className:"description"}, params.info?.d ?? ""), el("a", {className:"bookmarklet", href:url}, el("span", {className:"capsule", innerText:"" + title || "Bookmarklet"})), el("p", {id:"emoji", innerText:"☝️"}), - el("p", {innerHTML:`This page contains a bookmarklet. (learn more)`}), + el("p", {innerHTML:`This page contains a bookmarklet.
(learn more)`}), el("p", {className:"", innerText:`Drag this bookmarklet to your ${managerName} to use it.`}), el("p", {className:"hint desktop", innerText:`(Hit ${cmdKey} to toggle the ${managerName} bar)`}), @@ -29,4 +29,6 @@ loadSyle(script.replace("js", "css")).then(() => { ) ); + parent.postMessage({}, "*"); + }) diff --git a/docs/render/bookmarklet.url.js b/docs/render/bookmarklet.url.js index 0a9d53b..72a5a80 100644 --- a/docs/render/bookmarklet.url.js +++ b/docs/render/bookmarklet.url.js @@ -10,10 +10,12 @@ .pop(); if (!ld) alert("No recipe data found on this page. Sorry!"); ld = JSON.parse(ld); - if (ld["@type"] != "Recipe"){ ld=(ld["@graph"]??ld).find((item)=>item["@type"]=="Recipe") } + if (Array.isArray(ld)) ld = ld.pop(); + if (!ld["@type"]?.includes("Recipe")){ ld=(ld["@graph"]??ld).find((item)=>item["@type"]=="Recipe") } delete ld.review; delete ld.video; if (!ld.url) ld.url = location.href; + console.log("Found Recipe", ld) f = new FileReader(); f.onload = function(e) {location.href=(ib + '/#/' + e.target.result);}; f.readAsDataURL(new Blob([JSON.stringify(ld)],{type:'application/ld+json;compress=true;charset=utf-8'}));