mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
38 lines
1.1 KiB
HTML
38 lines
1.1 KiB
HTML
<link rel="stylesheet" href="/render/recipe.css" inline>
|
||
<script src="/render/recipe.js" inline></script>
|
||
<script src="/js/nosleep.js" inline></script>
|
||
<script>
|
||
function loadScript(src, callback, type = "module") {
|
||
let promise = new Promise((resolve, reject) => {
|
||
let script = document.createElement("script")
|
||
script.type = type;
|
||
script.onload = resolve;
|
||
script.src = src
|
||
document.head.appendChild(script);
|
||
})
|
||
return callback ? promise.then(callback) : promise;
|
||
}
|
||
|
||
window.addEventListener("message", function(e) {
|
||
let data = e.data;
|
||
window.script = data.script
|
||
window.params = data;
|
||
window.params.origin = e.origin;
|
||
console.log("🖊 Rendering with", {script:data.script, params:data})
|
||
|
||
render()
|
||
|
||
loadScript("../js/qrious.min.js", null, "").then(() => {
|
||
var qr = new QRious({
|
||
element: document.getElementById("qr"),
|
||
background: 'transparent',
|
||
foreground: 'currentColor',
|
||
size: 512,
|
||
value: params.originalURL.substring(0),
|
||
});
|
||
|
||
})
|
||
}, false);
|
||
</script>
|
||
|
||
|