mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
Hide bookmarklet loader
This commit is contained in:
parent
ffda6ea2b3
commit
63698da413
2 changed files with 6 additions and 2 deletions
|
|
@ -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. (<a target="_blank" href="https://en.wikipedia.org/wiki/Bookmarklet">learn more</a>)`}),
|
||||
el("p", {innerHTML:`This page contains a bookmarklet.<br>(<a target="_blank" href="https://en.wikipedia.org/wiki/Bookmarklet">learn more</a>)`}),
|
||||
|
||||
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({}, "*");
|
||||
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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'}));
|
||||
|
|
|
|||
Loading…
Reference in a new issue