diff --git a/docs/base.css b/docs/base.css index dd8e17c..af13228 100644 --- a/docs/base.css +++ b/docs/base.css @@ -1,4 +1 @@ -body{margin:0 auto;padding:12vmin 10vmin;max-width:35em;line-height:1.5em;font-family:-apple-system,BlinkMacSystemFont,sans-serif;word-wrap:break-word;} - - -@media (prefers-color-scheme: dark){body{color:white;background-color:#111;}} \ No newline at end of file +body{margin:0 auto;padding:12vmin 10vmin;max-width:35em;line-height:1.5em;font-family:-apple-system,BlinkMacSystemFont,sans-serif;word-wrap:break-word;}@media(prefers-color-scheme: dark){body{color:white;background-color:#111;}} \ No newline at end of file diff --git a/docs/bookmarklet.url.js b/docs/bookmarklet.url.js index bb3a4ee..08e9dcb 100644 --- a/docs/bookmarklet.url.js +++ b/docs/bookmarklet.url.js @@ -15,9 +15,9 @@ https://itty.bitty.app/Recipe_Bookmarklet/Simplify_recipes_with_a_click./%F0%9F% // DOM extraction -javascript:f=new FileReader();f.onload=function(e){top.location.href=('https://itty.bitty.app/#/'+e.target.result)};f.readAsDataURL(new Blob([document.documentElement.outerHTML],{type:'text/raw+html;render=parse;encode=none;charset=utf-8'})); +javascript:f=new(FileReader)();f.onload=function(e){top.location.href=('https://itty.bitty.app/#/'+e.target.result)};f.readAsDataURL(new(Blob)([document.documentElement.outerHTML],{type:'text/raw+html;render=parse;encode=none;charset=utf-8'})); -javascript:f=new FileReader();f.onload=function(e){top.location.href=('http://localhost:8888/#/'+e.target.result)};f.readAsDataURL(new Blob([document.documentElement.outerHTML],{type:'text/raw+html;render=parse;encode=none;charset=utf-8'})); +javascript:f=new(FileReader)();f.onload=function(e){top.location.href=('http://localhost:8888/#/'+e.target.result)};f.readAsDataURL(new(Blob)([document.documentElement.outerHTML],{type:'text/raw+html;render=parse;encode=none;charset=utf-8'})); diff --git a/docs/index.html b/docs/index.html index a821f23..e857050 100644 --- a/docs/index.html +++ b/docs/index.html @@ -12,11 +12,5 @@ -
- itty.bitty is experimental technology that renders linked content from outside sources. - Learn more. -

This content is only as trustworthy as its source, and it should be treated with the caution you would show any insecure web page. -

-
diff --git a/docs/index.js b/docs/index.js index fbeae96..ebd29c6 100644 --- a/docs/index.js +++ b/docs/index.js @@ -16,6 +16,15 @@ if (document.getElementById("never").checked) window.localStorage.setItem('toasted', true); document.body.classList.remove("toasting") } + + function addToast() { + // `
+ // itty.bitty is experimental technology that renders linked content from outside sources. + // Learn more. + //

This content is only as trustworthy as its source, and it should be treated with the caution you would show any insecure web page. + //

+ //
` + } function setFavicon(favicon) { document.getElementById("favicon").href = 'data:image/svg+xml,'+ favicon + '' @@ -75,17 +84,16 @@ var dataPrefix = undefined; var renderMode = "data"; - let components = window.location.pathname.substring(1).split("/"); let info = {} - info.t = decodeURIComponent(components.shift()).replace(/_/g, " "); - components.forEach(component => { - let field = component.split(":"); - let key = field.shift(); - let value = decodeURIComponent(field.join(":")); + info.title = decodeURIComponent(components.shift()).replace(/-/g, " ").replace(/–/g, "-"); + let i; + for (i = 0; i < components.length; i+=2) { + let key = components[i]; + let value = decodeURIComponent(components[i+1]); if (key.length && value.length) info[key] = value; - }) - info.d = info.d?.replace(/_/g, " "); + } + info.d = info.d?.replace(/-/g, " ").replace(/–/g, "-"); var slashIndex = fragment.indexOf("/"); diff --git a/docs/render/bookmarklet.css b/docs/render/bookmarklet.css index e417e66..655d285 100644 --- a/docs/render/bookmarklet.css +++ b/docs/render/bookmarklet.css @@ -28,6 +28,10 @@ a.bookmarklet { transition:transform 1s; } +.description { + opacity:0.2; + margin-bottom:10px; +} .hint { font-size:small; opacity:0.54; diff --git a/docs/render/bookmarklet.js b/docs/render/bookmarklet.js index cbd26b0..453f5f7 100644 --- a/docs/render/bookmarklet.js +++ b/docs/render/bookmarklet.js @@ -22,8 +22,9 @@ loadSyle(document.currentScript.src.replace("js", "css")) document.body.appendChild( el("div", {id:"content"}, - el("a", {className:"bookmarklet", href:url}, el("span", {className:"capsule", innerText:"▶ " + title || "Bookmarklet"})), - el("p", {id:"emoji", innerText:"☝️"}), + 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.`}), el("p", {className:"", innerText:`Drag this bookmarklet to your ${managerName} to use it.`}), diff --git a/docs/render/parse.js b/docs/render/parse.js index 340f6e0..b13a633 100644 --- a/docs/render/parse.js +++ b/docs/render/parse.js @@ -14,7 +14,7 @@ if (ldjson) { let f = new FileReader(); f.onload = function(e) { //top.location.href = ( '/#/' + e.target.result); - parent.postMessage({replaceURL:'/temp#/' + e.target.result}, "*"); + parent.postMessage({replaceURL:'/#/' + e.target.result}, "*"); }; f.readAsDataURL(new Blob([ldjson],{type : 'application/ld+json;charset=utf-8'})); } else {