mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
2 lines
1.4 KiB
JavaScript
Vendored
2 lines
1.4 KiB
JavaScript
Vendored
const o=["jpg","jpeg","webp","png","gif","bmp"];function u(e){if(!e)return"";if(typeof e=="string")return e.toLowerCase();const r=e.ext||"";return r?`${r}`.toLowerCase():e.name&&e.name.includes(".")?e.name.split(".").pop().toLowerCase():""}function l(e){return o.includes(u(e))}function p(e,r,n){if(!e||!n||!Array.isArray(r)||!n.image_url||!l(n))return!1;const a=r.filter(i=>i&&i.type==="file"&&l(i)&&i.image_url),t=a.findIndex(i=>i.id===n.id);if(t===-1)return!1;const s=a.map(i=>i.image_width&&i.image_height?{src:i.image_url,width:i.image_width,height:i.image_height}:i.image_url);return e.$store.dispatch("previewImage",{index:t,list:s}),!0}function c(e,r,n={}){if(!e||!r)return;const a=n.path||`/single/file/${r.id}`,t=n.title||r.name||e.$L("\u67E5\u770B"),s=n.size!==void 0?n.size:r.size,i=s?`${t} (${$A.bytesToSize(s)})`:t,f=n.windowName||`file-${r.id}`,d=Object.assign({title:i,titleFixed:!0,parent:null,width:Math.min(window.screen.availWidth,1440),height:Math.min(window.screen.availHeight,900)},n.windowConfig||{});if(e.$Electron){e.$store.dispatch("openChildWindow",{name:f,path:a,userAgent:"/hideenOfficeTitle/",force:n.force===void 0?!1:n.force,config:d});return}if(e.$isEEUIApp){e.$store.dispatch("openAppChildPage",{pageType:"app",pageTitle:i,url:"web.js",params:Object.assign({titleFixed:!0,url:$A.urlReplaceHash(a)},n.appParams||{})});return}window.open($A.mainUrl(a.substring(1)))}export{l as i,c as o,p};
|