bitview: reorg part 9

This commit is contained in:
nym21
2025-10-01 23:17:48 +02:00
parent 62d4b35c93
commit c4ce718bb2
102 changed files with 1654 additions and 1798 deletions

View File

@@ -0,0 +1,38 @@
import { ios } from "../../core/env";
import { domToBlob } from "../../modules/modern-screenshot/4.6.6/dist/index.mjs";
/**
* @param {Object} args
* @param {Element} args.element
* @param {string} args.name
* @param {string} args.title
*/
export async function screenshot({ element, name, title }) {
const blob = await domToBlob(element, {
scale: 2,
});
if (ios) {
const file = new File(
[blob],
`bitview-${name}-${new Date().toJSON().split(".")[0]}.png`,
{
type: "image/png",
},
);
try {
await navigator.share({
files: [file],
title: `${title} on ${window.document.location.hostname}`,
});
return;
} catch (err) {
console.log(err);
}
}
const url = URL.createObjectURL(blob);
window.open(url, "_blank");
setTimeout(() => URL.revokeObjectURL(url), 100);
}