PageSourceSearch

https://www.ottohub.cn/assets/VideoCard-D1Kl4hUn.js

js ottohub.cn collected 2026-10-06 13:14:40 UTC 6,808 bytes, 1 lines download raw bytes

1import{B as e,E as t,F as n,J as r,N as i,O as a,T as o,U as s,W as c,Z as l,c as u,ct as d,f,it as p,k as m,lt as ee,n as h,p as g,s as _,st as v,ut as y}from"./vendor-vue-Bu-KQjoC.js";import{l as te}from"./apiResponse-C8fEm_-L.js";import{s as b,st as ne}from"./index-BE2-dWra.js";import{o as re}from"./blogMeta-BvgcPzkT.js";import{n as ie}from"./detailNavPrefetch-DTSBBnp1.js";import{t as ae}from"./useWindowWidth-BPOgIc3r.js";import{i as oe,n as se,r as ce,t as x}from"./videoFormat-eMkACp59.js";var S=f(`videoAutoPlay`,()=>{let e=p(null),t=p(!0),n=p(!1);function r(t){e.value=t}function i(e){t.value=e}function a(e){n.value=e}return{playingVid:e,autoPreviewEnabled:t,previewSuspended:n,setPlayingVid:r,setAutoPreviewEnabled:i,setPreviewSuspended:a}}),C=n({__name:`ContentAuditBadge`,props:{status:{}},setup(e){let t=e,{t:n}=h(),r=o(()=>t.status!==1),i=o(()=>t.status===2?`bg-danger/15 text-danger`:`bg-amber-500/15 text-amber-600 dark:text-amber-400`),s=o(()=>t.status===2?n(`creator.auditRejected`):t.status===1?n(`creator.auditApproved`):n(`creator.auditPending`));return(e,t)=>r.value?(c(),m(`span`,{key:0,class:d([`inline-flex shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium`,i.value])},y(s.value),3)):a(``,!0)}}),le=[`data-vid`],ue=[`href`],de=[`src`,`alt`],fe={key:2,class:`flex h-full w-full items-center justify-center`},w={key:3,class:`absolute left-1.5 top-1.5 z-20`},pe={key:4,class:`absolute inset-0 z-10 flex items-center justify-center bg-black/40`},me={key:0,class:`flex items-center gap-0.5 rounded bg-black/70 px-1.5 py-0.5`},he={key:1,class:`flex items-center gap-0.5 rounded bg-black/70 px-1.5 py-0.5`},ge={key:6,class:`absolute bottom-0 left-0 right-0 h-[3px] bg-black/30`},_e={class:`space-y-2 p-2 sm:p-3`},ve=[`href`],ye={class:`line-clamp-1 text-xs font-semibold leading-snug text-primary group-hover:text-accent sm:text-sm`},be={class:`flex items-center gap-2`},xe=[`href`],Se=[`src`,`alt`],Ce={key:1,class:`h-5 w-5 shrink-0 rounded-full bg-elevated sm:h-6 sm:w-6`},T=[`href`],E={key:0,class:`shrink-0 whitespace-nowrap text-[10px] text-muted sm:text-xs`},D=n({__name:`VideoCard`,props:{vid:{},title:{},cover_url:{},duration:{},view_count:{},like_count:{},username:{},avatar_url:{},uid:{},time:{},last_watch_second:{},is_gore:{},audit_status:{},showAuditStatus:{type:Boolean},hoverPreview:{type:Boolean,default:!1}},setup(n){let f=n,h=_(),D=u(),O=ne(),k=S(),{playingVid:A,autoPreviewEnabled:j,previewSuspended:M}=g(k),{isMobile:N}=ae(),P=p(null),F=p(null),I=p(!1),L=p(!1),R=p(!1),z=o(()=>h.path===`/`),B=o(()=>`/v/${f.vid}`),V=o(()=>`/u/${f.uid}`),H=o(()=>f.last_watch_second===void 0?null:oe(f.duration,f.last_watch_second)),U=o(()=>se(f.time)),W=o(()=>re(f.is_gore)===1),G=o(()=>{if(f.audit_status==null||f.audit_status===``)return null;let e=Number(f.audit_status);return Number.isFinite(e)?e:null}),we=o(()=>f.showAuditStatus&&G.value!=null&&G.value!==1),K=o(()=>H.value==null?`bottom-1.5`:`bottom-2.5`),q=o(()=>z.value||f.hoverPreview),J=o(()=>q.value&&A.value===f.vid),Y=o(()=>J.value&&!!F.value&&(N()||L.value)),Te=o(()=>J.value&&I.value&&(N()||L.value));async function X(){if(!(F.value||R.value)){R.value=!0,I.value=!0;try{let e=O.activeAccount?.token,t=te(`/api/video/${encodeURIComponent(f.vid)}`,{token:e||void 0,no_history:1}),n=await(await fetch(t,{cache:e?`no-store`:`default`})).json();if(n&&n.status===`error`)return;let r=null;n.data?.video_url?r=n.data:n.video_url&&(r=n),r?.video_url&&(F.value=r.video_url)}catch(e){console.error(`Failed to fetch video detail:`,e)}finally{R.value=!1,I.value=!1}}}async function Z(){if(!q.value||!j.value||M.value||!F.value||A.value!==f.vid||!N()&&!L.value)return;await e();let t=P.value;t&&(t.src!==F.value&&(t.src=F.value),t.muted=!0,t.loop=!0,t.play().catch(()=>{}))}l(()=>[J.value,F.value,L.value,j.value],([e])=>{e&&(F.value?Z():X())},{immediate:!0,flush:`post`}),l(Y,e=>{e&&Z()}),l(M,e=>{e?P.value?.pause():Z()}),s(()=>{let e=P.value;e&&(e.pause(),e.removeAttribute(`src`),e.load())});function Q(e){b(e,D,B.value)}function $(e){e.stopPropagation(),b(e,D,V.value)}function Ee(){ie(),!W.value&&(z.value||f.hoverPreview)&&!N()&&j.value&&(L.value=!0,k.setPlayingVid(f.vid),F.value?Z():X())}function De(){(z.value||f.hoverPreview)&&!N()&&(L.value=!1,A.value===f.vid&&(k.setPlayingVid(null),P.value&&(P.value.pause(),P.value.currentTime=0)))}return(e,o)=>{let s=r(`MaterialIcon`);return c(),m(`article`,{class:`feed-item group overflow-hidden rounded-[var(--radius-default)] border border-border bg-surface transition-shadow hover:shadow-md`,"data-vi
1deo-card":``,"data-vid":n.vid,onMouseenter:Ee,onMouseleave:De},[t(`a`,{href:B.value,class:`block no-underline`,onClick:Q},[t(`div`,{class:d([`relative aspect-video overflow-hidden bg-reader`,W.value?`blog-gore-thumb`:``])},[Y.value?(c(),m(`video`,{key:0,ref_key:`videoRef`,ref:P,class:`h-full w-full object-cover`,playsinline:``,muted:``,loop:``,preload:`metadata`},null,512)):n.cover_url?(c(),m(`img`,{key:1,src:n.cover_url,alt:n.title,loading:`lazy`,decoding:`async`,class:d([`feed-cover-zoom h-full w-full object-cover`,W.value?`blur-xl`:``])},null,10,de)):(c(),m(`div`,fe,[i(s,{name:`play_circle`,size:40,class:`text-muted`})])),we.value?(c(),m(`div`,w,[i(C,{status:G.value},null,8,[`status`])])):a(``,!0),Te.value?(c(),m(`div`,pe,[...o[0]||(o[0]=[t(`div`,{class:`h-8 w-8 animate-spin rounded-full border-2 border-white/30 border-t-white`},null,-1)])])):a(``,!0),n.duration!=null&&Number(n.duration)>0?(c(),m(`span`,{key:5,class:d([`absolute right-1.5 rounded-sm bg-black/70 px-1.5 py-0.5 text-[10px] font-medium text-white sm:text-xs`,K.value])},y(v(ce)(n.duration)),3)):a(``,!0),t(`div`,{class:d([`absolute left-1.5 flex items-center gap-2 text-[10px] text-white sm:text-xs`,K.value])},[n.view_count==null?a(``,!0):(c(),m(`span`,me,[i(s,{name:`smart_display`,size:12}),t(`span`,null,y(v(x)(n.view_count)),1)])),n.like_count==null?a(``,!0):(c(),m(`span`,he,[i(s,{name:`thumb_up`,size:12}),t(`span`,null,y(v(x)(n.like_count)),1)]))],2),H.value==null?a(``,!0):(c(),m(`div`,ge,[t(`div`,{class:`h-full`,style:ee({width:`${Math.round(H.value*100)}%`,backgroundColor:`var(--accent)`})},null,4)]))],2)],8,ue),t(`div`,_e,[t(`a`,{href:B.value,class:`block no-underline`,onClick:Q},[t(`h3`,ye,y(n.title||`视频 ${n.vid}`),1)],8,ve),t(`div`,be,[t(`a`,{href:V.value,class:`shrink-0`,onClick:$}
1,[n.avatar_url?(c(),m(`img`,{key:0,src:n.avatar_url,alt:n.username||n.uid,loading:`lazy`,decoding:`async`,class:`h-5 w-5 rounded-full border border-border object-cover sm:h-6 sm:w-6`},null,8,Se)):(c(),m(`div`,Ce))],8,xe),t(`a`,{href:V.value,class:`min-w-0 flex-1 truncate text-[10px] text-secondary no-underline hover:text-accent sm:text-xs`,onClick:$},y(n.username||`UID ${n.uid}`),9,T),U.value?(c(),m(`span`,E,y(U.value),1)):a(``,!0)])])],40,le)}}});export{C as n,S as r,D as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.