Fix export comment images (#1176)

This commit is contained in:
the1812 2020-11-12 20:40:46 +08:00
parent 46ae6496e0
commit 56e16b05de
2 changed files with 2 additions and 2 deletions

View File

@ -1 +1 @@
(()=>(a,e)=>{(async()=>{const{forEachFeedsCard:a,addMenuItem:t}=await e.importAsync("feeds-apis");const n=a=>{t(a,{className:"image-export",text:"导出图片",action:async()=>{const t=[];dqa(a.element,"img, .img-content").forEach((a=>{const e=retrieveImageUrl(a);if(e){t.push(e)}}));if(t.length===0){Toast.info("此条动态没有检测到任何图片.","动态图片导出");return}const{DownloadPackage:n}=await e.importAsync("download-package");const o=await Promise.all(t.map((({url:a})=>Ajax.getBlob(a))));const s=new n;o.forEach(((e,n)=>s.add(`${a.username}-${a.id}-${n}${t[n].extension}`,e)));await s.emit(`${a.username}-${a.id}.zip`)}})};a({added:n})})()})();
(()=>(a,e)=>{(async()=>{const{forEachFeedsCard:a,addMenuItem:n}=await e.importAsync("feeds-apis");const t=a=>{n(a,{className:"image-export",text:"导出图片",action:async()=>{const n=[];dqa(a.element,".main-content img, .main-content .img-content").forEach((a=>{const e=retrieveImageUrl(a);if(e){n.push(e)}}));if(n.length===0){Toast.info("此条动态没有检测到任何图片.","动态图片导出");return}const{DownloadPackage:t}=await e.importAsync("download-package");const o=await Promise.all(n.map((({url:a})=>Ajax.getBlob(a))));const i=new t;o.forEach(((e,t)=>i.add(`${a.username}-${a.id}-${t}${n[t].extension}`,e)));await i.emit(`${a.username}-${a.id}.zip`)}})};a({added:t})})()})();

View File

@ -8,7 +8,7 @@ import { FeedsCard } from './feeds-apis'
text: '导出图片',
action: async () => {
const imageUrls: { url: string; extension: string }[] = []
dqa(card.element, 'img, .img-content').forEach((img: HTMLImageElement | HTMLDivElement) => {
dqa(card.element, '.main-content img, .main-content .img-content').forEach((img: HTMLImageElement | HTMLDivElement) => {
const urlData = retrieveImageUrl(img)
if (urlData) {
imageUrls.push(urlData)