@yuuichi/openlist-assets 4.2.6-ym.2 → 4.2.6-ym.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/previews-CoVCUlRx.js +1 -1
- package/dist/assets/previews-legacy-DOedQYss.js +1 -1
- package/dist/brand/global-search.js +120 -0
- package/dist/brand/music-player.js +20 -3
- package/dist/brand/upload-add.js +164 -100
- package/dist/brand/ym-bundle.js +308 -104
- package/dist/esa-entry.js +68 -68
- package/package.json +1 -1
|
@@ -35,4 +35,4 @@ import{$ as e,E as t,Zt as n,aa as r,fn as i,ha as a,la as o,m as s,ni as c,o as
|
|
|
35
35
|
fill="#231612"
|
|
36
36
|
d="M11.238 5.279h-.013L10.9 7.352h.652ZM9.5 9.3l1.06-4.86h1.355l1.033 4.86H11.81l-.15-1.133h-.882L10.634 9.3H9.5m3.938 0V4.44h1.086V9.3h-1.086"
|
|
37
37
|
></path>F`},e)}function G(e){return v({a:{viewBox:`0 0 48 48`},c:`<path d="M0 0h48v48H0z" fill="none"/>
|
|
38
|
-
<path fill="#ffffff" d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"/>`},e)}var K={"dmg,ipa,plist,tipa":N,"exe,msi":O,apk:B,db:y,md:E,epub:x,iso:b,m3u8:R,"doc,docx":w,"xls,xlsx":M,"ppt,pptx":D,pdf:A,psd:U,ai:W,url:S,cast:V},q=(e,t)=>{if(e!==H.FOLDER){for(let[e,n]of Object.entries(K))if(e.split(`,`).includes(i(t).toLowerCase()))return n;if(P(t))return L}switch(e){case H.FOLDER:return T;case H.VIDEO:return R;case H.AUDIO:return z;case H.TEXT:return j;case H.IMAGE:return k;default:return I}},J=e=>q(e.type,e.name),Y=e=>{let{currentObjLink:i}=u(),a=o(()=>n(e.scheme,{raw_url:t.raw_url,name:t.obj.name,d_url:i(!0),ts:!0}));return r(F,{w:`$full`,h:`70vh`,get extraButtons(){return r(c,{label:`Open in new tab`,withArrow:!0,get children(){return r(f,{"aria-label":`Open in new tab`,get icon(){return r(C,{})},onClick:()=>{window.open(a(),`_blank`)},colorScheme:`neutral`,size:`sm`})}})},get children(){return r(h.iframe,{w:`$full`,h:`$full`,get src(){return a()}})}})},X=e=>()=>r(Y,{scheme:e}),Z=(e,t)=>e===void 0?!1:e===`*`?!0:typeof e==`function`?e(t):e.includes(i(t).toLowerCase()),Q=e=>typeof e==`boolean`?e:e(),$=[{key:`html`,exts:[`html`],component:a(()=>_(()=>import(`./html-wOPWOBnT.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),prior:!0},{key:`aliyun_video`,type:H.VIDEO,provider:/^
|
|
38
|
+
<path fill="#ffffff" d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"/>`},e)}var K={"dmg,ipa,plist,tipa":N,"exe,msi":O,apk:B,db:y,md:E,epub:x,iso:b,m3u8:R,"doc,docx":w,"xls,xlsx":M,"ppt,pptx":D,pdf:A,psd:U,ai:W,url:S,cast:V},q=(e,t)=>{if(e!==H.FOLDER){for(let[e,n]of Object.entries(K))if(e.split(`,`).includes(i(t).toLowerCase()))return n;if(P(t))return L}switch(e){case H.FOLDER:return T;case H.VIDEO:return R;case H.AUDIO:return z;case H.TEXT:return j;case H.IMAGE:return k;default:return I}},J=e=>q(e.type,e.name),Y=e=>{let{currentObjLink:i}=u(),a=o(()=>n(e.scheme,{raw_url:t.raw_url,name:t.obj.name,d_url:i(!0),ts:!0}));return r(F,{w:`$full`,h:`70vh`,get extraButtons(){return r(c,{label:`Open in new tab`,withArrow:!0,get children(){return r(f,{"aria-label":`Open in new tab`,get icon(){return r(C,{})},onClick:()=>{window.open(a(),`_blank`)},colorScheme:`neutral`,size:`sm`})}})},get children(){return r(h.iframe,{w:`$full`,h:`$full`,get src(){return a()}})}})},X=e=>()=>r(Y,{scheme:e}),Z=(e,t)=>e===void 0?!1:e===`*`?!0:typeof e==`function`?e(t):e.includes(i(t).toLowerCase()),Q=e=>typeof e==`boolean`?e:e(),$=[{key:`html`,exts:[`html`],component:a(()=>_(()=>import(`./html-wOPWOBnT.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),prior:!0},{key:`aliyun_video`,type:H.VIDEO,provider:/^__disabled_aliyun_video__$/,component:a(()=>_(()=>import(`./aliyun_video-DhUqtFwT.js`),__vite__mapDeps([10,1,2,3,4,5,6,11,8,12,7,9,13,14]))),prior:!0},{key:`markdown`,type:H.TEXT,component:a(()=>_(()=>import(`./markdown-CQvfiJ80.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9]))),prior:!0},{key:`flash`,exts:[`swf`],component:a(()=>_(()=>import(`./flash-BI-MiqMm.js`),__vite__mapDeps([16,1,2,3,4,5,6,7,8,9]))),prior:!0},{key:`markdown_with_word_wrap`,type:H.TEXT,component:a(()=>_(()=>import(`./markdown_with_word_wrap-C1buWvD_.js`),__vite__mapDeps([17,1,2,3,4,5,6,7,8,9]))),prior:!0},{key:`url_open`,exts:[`url`],component:a(()=>_(()=>import(`./url-DLWqDjv0.js`),__vite__mapDeps([18,2,1,3,4,5,6,7,8,9,19]))),prior:!0},{key:`text_editor`,type:H.TEXT,exts:[`url`],component:a(()=>_(()=>import(`./text-editor-Bxo06t7P.js`),__vite__mapDeps([20,1,2,3,4,5,6,11,8,7,9,21]))),prior:!0,availableInArchive:!1},{key:`image`,type:H.IMAGE,exts:[`heic`,`heif`,`avif`,`vvc`,`avc`],component:a(()=>_(()=>import(`./image-Db7g9giI.js`),__vite__mapDeps([22,1,2,3,4,5,6,23,11,8,7,9]))),prior:!0},{key:`video`,type:H.VIDEO,component:a(()=>_(()=>import(`./video-CoNJHXkq.js`),__vite__mapDeps([24,2,1,3,4,5,6,12,7,8,9,13,14]))),prior:!0},{key:`audio`,type:H.AUDIO,component:a(()=>_(()=>import(`./audio-DRUucn3C.js`),__vite__mapDeps([25,2,1,3,4,5,6,26]))),prior:!0},{key:`ipa`,exts:[`ipa`,`tipa`],component:a(()=>_(()=>import(`./ipa-Bshhl83e.js`),__vite__mapDeps([27,1,2,3,4,5,6,19]))),prior:!0},{key:`plist`,exts:[`plist`],component:a(()=>_(()=>import(`./plist-DIMZiha9.js`),__vite__mapDeps([28,1,2,3,4,5,6,19]))),prior:!0},{key:`pdf`,exts:[`pdf`],component:a(()=>_(()=>import(`./pdf-Bq_tQdRs.js`).then(e=>e.t),__vite__mapDeps([29,2,1,3,4,5,6,7,8,9,30]))),prior:!0},{key:`ppt`,exts:[`pptx`],component:a(()=>_(()=>import(`./ppt-FvL4yH5U.js`),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,32]))),prior:!0},{key:`xls`,exts:[`xlsx`],component:a(()=>_(()=>import(`./xls-DYLBHUV2.js`),__vite__mapDeps([33,1,2,3,4,5,6,7,8,9]))),prior:!0},{key:`doc`,exts:[`docx`],component:a(()=>_(()=>import(`./doc-Bxq9eHCG.js`),__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,32]))),prior:!0},{key:`asciinema`,exts:[`cast`],component:a(()=>_(()=>import(`./asciinema-2pKCRuB5.js`),__vite__mapDeps([35,1,2,3,4,5,6,36]))),prior:!0},{key:`video360`,type:H.VIDEO,component:a(()=>_(()=>import(`./video360-Dz06Y6zH.js`),__vite__mapDeps([37,1,2,3,4,5,6,12,7,8,9,38]))),prior:!0},{key:`torrent`,exts:[`torrent`],component:a(()=>_(()=>import(`./torrent-D-mNBpZE.js`),__vite__mapDeps([39,2,1,3,4,5,6,30,40,11,8,7,9,41,42]))),prior:!0},{key:`archive`,exts:e=>{let t=m.findIndex(e=>e===`read_archives`),{isShare:n}=p();return!n()&&!l.can(d(),t)||n()&&!s(`share_archive_preview`)?!1:P(e)},component:a(()=>_(()=>import(`./archive-BcA0ogpj.js`),__vite__mapDeps([43,2,1,3,4,5,6,7,8,9,44,45,11,46,47,48,49,50]))),prior:()=>{let{isShare:e}=p();return!e()&&s(`preview_archives_by_default`)&&!s(`preview_download_by_default`)||e()&&s(`share_preview_archives_by_default`)&&!s(`share_preview_download_by_default`)},availableInArchive:!1}],ee=t=>{let{searchParams:n,isShare:r}=p(),i=e(),o=H[n.type?.toUpperCase()],c=[],l=[],u=!r()&&s(`preview_download_by_default`)||r()&&s(`share_preview_download_by_default`),d=!!t.archive;(!r()||s(`share_preview`))&&$.forEach(e=>{if((!e.provider||e.provider.test(t.provider))&&(e.type===t.type||o&&e.type===o||Z(e.exts,t.name))){let t={key:e.key,name:i(`home.preview.names.${e.key}`),component:e.component};if(d&&e.availableInArchive===!1)return;!u&&Q(e.prior)?c.push(t):l.push(t)}});let f=g(t.name).map(e=>({key:`iframe-${e.key}`,name:e.key,component:X(e.value)}));u?l.push(...f):c.push(...f);let m={key:`download`,name:i(`home.preview.names.download`),component:a(()=>_(()=>import(`./download-Bcb2qG2t.js`),__vite__mapDeps([51,2,1,3,4,5,6,7,8,9,19,45,11])))},h=t.type===H.TEXT&&t.size>=1048576,v=c.length===0&&l.length===0,y=t.size<1048576;if(h)c.unshift(m);else if(v&&y){if(c.push(m),!r()||s(`share_preview`)){let e=$.filter(e=>[`markdown`,`markdown_with_word_wrap`,`text_editor`].includes(e.key)).map(e=>({key:e.key,name:i(`home.preview.names.${e.key}`),component:e.component}));c.push(...e)}}else c.push(m);return c.concat(l)};export{H as i,J as n,G as r,ee as t};
|
|
@@ -34,4 +34,4 @@
|
|
|
34
34
|
fill="#231612"
|
|
35
35
|
d="M11.238 5.279h-.013L10.9 7.352h.652ZM9.5 9.3l1.06-4.86h1.355l1.033 4.86H11.81l-.15-1.133h-.882L10.634 9.3H9.5m3.938 0V4.44h1.086V9.3h-1.086"
|
|
36
36
|
></path>F`},e)}function ee(e){return b({a:{viewBox:`0 0 48 48`},c:`<path d="M0 0h48v48H0z" fill="none"/>
|
|
37
|
-
<path fill="#ffffff" d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"/>`},e)}return e(`r`,ee),{setters:[function(e){n=e.$,r=e.E,i=e.Zt,a=e.aa,o=e.fn,s=e.ha,c=e.la,l=e.m,u=e.ni,d=e.o,f=e.q,p=e.r,m=e.rr,h=e.rt,g=e.s,_=e.si,v=e.u},function(e){y=e.t},function(e){b=e.t},function(e){x=e._,S=e.g,C=e.h,w=e.v},function(e){T=e.At,E=e.C,D=e.Jt,O=e.M,k=e.S,A=e.V,j=e._,M=e.b,N=e.g,P=e.h,F=e.o,I=e.on,L=e.r,R=e.v,z=e.w,B=e.x,V=e.y},function(e){H=e.t},function(e){U=e.t}],execute:function(){e(`i`,W=function(e){return e[e.UNKNOWN=0]=`UNKNOWN`,e[e.FOLDER=1]=`FOLDER`,e[e.VIDEO=2]=`VIDEO`,e[e.AUDIO=3]=`AUDIO`,e[e.TEXT=4]=`TEXT`,e[e.IMAGE=5]=`IMAGE`,e}({})),G={"dmg,ipa,plist,tipa":F,"exe,msi":A,apk:H,db:x,md:O,epub:C,iso:S,m3u8:B,"doc,docx":E,"xls,xlsx":P,"ppt,pptx":k,pdf:M,psd:Q,ai:$,url:w,cast:U},K=(e,t)=>{if(e!==W.FOLDER){for(let[e,n]of Object.entries(G))if(e.split(`,`).includes(o(t).toLowerCase()))return n;if(I(t))return z}switch(e){case W.FOLDER:return D;case W.VIDEO:return B;case W.AUDIO:return V;case W.TEXT:return N;case W.IMAGE:return j;default:return R}},e(`n`,e=>K(e.type,e.name)),q=e=>{let{currentObjLink:t}=f(),n=c(()=>i(e.scheme,{raw_url:r.raw_url,name:r.obj.name,d_url:t(!0),ts:!0}));return a(L,{w:`$full`,h:`70vh`,get extraButtons(){return a(u,{label:`Open in new tab`,withArrow:!0,get children(){return a(m,{"aria-label":`Open in new tab`,get icon(){return a(T,{})},onClick:()=>{window.open(n(),`_blank`)},colorScheme:`neutral`,size:`sm`})}})},get children(){return a(_.iframe,{w:`$full`,h:`$full`,get src(){return n()}})}})},J=e=>()=>a(q,{scheme:e}),Y=(e,t)=>e===void 0?!1:e===`*`?!0:typeof e==`function`?e(t):e.includes(o(t).toLowerCase()),X=e=>typeof e==`boolean`?e:e(),Z=[{key:`html`,exts:[`html`],component:s(()=>y(()=>t.import(`./html-legacy-BVjVsMtr.js`),void 0)),prior:!0},{key:`aliyun_video`,type:W.VIDEO,provider:/^
|
|
37
|
+
<path fill="#ffffff" d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"/>`},e)}return e(`r`,ee),{setters:[function(e){n=e.$,r=e.E,i=e.Zt,a=e.aa,o=e.fn,s=e.ha,c=e.la,l=e.m,u=e.ni,d=e.o,f=e.q,p=e.r,m=e.rr,h=e.rt,g=e.s,_=e.si,v=e.u},function(e){y=e.t},function(e){b=e.t},function(e){x=e._,S=e.g,C=e.h,w=e.v},function(e){T=e.At,E=e.C,D=e.Jt,O=e.M,k=e.S,A=e.V,j=e._,M=e.b,N=e.g,P=e.h,F=e.o,I=e.on,L=e.r,R=e.v,z=e.w,B=e.x,V=e.y},function(e){H=e.t},function(e){U=e.t}],execute:function(){e(`i`,W=function(e){return e[e.UNKNOWN=0]=`UNKNOWN`,e[e.FOLDER=1]=`FOLDER`,e[e.VIDEO=2]=`VIDEO`,e[e.AUDIO=3]=`AUDIO`,e[e.TEXT=4]=`TEXT`,e[e.IMAGE=5]=`IMAGE`,e}({})),G={"dmg,ipa,plist,tipa":F,"exe,msi":A,apk:H,db:x,md:O,epub:C,iso:S,m3u8:B,"doc,docx":E,"xls,xlsx":P,"ppt,pptx":k,pdf:M,psd:Q,ai:$,url:w,cast:U},K=(e,t)=>{if(e!==W.FOLDER){for(let[e,n]of Object.entries(G))if(e.split(`,`).includes(o(t).toLowerCase()))return n;if(I(t))return z}switch(e){case W.FOLDER:return D;case W.VIDEO:return B;case W.AUDIO:return V;case W.TEXT:return N;case W.IMAGE:return j;default:return R}},e(`n`,e=>K(e.type,e.name)),q=e=>{let{currentObjLink:t}=f(),n=c(()=>i(e.scheme,{raw_url:r.raw_url,name:r.obj.name,d_url:t(!0),ts:!0}));return a(L,{w:`$full`,h:`70vh`,get extraButtons(){return a(u,{label:`Open in new tab`,withArrow:!0,get children(){return a(m,{"aria-label":`Open in new tab`,get icon(){return a(T,{})},onClick:()=>{window.open(n(),`_blank`)},colorScheme:`neutral`,size:`sm`})}})},get children(){return a(_.iframe,{w:`$full`,h:`$full`,get src(){return n()}})}})},J=e=>()=>a(q,{scheme:e}),Y=(e,t)=>e===void 0?!1:e===`*`?!0:typeof e==`function`?e(t):e.includes(o(t).toLowerCase()),X=e=>typeof e==`boolean`?e:e(),Z=[{key:`html`,exts:[`html`],component:s(()=>y(()=>t.import(`./html-legacy-BVjVsMtr.js`),void 0)),prior:!0},{key:`aliyun_video`,type:W.VIDEO,provider:/^__disabled_aliyun_video__$/,component:s(()=>y(()=>t.import(`./aliyun_video-legacy-Df932_Jo.js`),void 0)),prior:!0},{key:`markdown`,type:W.TEXT,component:s(()=>y(()=>t.import(`./markdown-legacy-lM5VUmwJ.js`),void 0)),prior:!0},{key:`flash`,exts:[`swf`],component:s(()=>y(()=>t.import(`./flash-legacy-CtcDowCm.js`),void 0)),prior:!0},{key:`markdown_with_word_wrap`,type:W.TEXT,component:s(()=>y(()=>t.import(`./markdown_with_word_wrap-legacy-D-Xw8Zt2.js`),void 0)),prior:!0},{key:`url_open`,exts:[`url`],component:s(()=>y(()=>t.import(`./url-legacy-Clh3xJ9P.js`),void 0)),prior:!0},{key:`text_editor`,type:W.TEXT,exts:[`url`],component:s(()=>y(()=>t.import(`./text-editor-legacy-CUvSBPAs.js`),void 0)),prior:!0,availableInArchive:!1},{key:`image`,type:W.IMAGE,exts:[`heic`,`heif`,`avif`,`vvc`,`avc`],component:s(()=>y(()=>t.import(`./image-legacy-BU_q6ZOc.js`),void 0)),prior:!0},{key:`video`,type:W.VIDEO,component:s(()=>y(()=>t.import(`./video-legacy-DhBh7O5X.js`),void 0)),prior:!0},{key:`audio`,type:W.AUDIO,component:s(()=>y(()=>t.import(`./audio-legacy-Cpyoh0SK.js`),void 0)),prior:!0},{key:`ipa`,exts:[`ipa`,`tipa`],component:s(()=>y(()=>t.import(`./ipa-legacy-BorHFFl8.js`),void 0)),prior:!0},{key:`plist`,exts:[`plist`],component:s(()=>y(()=>t.import(`./plist-legacy-Bn-mN8kt.js`),void 0)),prior:!0},{key:`pdf`,exts:[`pdf`],component:s(()=>y(()=>t.import(`./pdf-legacy-BIi7bNik.js`).then(e=>e.t),void 0)),prior:!0},{key:`ppt`,exts:[`pptx`],component:s(()=>y(()=>t.import(`./ppt-legacy-B_fzAUrt.js`),void 0)),prior:!0},{key:`xls`,exts:[`xlsx`],component:s(()=>y(()=>t.import(`./xls-legacy-CueRxwqK.js`),void 0)),prior:!0},{key:`doc`,exts:[`docx`],component:s(()=>y(()=>t.import(`./doc-legacy-CeO7buFM.js`),void 0)),prior:!0},{key:`asciinema`,exts:[`cast`],component:s(()=>y(()=>t.import(`./asciinema-legacy-BMx0b3qn.js`),void 0)),prior:!0},{key:`video360`,type:W.VIDEO,component:s(()=>y(()=>t.import(`./video360-legacy-CSb1rDFk.js`),void 0)),prior:!0},{key:`torrent`,exts:[`torrent`],component:s(()=>y(()=>t.import(`./torrent-legacy-yc73b_6h.js`),void 0)),prior:!0},{key:`archive`,exts:e=>{let t=g.findIndex(e=>e===`read_archives`),{isShare:n}=h();return!n()&&!d.can(p(),t)||n()&&!l(`share_archive_preview`)?!1:I(e)},component:s(()=>y(()=>t.import(`./archive-legacy-DHAsf3_V.js`),void 0)),prior:()=>{let{isShare:e}=h();return!e()&&l(`preview_archives_by_default`)&&!l(`preview_download_by_default`)||e()&&l(`share_preview_archives_by_default`)&&!l(`share_preview_download_by_default`)},availableInArchive:!1}],e(`t`,e=>{let{searchParams:r,isShare:i}=h(),a=n(),o=W[r.type?.toUpperCase()],c=[],u=[],d=!i()&&l(`preview_download_by_default`)||i()&&l(`share_preview_download_by_default`),f=!!e.archive;(!i()||l(`share_preview`))&&Z.forEach(t=>{if((!t.provider||t.provider.test(e.provider))&&(t.type===e.type||o&&t.type===o||Y(t.exts,e.name))){let e={key:t.key,name:a(`home.preview.names.${t.key}`),component:t.component};if(f&&t.availableInArchive===!1)return;!d&&X(t.prior)?c.push(e):u.push(e)}});let p=v(e.name).map(e=>({key:`iframe-${e.key}`,name:e.key,component:J(e.value)}));d?u.push(...p):c.push(...p);let m={key:`download`,name:a(`home.preview.names.download`),component:s(()=>y(()=>t.import(`./download-legacy-DFuxWVPA.js`),void 0))},g=e.type===W.TEXT&&e.size>=1048576,_=c.length===0&&u.length===0,b=e.size<1048576;if(g)c.unshift(m);else if(_&&b){if(c.push(m),!i()||l(`share_preview`)){let e=Z.filter(e=>[`markdown`,`markdown_with_word_wrap`,`text_editor`].includes(e.key)).map(e=>({key:e.key,name:a(`home.preview.names.${e.key}`),component:e.component}));c.push(...e)}}else c.push(m);return c.concat(u)})}}})})();
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// 官方前端搜索框固定把当前路径作为 parent,后端 /fs/search 本身已支持递归,
|
|
5
|
+
// 因此这里在弹窗内增加“全局 / 当前目录”开关,并在请求发出前改写 parent。
|
|
6
|
+
var KEY = "ym-global-search";
|
|
7
|
+
var globalByDefault = true;
|
|
8
|
+
|
|
9
|
+
function isGlobal() {
|
|
10
|
+
try {
|
|
11
|
+
return localStorage.getItem(KEY) !== "0";
|
|
12
|
+
} catch (e) {
|
|
13
|
+
return globalByDefault;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function setGlobal(v) {
|
|
18
|
+
try { localStorage.setItem(KEY, v ? "1" : "0"); } catch (e) {}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function rewriteBody(body) {
|
|
22
|
+
try {
|
|
23
|
+
if (typeof body !== "string" || body.indexOf("/fs/search") === -1) return body;
|
|
24
|
+
var data = JSON.parse(body);
|
|
25
|
+
if (isGlobal()) data.parent = "/";
|
|
26
|
+
return JSON.stringify(data);
|
|
27
|
+
} catch (e) {
|
|
28
|
+
return body;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function installFetchPatch() {
|
|
33
|
+
if (window.__ymSearchFetchPatched) return;
|
|
34
|
+
window.__ymSearchFetchPatched = true;
|
|
35
|
+
var ofetch = window.fetch;
|
|
36
|
+
window.fetch = function (input, init) {
|
|
37
|
+
try {
|
|
38
|
+
var url = typeof input === "string" ? input : input && input.url;
|
|
39
|
+
if (url && url.indexOf("/fs/search") !== -1 && init && typeof init.body === "string") {
|
|
40
|
+
init = Object.assign({}, init, { body: rewriteBody(init.body) });
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {}
|
|
43
|
+
return ofetch.apply(this, arguments);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function installXhrPatch() {
|
|
48
|
+
if (window.__ymSearchXhrPatched) return;
|
|
49
|
+
window.__ymSearchXhrPatched = true;
|
|
50
|
+
var open = XMLHttpRequest.prototype.open;
|
|
51
|
+
var send = XMLHttpRequest.prototype.send;
|
|
52
|
+
XMLHttpRequest.prototype.open = function (method, url) {
|
|
53
|
+
this.__ymSearchUrl = url || "";
|
|
54
|
+
return open.apply(this, arguments);
|
|
55
|
+
};
|
|
56
|
+
XMLHttpRequest.prototype.send = function (body) {
|
|
57
|
+
try {
|
|
58
|
+
if (this.__ymSearchUrl.indexOf("/fs/search") !== -1 && typeof body === "string") {
|
|
59
|
+
arguments[0] = rewriteBody(body);
|
|
60
|
+
}
|
|
61
|
+
} catch (e) {}
|
|
62
|
+
return send.apply(this, arguments);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function injectCss() {
|
|
67
|
+
if (document.getElementById("ym-search-toggle-css")) return;
|
|
68
|
+
var st = document.createElement("style");
|
|
69
|
+
st.id = "ym-search-toggle-css";
|
|
70
|
+
st.textContent = [
|
|
71
|
+
".ym-search-scope{display:inline-flex;align-items:center;gap:5px;margin-left:6px;padding:0 8px;",
|
|
72
|
+
"height:32px;border-radius:8px;border:1px solid var(--hope-colors-neutral7,#cbd5e1);",
|
|
73
|
+
"font-size:12px;white-space:nowrap;cursor:pointer;color:var(--hope-colors-neutral11,#475569);",
|
|
74
|
+
"background:var(--hope-colors-neutral2,#f8fafc);user-select:none;}",
|
|
75
|
+
".ym-search-scope input{margin:0;cursor:pointer;}",
|
|
76
|
+
].join("");
|
|
77
|
+
document.head.appendChild(st);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function findModal() {
|
|
81
|
+
var nodes = document.querySelectorAll('[role="dialog"]');
|
|
82
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
83
|
+
var n = nodes[i];
|
|
84
|
+
if (n.querySelector("#search-input") && n.getBoundingClientRect().width > 0) return n;
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function ensureToggle() {
|
|
90
|
+
var modal = findModal();
|
|
91
|
+
if (!modal || modal.querySelector(".ym-search-scope")) return;
|
|
92
|
+
var input = modal.querySelector("#search-input");
|
|
93
|
+
if (!input) return;
|
|
94
|
+
var holder = input.closest("div");
|
|
95
|
+
if (!holder || !holder.parentElement) return;
|
|
96
|
+
var row = holder.parentElement;
|
|
97
|
+
var label = document.createElement("label");
|
|
98
|
+
label.className = "ym-search-scope";
|
|
99
|
+
label.title = "全局:从根目录递归搜索全部存储;当前目录:仅搜索所在文件夹及其子目录";
|
|
100
|
+
var cb = document.createElement("input");
|
|
101
|
+
cb.type = "checkbox";
|
|
102
|
+
cb.checked = isGlobal();
|
|
103
|
+
cb.addEventListener("change", function () { setGlobal(cb.checked); });
|
|
104
|
+
label.appendChild(cb);
|
|
105
|
+
label.appendChild(document.createTextNode("全局"));
|
|
106
|
+
row.appendChild(label);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function boot() {
|
|
110
|
+
injectCss();
|
|
111
|
+
installFetchPatch();
|
|
112
|
+
installXhrPatch();
|
|
113
|
+
new MutationObserver(function () {
|
|
114
|
+
if (document.querySelector("#search-input")) ensureToggle();
|
|
115
|
+
}).observe(document.body, { childList: true, subtree: true });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", boot);
|
|
119
|
+
else boot();
|
|
120
|
+
})();
|
|
@@ -81,8 +81,9 @@
|
|
|
81
81
|
".fab { position:fixed; left:18px; bottom:18px; width:54px; height:54px; border-radius:50%;",
|
|
82
82
|
" border:none; cursor:pointer; color:#fff; display:flex; align-items:center; justify-content:center;",
|
|
83
83
|
" background:linear-gradient(135deg,#38bdf8,#0284c7); box-shadow:0 8px 24px rgba(2,132,199,.45);",
|
|
84
|
-
" transition:transform .
|
|
85
|
-
".
|
|
84
|
+
" transform:translateX(-58%); transition:transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease; padding:0; }",
|
|
85
|
+
".wrap:hover .fab, .fab:focus-visible, .fab.peek { transform:translateX(0); }",
|
|
86
|
+
".fab:hover { box-shadow:0 12px 30px rgba(2,132,199,.55); }",
|
|
86
87
|
".fab:active { transform:scale(.94); }",
|
|
87
88
|
".fab svg { width:26px; height:26px; }",
|
|
88
89
|
".panel { position:fixed; left:18px; bottom:84px; width:360px; height:560px; max-width:calc(100vw - 24px);",
|
|
@@ -461,10 +462,26 @@
|
|
|
461
462
|
}
|
|
462
463
|
function close() {
|
|
463
464
|
panel.classList.remove("open");
|
|
465
|
+
fab.classList.remove("peek");
|
|
464
466
|
state.ready.netease = false;
|
|
465
467
|
try { localStorage.setItem("ym-open", "0"); } catch (e) {}
|
|
466
468
|
}
|
|
467
|
-
fab.addEventListener("click", function () {
|
|
469
|
+
fab.addEventListener("click", function (ev) {
|
|
470
|
+
// 第一次点击在半露出吸附态时只负责全露出,不立刻打开面板;再次点击才打开。
|
|
471
|
+
if (!panel.classList.contains("open") && !fab.classList.contains("peek")) {
|
|
472
|
+
fab.classList.add("peek");
|
|
473
|
+
ev.stopPropagation();
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
fab.classList.remove("peek");
|
|
477
|
+
panel.classList.contains("open") ? close() : open();
|
|
478
|
+
});
|
|
479
|
+
// 触屏没有 hover:点 FAB 之外恢复半露出;面板打开时不收起,避免遮挡交互。
|
|
480
|
+
document.addEventListener("pointerdown", function (ev) {
|
|
481
|
+
if (panel.classList.contains("open")) return;
|
|
482
|
+
if (wrap.contains(ev.target)) return;
|
|
483
|
+
fab.classList.remove("peek");
|
|
484
|
+
}, true);
|
|
468
485
|
|
|
469
486
|
/* 记忆位置/尺寸/上次标签 */
|
|
470
487
|
try {
|
package/dist/brand/upload-add.js
CHANGED
|
@@ -1,53 +1,45 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// “-/s” 的阶段:取直传地址(presign) → 分片直传(第 x/N 片 + 实时速率 + 并发)
|
|
7
|
-
// → 云端合并(complete)。
|
|
8
|
-
//
|
|
9
|
-
// 文件的添加/拖放完全使用上传弹窗原生能力:闲置视图自带“拖放区 / 选择文件 /
|
|
10
|
-
// 选择文件夹”;上传过程中点“返回上传”即可继续添加(原上传不中断)。
|
|
11
|
-
// 本脚本不再注入任何额外的虚线框或全屏拖放层。
|
|
12
|
-
|
|
4
|
+
// 上传状态面板:状态只以真实事件为准,避免“文件已传完仍显示直传中”或
|
|
5
|
+
// “没有速度却显示传输中”。速率由各活跃分片的 1s 滑动窗口聚合计算。
|
|
13
6
|
var PANEL_ID = "ym-upload-panel";
|
|
14
7
|
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var merge = { on: false, at: 0 };
|
|
8
|
+
var uploads = Object.create(null);
|
|
9
|
+
var phase = { name: "idle", at: 0 };
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
function nowMs() { return Date.now(); }
|
|
12
|
+
|
|
13
|
+
function ensure(id) {
|
|
14
|
+
if (!uploads[id]) {
|
|
15
|
+
uploads[id] = {
|
|
16
|
+
total: 0,
|
|
17
|
+
doneCount: 0,
|
|
18
|
+
done: Object.create(null),
|
|
19
|
+
waiting: new Set(),
|
|
20
|
+
active: Object.create(null),
|
|
21
|
+
finished: false,
|
|
22
|
+
};
|
|
28
23
|
}
|
|
29
|
-
|
|
30
|
-
render();
|
|
24
|
+
return uploads[id];
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
render();
|
|
44
|
-
}, 90000);
|
|
45
|
-
render();
|
|
27
|
+
function activeUploadCount() { return Object.keys(uploads).length; }
|
|
28
|
+
function anyWaiting() {
|
|
29
|
+
return Object.keys(uploads).some(function (id) { return uploads[id].waiting.size > 0; });
|
|
30
|
+
}
|
|
31
|
+
function allPartsDone() {
|
|
32
|
+
var ids = Object.keys(uploads);
|
|
33
|
+
return ids.length > 0 && ids.every(function (id) {
|
|
34
|
+
var u = uploads[id];
|
|
35
|
+
return u.total > 0 && u.doneCount >= u.total;
|
|
36
|
+
});
|
|
46
37
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
|
|
39
|
+
function resetAll(reason) {
|
|
40
|
+
uploads = Object.create(null);
|
|
41
|
+
phase = reason ? { name: reason, at: nowMs() } : { name: "idle", at: 0 };
|
|
42
|
+
render();
|
|
51
43
|
}
|
|
52
44
|
|
|
53
45
|
var cssInjected = false;
|
|
@@ -62,17 +54,18 @@
|
|
|
62
54
|
" box-shadow:0 2px 10px rgba(2,132,199,.18);}",
|
|
63
55
|
"#" + PANEL_ID + ".ym-merge{color:#7c2d12;background:linear-gradient(135deg,#ffedd5,#fed7aa);border-color:#fdba74;}",
|
|
64
56
|
"#" + PANEL_ID + ".ym-wait{color:#854d0e;background:linear-gradient(135deg,#fef9c3,#fde68a);border-color:#facc15;}",
|
|
57
|
+
"#" + PANEL_ID + ".ym-done{color:#14532d;background:linear-gradient(135deg,#dcfce7,#bbf7d0);border-color:#86efac;}",
|
|
65
58
|
"#" + PANEL_ID + " .ym-spin{width:18px;height:18px;margin-top:2px;flex:0 0 auto;",
|
|
66
59
|
" border:3px solid rgba(2,132,199,.25);border-top-color:#0284c7;border-radius:50%;animation:ym-sp .8s linear infinite;}",
|
|
67
60
|
"#" + PANEL_ID + ".ym-merge .ym-spin{border-color:rgba(194,65,12,.25);border-top-color:#c2410c;}",
|
|
68
61
|
"#" + PANEL_ID + ".ym-wait .ym-spin{border-color:rgba(161,98,7,.25);border-top-color:#a16207;}",
|
|
62
|
+
"#" + PANEL_ID + ".ym-done .ym-spin{display:none;}",
|
|
69
63
|
"#" + PANEL_ID + " .ym-sub{display:block;font-size:12px;font-weight:600;opacity:.92;margin-top:3px;}",
|
|
70
64
|
"@keyframes ym-sp{to{transform:rotate(360deg)}}",
|
|
71
65
|
].join("\n");
|
|
72
66
|
document.head.appendChild(st);
|
|
73
67
|
}
|
|
74
68
|
|
|
75
|
-
// 上传弹窗:可见的 role=dialog,且内容含上传视图的特征文案
|
|
76
69
|
function findUploadModal() {
|
|
77
70
|
var dlgs = document.querySelectorAll('[role="dialog"].hope-modal__content, [role="dialog"]');
|
|
78
71
|
for (var i = 0; i < dlgs.length; i++) {
|
|
@@ -87,9 +80,7 @@
|
|
|
87
80
|
t.indexOf("选择文件夹") !== -1 ||
|
|
88
81
|
t.indexOf("上传中") !== -1 ||
|
|
89
82
|
t.indexOf("后台上传中") !== -1
|
|
90
|
-
)
|
|
91
|
-
return d;
|
|
92
|
-
}
|
|
83
|
+
) return d;
|
|
93
84
|
}
|
|
94
85
|
return null;
|
|
95
86
|
}
|
|
@@ -106,51 +97,112 @@
|
|
|
106
97
|
}
|
|
107
98
|
|
|
108
99
|
function summarize() {
|
|
109
|
-
var ids = Object.keys(
|
|
100
|
+
var ids = Object.keys(uploads);
|
|
101
|
+
var done = 0, total = 0, active = 0, bytesLoaded = 0, bytesTotal = 0, bps = 0;
|
|
110
102
|
ids.forEach(function (id) {
|
|
111
|
-
var
|
|
112
|
-
total +=
|
|
113
|
-
done +=
|
|
114
|
-
Object.keys(
|
|
103
|
+
var u = uploads[id];
|
|
104
|
+
total += u.total || 0;
|
|
105
|
+
done += u.doneCount || 0;
|
|
106
|
+
Object.keys(u.active).forEach(function (k) {
|
|
107
|
+
var a = u.active[k];
|
|
108
|
+
active++;
|
|
109
|
+
bytesLoaded += a.loaded || 0;
|
|
110
|
+
bytesTotal += a.bytes || a.total || 0;
|
|
111
|
+
bps += currentPartSpeed(a);
|
|
112
|
+
});
|
|
115
113
|
});
|
|
116
|
-
return { done: done, total: total, bps: bps,
|
|
114
|
+
return { done: done, total: total, active: active, bps: bps, bytesLoaded: bytesLoaded, bytesTotal: bytesTotal };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function currentPartSpeed(a) {
|
|
118
|
+
if (!a.samples || a.samples.length < 2) return 0;
|
|
119
|
+
var first = a.samples[0], last = a.samples[a.samples.length - 1];
|
|
120
|
+
var dt = (last.t - first.t) / 1000;
|
|
121
|
+
if (dt <= 0) return 0;
|
|
122
|
+
return Math.max(0, (last.loaded - first.loaded) / dt);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function pushSample(a, loaded) {
|
|
126
|
+
var t = nowMs();
|
|
127
|
+
a.loaded = loaded;
|
|
128
|
+
if (!a.samples) a.samples = [];
|
|
129
|
+
a.samples.push({ t: t, loaded: loaded });
|
|
130
|
+
while (a.samples.length > 2 && t - a.samples[0].t > 1500) a.samples.shift();
|
|
117
131
|
}
|
|
118
132
|
|
|
119
133
|
function onEvent(ev) {
|
|
120
|
-
var d = ev.detail || {}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (d.type === "
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
var d = ev.detail || {};
|
|
135
|
+
var id = d.uploadId || "_";
|
|
136
|
+
|
|
137
|
+
if (d.type === "upload:finish") {
|
|
138
|
+
if (id && uploads[id]) delete uploads[id];
|
|
139
|
+
else uploads = Object.create(null);
|
|
140
|
+
if (!activeUploadCount()) {
|
|
141
|
+
phase = { name: "done", at: nowMs() };
|
|
142
|
+
render();
|
|
143
|
+
setTimeout(function () { if (phase.name === "done") resetAll("idle"); }, 1200);
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (d.type === "complete:start" || d.state === "merging") {
|
|
148
|
+
// 前端在发出 complete 请求后、本地最后一个 part:done 事件到达前可能先触发本事件;
|
|
149
|
+
// 仍有活跃分片时必须显示“传输中”,不能提前显示“合并中”。
|
|
150
|
+
var st = summarize();
|
|
151
|
+
phase = { name: st.active > 0 || anyWaiting() ? "parts" : "merging", at: nowMs() };
|
|
152
|
+
render();
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (d.type === "complete:done") {
|
|
156
|
+
if (d.ok) {
|
|
157
|
+
phase = { name: "done", at: nowMs() };
|
|
158
|
+
uploads = Object.create(null);
|
|
159
|
+
render();
|
|
160
|
+
setTimeout(function () { resetAll("idle"); }, 1200);
|
|
161
|
+
} else {
|
|
162
|
+
phase = { name: "parts", at: nowMs() };
|
|
163
|
+
render();
|
|
164
|
+
}
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (d.type === "presign:start" || d.type === "part:start" || d.type === "part:progress" ||
|
|
169
|
+
d.type === "part:done" || d.type === "part:error" || d.type === "relay") {
|
|
170
|
+
if (phase.name === "idle" || phase.name === "done") phase = { name: "parts", at: nowMs() };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
var u = ensure(id);
|
|
174
|
+
if (d.total) u.total = d.total;
|
|
175
|
+
|
|
176
|
+
if (d.type === "presign:start") {
|
|
177
|
+
u.waiting.add(d.index);
|
|
178
|
+
} else if (d.type === "presign:done") {
|
|
179
|
+
u.waiting.delete(d.index);
|
|
180
|
+
} else if (d.type === "part:start") {
|
|
181
|
+
u.waiting.delete(d.index);
|
|
182
|
+
u.active[d.index] = {
|
|
183
|
+
index: d.index,
|
|
184
|
+
total: d.total,
|
|
185
|
+
bytes: d.bytes || 0,
|
|
186
|
+
loaded: 0,
|
|
187
|
+
samples: [{ t: nowMs(), loaded: 0 }],
|
|
188
|
+
};
|
|
135
189
|
} else if (d.type === "part:progress") {
|
|
136
|
-
if (!
|
|
137
|
-
|
|
138
|
-
|
|
190
|
+
if (!u.active[d.index]) {
|
|
191
|
+
u.active[d.index] = { index: d.index, total: d.total, bytes: d.bytes || 0, loaded: 0, samples: [] };
|
|
192
|
+
}
|
|
193
|
+
if (d.bytes) u.active[d.index].bytes = d.bytes;
|
|
194
|
+
pushSample(u.active[d.index], d.loaded || 0);
|
|
139
195
|
} else if (d.type === "part:done") {
|
|
140
|
-
if (!
|
|
141
|
-
delete
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
// 看门狗:本地分片已全部直传,若 60s 内既没等到 complete 也没收到
|
|
147
|
-
// 服务端 status=completed/404(极端漏网),强制收尾,杜绝状态条卡死。
|
|
148
|
-
setTimeout(function () { if (parts[key]) finishUpload(key); }, 60000);
|
|
149
|
-
})(id);
|
|
196
|
+
if (!u.done[d.index]) { u.done[d.index] = 1; u.doneCount++; }
|
|
197
|
+
delete u.active[d.index];
|
|
198
|
+
u.waiting.delete(d.index);
|
|
199
|
+
if (u.total && u.doneCount >= u.total) {
|
|
200
|
+
u.finished = true;
|
|
201
|
+
phase = { name: "finalizing", at: nowMs() };
|
|
150
202
|
}
|
|
151
203
|
} else if (d.type === "part:error" || d.type === "relay") {
|
|
152
|
-
delete
|
|
153
|
-
|
|
204
|
+
delete u.active[d.index];
|
|
205
|
+
u.waiting.delete(d.index);
|
|
154
206
|
}
|
|
155
207
|
render();
|
|
156
208
|
}
|
|
@@ -158,39 +210,48 @@
|
|
|
158
210
|
function render() {
|
|
159
211
|
var body = panelBody();
|
|
160
212
|
var panel = document.getElementById(PANEL_ID);
|
|
161
|
-
var
|
|
162
|
-
var
|
|
213
|
+
var hasUploads = activeUploadCount() > 0;
|
|
214
|
+
var s = hasUploads ? summarize() : null;
|
|
163
215
|
|
|
164
|
-
if (
|
|
216
|
+
if (phase.name === "merging" || phase.name === "finalizing") {
|
|
165
217
|
if (!body) return;
|
|
166
218
|
if (!panel) { panel = document.createElement("div"); panel.id = PANEL_ID; body.insertBefore(panel, body.firstChild); }
|
|
219
|
+
var secs = Math.max(1, Math.round((nowMs() - phase.at) / 1000));
|
|
220
|
+
var merging = phase.name === "merging" || (s && s.active === 0 && allPartsDone());
|
|
167
221
|
panel.className = "ym-merge";
|
|
168
|
-
var secs = Math.round((Date.now() - merge.at) / 1000);
|
|
169
222
|
panel.innerHTML =
|
|
170
|
-
'<span class="ym-spin"></span><span
|
|
171
|
-
|
|
223
|
+
'<span class="ym-spin"></span><span>' +
|
|
224
|
+
(merging ? "正在云端合并分片…(已 " + secs + " 秒)" : "分片已全部上传,正在提交合并请求…") +
|
|
225
|
+
'<span class="ym-sub">此阶段由网盘服务器处理,不再上传文件内容,因此下方速度显示为 0 或 “-/s” 属正常;大文件可能需要几秒到几十秒,请勿关闭窗口。</span></span>';
|
|
172
226
|
return;
|
|
173
227
|
}
|
|
174
228
|
|
|
175
|
-
if (
|
|
229
|
+
if (phase.name === "done") {
|
|
230
|
+
if (!body) return;
|
|
231
|
+
if (!panel) { panel = document.createElement("div"); panel.id = PANEL_ID; body.insertBefore(panel, body.firstChild); }
|
|
232
|
+
panel.className = "ym-done";
|
|
233
|
+
panel.innerHTML = "<span>✓</span><span>上传完成,文件正在列表中刷新…</span>";
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (!hasUploads) { if (panel) panel.remove(); return; }
|
|
176
238
|
if (!body) return;
|
|
177
239
|
if (!panel) { panel = document.createElement("div"); panel.id = PANEL_ID; body.insertBefore(panel, body.firstChild); }
|
|
178
240
|
|
|
179
|
-
var s = summarize();
|
|
180
241
|
var pct = s.total ? Math.min(99, Math.round((s.done / s.total) * 100)) : 0;
|
|
181
242
|
var line1 = "大文件切片直传中 · 已完成 " + s.done + (s.total ? " / " + s.total + " 片(" + pct + "%)" : " 片");
|
|
182
243
|
var line2;
|
|
183
|
-
if (s.
|
|
184
|
-
|
|
185
|
-
line2 =
|
|
186
|
-
"正在传输第 " + (a.index + 1) + (a.total ? " / " + a.total : "") + " 片 · 实时速率 " +
|
|
187
|
-
fmtSpeed(s.bps) + (s.act.length > 1 ? " · " + s.act.length + " 路并发" : "");
|
|
244
|
+
if (s.active > 0 && s.bps > 1024) {
|
|
245
|
+
line2 = "正在传输 " + s.active + (s.active > 1 ? " 个分片" : " 个分片") + " · 实时速率 " + fmtSpeed(s.bps);
|
|
188
246
|
panel.className = "";
|
|
189
|
-
} else if (
|
|
190
|
-
line2 = "
|
|
247
|
+
} else if (s.active > 0) {
|
|
248
|
+
line2 = "正在传输 " + s.active + (s.active > 1 ? " 个分片" : " 个分片") + " · 正在建立连接/等待首包,暂不计速";
|
|
249
|
+
panel.className = "ym-wait";
|
|
250
|
+
} else if (anyWaiting()) {
|
|
251
|
+
line2 = "正在向网盘申请分片直传地址…(这一步不传文件,暂时没有速度)";
|
|
191
252
|
panel.className = "ym-wait";
|
|
192
253
|
} else {
|
|
193
|
-
line2 = "
|
|
254
|
+
line2 = "正在准备下一片…(暂不传文件,速度为 0)";
|
|
194
255
|
panel.className = "ym-wait";
|
|
195
256
|
}
|
|
196
257
|
panel.innerHTML =
|
|
@@ -203,15 +264,18 @@
|
|
|
203
264
|
scheduled = true;
|
|
204
265
|
requestAnimationFrame(function () {
|
|
205
266
|
scheduled = false;
|
|
206
|
-
// 廉价门控:仅在「已存在面板需要更新位置」或「页面上可能有弹窗」时
|
|
207
|
-
// 才执行较重的 findUploadModal()(含 getBoundingClientRect 与文案扫描),
|
|
208
|
-
// 避免列表导航等无关 DOM 变更也反复触发布局查询。
|
|
209
267
|
var panel = document.getElementById(PANEL_ID);
|
|
210
268
|
if (panel || document.querySelector('[role="dialog"]')) render();
|
|
211
269
|
});
|
|
212
270
|
}
|
|
213
271
|
|
|
214
|
-
setInterval(function () {
|
|
272
|
+
setInterval(function () {
|
|
273
|
+
if (phase.name === "merging" || phase.name === "finalizing") render();
|
|
274
|
+
else if (activeUploadCount()) {
|
|
275
|
+
var s = summarize();
|
|
276
|
+
if (s.active > 0) render();
|
|
277
|
+
}
|
|
278
|
+
}, 1000);
|
|
215
279
|
|
|
216
280
|
function boot() {
|
|
217
281
|
injectCss();
|