diff --git a/favicon.png b/favicon.png new file mode 100644 index 0000000..8e0569b Binary files /dev/null and b/favicon.png differ diff --git a/index.html b/index.html index cce39fe..a82e8bd 100644 --- a/index.html +++ b/index.html @@ -2,10 +2,14 @@ - + +
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. +

edit diff --git a/manifest.appcache b/manifest.appcache index 675e18c..e8a7216 100644 --- a/manifest.appcache +++ b/manifest.appcache @@ -1,2 +1,3 @@ CACHE MANIFEST -# v8 \ No newline at end of file +/favicon.ico +# v15 \ No newline at end of file diff --git a/src/index.css b/src/index.css index c6ea50a..5e6f4bc 100644 --- a/src/index.css +++ b/src/index.css @@ -38,3 +38,25 @@ body { #warning:empty { display: none; } +body.toasting #iframe, +body.toasting #edit { + opacity: 0.5; + pointer-events: none; +} +body.toasting #toast { + box-sizing: border-box; + background-color: #feecc2; + border-radius: 4px; + font-size: 13px; + left: 50%; + top: 10px; + margin-left: -160px; + padding: 1em; + position: absolute; + max-width: 320px; + z-index: 101; +} +body:not(.toasting) #toast, +body.toasting #warning { + display: none; +} diff --git a/src/index.js b/src/index.js index a039de8..28219f4 100644 --- a/src/index.js +++ b/src/index.js @@ -1,11 +1,19 @@ var HEAD_TAGS = "PGJhc2UgdGFyZ2V0PSJfdG9wIj4K"; var HEAD_TAGS_EXTENDED = "PG1ldGEgY2hhcnNldD0idXRmLTgiPjxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgiPjxiYXNlIHRhcmdldD0iX3RvcCI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj5ib2R5e21hcmdpbjowIGF1dG87cGFkZGluZzoxMnZtaW4gMTB2bWluO21heC13aWR0aDozNWVtO2xpbmUtaGVpZ2h0OjEuNWVtO2ZvbnQtZmFtaWx5OiAtYXBwbGUtc3lzdGVtLEJsaW5rTWFjU3lzdGVtRm9udCxzYW5zLXNlcmlmO3dvcmQtd3JhcDogYnJlYWstd29yZDt9PC9zdHlsZT4g"; + +function dismiss() { + if (document.getElementById("never").checked) window.localStorage.setItem('toasted', true); + document.body.classList.remove("toasting") +} + window.onhashchange = window.onload = function() { var hash = window.location.hash.substring(1); if (hash.length < 3) { location.href = "/edit"; } else { + if (!window.localStorage.getItem('toasted')) document.body.classList.add("toasting"); + var iframe = document.getElementById("iframe"); var link = document.getElementById("edit"); var preamble = undefined; diff --git a/src/index.min.css b/src/index.min.css index e869d99..fa29945 100644 --- a/src/index.min.css +++ b/src/index.min.css @@ -1 +1 @@ -body{font-family:sans-serif}#iframe{border:none;height:100%;left:0;top:0;width:100%}#edit,#iframe{position:absolute}#edit{color:rgba(0,0,0,.54);display:none;font-family:monospace;font-weight:700;right:1em;top:.85em;z-index:100}#edit:not(:hover){text-decoration:none}#warning{background-color:#feecc2;border-radius:4px;font-size:16px;left:50vw;margin-left:-10em;padding:1em;position:absolute;top:10vh;width:20em;z-index:100}#warning:empty{display:none} \ No newline at end of file +body{font-family:sans-serif}#iframe{border:none;height:100%;left:0;top:0;width:100%}#edit,#iframe{position:absolute}#edit{color:rgba(0,0,0,.54);display:none;font-family:monospace;font-weight:700;right:1em;top:.85em;z-index:100}#edit:not(:hover){text-decoration:none}#warning{background-color:#feecc2;border-radius:4px;font-size:16px;left:50vw;margin-left:-10em;padding:1em;position:absolute;top:10vh;width:20em;z-index:100}#warning:empty{display:none}body.toasting #edit,body.toasting #iframe{opacity:.5;pointer-events:none}body.toasting #toast{background-color:#feecc2;border-radius:4px;box-sizing:border-box;font-size:13px;left:50%;margin-left:-160px;max-width:320px;padding:1em;position:absolute;top:10px;z-index:101}body.toasting #warning,body:not(.toasting) #toast{display:none} \ No newline at end of file diff --git a/src/index.min.js b/src/index.min.js index 5d44c68..9192f7f 100644 --- a/src/index.min.js +++ b/src/index.min.js @@ -1 +1 @@ -var HEAD_TAGS="PGJhc2UgdGFyZ2V0PSJfdG9wIj4K";var HEAD_TAGS_EXTENDED="PG1ldGEgY2hhcnNldD0idXRmLTgiPjxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgiPjxiYXNlIHRhcmdldD0iX3RvcCI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj5ib2R5e21hcmdpbjowIGF1dG87cGFkZGluZzoxMnZtaW4gMTB2bWluO21heC13aWR0aDozNWVtO2xpbmUtaGVpZ2h0OjEuNWVtO2ZvbnQtZmFtaWx5OiAtYXBwbGUtc3lzdGVtLEJsaW5rTWFjU3lzdGVtRm9udCxzYW5zLXNlcmlmO3dvcmQtd3JhcDogYnJlYWstd29yZDt9PC9zdHlsZT4g";window.onhashchange=window.onload=function(){var hash=window.location.hash.substring(1);if(hash.length<3){location.href="/edit"}else{var iframe=document.getElementById("iframe");var link=document.getElementById("edit");var preamble=undefined;var slashIndex=hash.indexOf("/");var title=hash.substring(0,slashIndex);document.title=title.length?decodeURIComponent(title.replace(/_/g," ")):location.hostname;hash=hash.substring(slashIndex+1);var editable=hash.charAt(0)=="?";if(editable){hash=hash.substring(1)}if(hash.indexOf("data:")!=0){var compressed=true;preamble=HEAD_TAGS_EXTENDED;hash="data:text/html;charset=utf-8;"+(compressed?"bxze64,":"base64,")+hash}else if(hash.indexOf("data:text/html;")==0){preamble=HEAD_TAGS}link.onclick=function(){location.href="/edit"+location.hash};var isIE=navigator.userAgent.match(/rv:11/);var isEdge=navigator.userAgent.match(/Edge\//);if((isEdge||isIE)&&location.href.length==2083){document.getElementById("warning").innerHTML='Edge only supports shorter URLs (maximum 2083 bytes).
Larger sites may require a different browser.
Learn more'}decompressDataURI(hash,preamble,function(hash){if(!hash)return;iframe.sandbox="allow-scripts allow-forms allow-top-navigation allow-popups allow-modals";if(!isIE){if(hash)iframe.src=hash}else{dataToString(hash,function(content){var doc=iframe.contentWindow.document;doc.open();doc.write(content);doc.close()})}});var link=document.getElementById("edit");link.href="/edit"+location.hash;link.style.display=editable?"block":"none"}}; +var HEAD_TAGS="PGJhc2UgdGFyZ2V0PSJfdG9wIj4K";var HEAD_TAGS_EXTENDED="PG1ldGEgY2hhcnNldD0idXRmLTgiPjxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgiPjxiYXNlIHRhcmdldD0iX3RvcCI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj5ib2R5e21hcmdpbjowIGF1dG87cGFkZGluZzoxMnZtaW4gMTB2bWluO21heC13aWR0aDozNWVtO2xpbmUtaGVpZ2h0OjEuNWVtO2ZvbnQtZmFtaWx5OiAtYXBwbGUtc3lzdGVtLEJsaW5rTWFjU3lzdGVtRm9udCxzYW5zLXNlcmlmO3dvcmQtd3JhcDogYnJlYWstd29yZDt9PC9zdHlsZT4g";function dismiss(){if(document.getElementById("never").checked)window.localStorage.setItem("toasted",true);document.body.classList.remove("toasting")}window.onhashchange=window.onload=function(){var hash=window.location.hash.substring(1);if(hash.length<3){location.href="/edit"}else{if(!window.localStorage.getItem("toasted"))document.body.classList.add("toasting");var iframe=document.getElementById("iframe");var link=document.getElementById("edit");var preamble=undefined;var slashIndex=hash.indexOf("/");var title=hash.substring(0,slashIndex);document.title=title.length?decodeURIComponent(title.replace(/_/g," ")):location.hostname;hash=hash.substring(slashIndex+1);var editable=hash.charAt(0)=="?";if(editable){hash=hash.substring(1)}if(hash.indexOf("data:")!=0){var compressed=true;preamble=HEAD_TAGS_EXTENDED;hash="data:text/html;charset=utf-8;"+(compressed?"bxze64,":"base64,")+hash}else if(hash.indexOf("data:text/html;")==0){preamble=HEAD_TAGS}link.onclick=function(){location.href="/edit"+location.hash};var isIE=navigator.userAgent.match(/rv:11/);var isEdge=navigator.userAgent.match(/Edge\//);if((isEdge||isIE)&&location.href.length==2083){document.getElementById("warning").innerHTML='Edge only supports shorter URLs (maximum 2083 bytes).
Larger sites may require a different browser.
Learn more'}decompressDataURI(hash,preamble,function(hash){if(!hash)return;iframe.sandbox="allow-scripts allow-forms allow-top-navigation allow-popups allow-modals";if(!isIE){if(hash)iframe.src=hash}else{dataToString(hash,function(content){var doc=iframe.contentWindow.document;doc.open();doc.write(content);doc.close()})}});var link=document.getElementById("edit");link.href="/edit"+location.hash;link.style.display=editable?"block":"none"}}; diff --git a/src/min.sh b/src/min.sh new file mode 100755 index 0000000..bc678df --- /dev/null +++ b/src/min.sh @@ -0,0 +1,4 @@ +#! /bin/bash +terser index.js > index.min.js +terser data.js > data.min.js +postcss index.css > index.min.css \ No newline at end of file