mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
Update head tags
This commit is contained in:
parent
226eca3185
commit
e2303a3656
4 changed files with 10 additions and 8 deletions
|
|
@ -217,7 +217,7 @@ function handleInput(e) {
|
|||
const t1 = performance.now();
|
||||
bitty.compressString(text, bitty.LZMA64_MARKER, function(zip2) {
|
||||
const t2 = performance.now();
|
||||
console.log("\ngz", Math.round(zip.length/text.length*100), Math.round((t1-t0)),"ms", "\nlz", Math.round(zip2.length/text.length*100), Math.round((t2-t1)), "ms");
|
||||
console.debug("\ngz", Math.round(zip.length/text.length*100), Math.round((t1-t0)),"ms", "\nlz", Math.round(zip2.length/text.length*100), Math.round((t2-t1)), "ms");
|
||||
});
|
||||
if (rawHTML) {
|
||||
updateLink(DATA_PREFIX_BXZE + zip, title);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<script src="/js/lzma/lzma_worker-min.js"></script>
|
||||
<script src="/js/crypto-js/aes.js"></script>
|
||||
<script src="/index.js" type="module"></script>
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WHNPBD4T42"></script>
|
||||
<script nomodule> // Use V1 renderer </script>
|
||||
<noscript>itty.bitty requires JavaScript.</noscript>
|
||||
<iframe id="iframe" sandbox="allow-downloads allow-scripts allow-forms allow-top-navigation allow-popups allow-modals allow-popups-to-escape-sandbox"></iframe>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import * as bitty from './bitty.js';
|
||||
|
||||
const HEAD_TAGS = btoa('<base target="_top">\n');
|
||||
const HEAD_TAGS_EXTENDED = //"PG1ldGEgY2hhcnNldD0idXRmLTgiPjxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgiPjxiYXNlIHRhcmdldD0iX3RvcCI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj5ib2R5e21hcmdpbjowIGF1dG87cGFkZGluZzoxMnZtaW4gMTB2bWluO21heC13aWR0aDozNWVtO2xpbmUtaGVpZ2h0OjEuNWVtO2ZvbnQtZmFtaWx5OiAtYXBwbGUtc3lzdGVtLEJsaW5rTWFjU3lzdGVtRm9udCxzYW5zLXNlcmlmO3dvcmQtd3JhcDogYnJlYWstd29yZDt9PC9zdHlsZT4g";
|
||||
btoa(`<meta charset="utf-8"><meta name="viewport" content="width=device-width"><base target="_top"><style type="text/css">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;}}</style> `);
|
||||
|
||||
const HEAD_TAGS = () => btoa('<base target="_top">\n');
|
||||
const HEAD_TAGS_EXTENDED = () => btoa(`<meta charset="utf-8"><meta name="viewport" content="width=device-width"><base target="_top"><style type="text/css">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;}}</style> `);
|
||||
window.dataLayer = window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-WHNPBD4T42');
|
||||
|
||||
|
||||
// if ('serviceWorker' in navigator) {
|
||||
|
|
@ -121,9 +120,9 @@
|
|||
type = "data:" + info.mediaType;
|
||||
|
||||
if (info.mediatype == "text/html") {
|
||||
dataPrefix = HEAD_TAGS;
|
||||
dataPrefix = HEAD_TAGS();
|
||||
} else if (info.mediatype == "text/plain") {
|
||||
dataPrefix = HEAD_TAGS_EXTENDED;
|
||||
dataPrefix = HEAD_TAGS_EXTENDED();
|
||||
renderMode = "data";
|
||||
} else if (info.type == "text") {
|
||||
} else if (info.type == "image") {
|
||||
|
|
@ -162,7 +161,7 @@
|
|||
}
|
||||
|
||||
var compressed = true;
|
||||
dataPrefix = HEAD_TAGS_EXTENDED;
|
||||
dataPrefix = HEAD_TAGS_EXTENDED();
|
||||
let encoding = !compressed ? "base64," : (fragment.startsWith("XQA") ? bitty.LZMA64_MARKER : bitty.GZIP64_MARKER);
|
||||
fragment = "data:text/html;charset=utf-8;" + encoding + "," + fragment;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
<!DOCTYPE html><html x-manifest="manifest.appcache"><meta name="viewport" content="width=device-width, viewport-fit=cover"><meta name="description" content="itty bitty things can be conveyed in a link.">
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WHNPBD4T42"></script>
|
||||
<script type="text/javascript">
|
||||
@include ../js/lzma/lzma-d-min.js
|
||||
|
||||
@include data-min.js
|
||||
@include index-min.js
|
||||
window.dataLayer = window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-WHNPBD4T42');
|
||||
</script>
|
||||
<style type="text/css">
|
||||
@include index-min.css
|
||||
|
|
|
|||
Loading…
Reference in a new issue