copy image to clipboard #715

This commit is contained in:
cutls
2022-10-10 15:08:57 +09:00
parent dff544c3d2
commit 49c78d2263
10 changed files with 51 additions and 20 deletions

View File

@@ -78,7 +78,7 @@ function imgCont(type) {
function imageXhr(id, key, murl) {
let time = 0
var startTime = new Date()
const timer = setInterval(function() {
const timer = setInterval(function () {
time = time + 1
$('#imgsec').text(time)
}, 10)
@@ -343,3 +343,13 @@ function copyImgUrl() {
execCopy(murl)
M.toast({ html: lang.lang_img_copyDone, displayLength: 1500 })
}
async function copyImgBinary() {
var murl = $('#imagemodal').attr('data-original')
const blob = await (await fetch(murl)).blob()
const reader = new FileReader()
reader.onloadend = function () {
postMessage(['copyBinary', reader.result], '*')
M.toast({ html: lang.lang_imgBin_copyDone, displayLength: 1500 })
}
reader.readAsDataURL(blob)
}