mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
1 line
1.1 KiB
JavaScript
1 line
1.1 KiB
JavaScript
(()=>{return(t,n)=>{return{widget:{condition:()=>document.URL.startsWith("https://www.bilibili.com/read/cv"),content:`\n<button class="gui-settings-flat-button column-image-export">\n<i class="mdi mdi-24px mdi-export"></i>\n<span>导出图片</span>\n</button>`,success:()=>{const t=dq(".column-image-export");const e=dq(t,"span");t.addEventListener("click",async()=>{try{t.disabled=true;e.textContent="下载中...";const o=[];const a=document.title.replace(/ - 哔哩哔哩$/,"");const i=dq(".banner-img-holder");const s=retrieveImageUrl(i);if(s){o.push({...s,name:`${a}-banner${s.extension}`})}const c=dqa('.article-holder img:not([class*="cut-off-"])');c.forEach(t=>{const n=retrieveImageUrl(t);if(n){o.push({...n,name:`${a}-${o.length-1}${n.extension}`})}});if(o.length===0){Toast.info("此专栏没有检测到任何图片.","专栏图片导出");return}const{DownloadVideoPackage:r}=await n.importAsync("download-video-package");const l=await Promise.all(o.map(({url:t})=>Ajax.getBlob(t)));const d=new r;l.forEach((t,n)=>d.add(o[n].name,t));await d.emit(`${a}.zip`)}catch(t){logError(t)}finally{e.textContent="导出图片";t.disabled=false}})}}}}})(); |