Browse Source

build

pull/7/head
coomdev 2 years ago
parent
commit
8a988f595d
  1. 20
      main.user.js

20
main.user.js

@ -12627,19 +12627,29 @@
cont = document.createElement("img"); cont = document.createElement("img");
} else if (type?.mime.startsWith("video")) { } else if (type?.mime.startsWith("video")) {
cont = document.createElement("video"); cont = document.createElement("video");
} else if (type?.mime.startsWith("audio")) {
cont = document.createElement("audio");
} else } else
return; return;
cont.src = URL.createObjectURL(new Blob([res.data])); cont.src = URL.createObjectURL(new Blob([res.data], { type: type.mime }));
await new Promise((res2) => { await new Promise((res2) => {
cont.onload = res2; if (cont instanceof HTMLImageElement)
cont.onload = res2;
else if (cont instanceof HTMLVideoElement)
cont.onloadedmetadata = res2;
else if (cont instanceof HTMLAudioElement)
cont.onloadedmetadata = res2;
}); });
if (cont instanceof HTMLImageElement) { if (cont instanceof HTMLImageElement) {
w = cont.naturalWidth; w = cont.naturalWidth;
h = cont.naturalHeight; h = cont.naturalHeight;
} }
if (cont instanceof HTMLVideoElement) { if (cont instanceof HTMLVideoElement) {
w = cont.width; w = cont.videoWidth;
h = cont.height; h = cont.videoHeight;
}
if (cont instanceof HTMLAudioElement || cont instanceof HTMLVideoElement) {
cont.controls = true;
} }
const contract = () => { const contract = () => {
}; };
@ -12716,7 +12726,7 @@
return; return;
const buff = await proc[2](file, input.files[0]); const buff = await proc[2](file, input.files[0]);
document.dispatchEvent(new CustomEvent("QRSetFile", { document.dispatchEvent(new CustomEvent("QRSetFile", {
detail: { file: new Blob([buff]), name: input.files[0].name } detail: { file: new Blob([buff]), name: file.name }
})); }));
} }
}; };

Loading…
Cancel
Save