瀏覽代碼

前端原帖块硬化:默认展开 + 显示图数 + 失败占位(不再静默隐藏)

- <details open> 默认展开,媒体即见,无需点开
- summary 显示 "· N 图",一眼知道有几张原图
- 图加载失败 → 显示灰色虚线占位框(不再 display:none 静默消失,避免退化成"只剩链接")
云端 /data 为 200,正常加载本地下载的真图;占位仅在真失败时出现。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SamLee 4 周之前
父節點
當前提交
9541335456
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      web/index.html

+ 2 - 2
web/index.html

@@ -383,11 +383,11 @@ function App(){
     </header>
     <div className="scroll">
       <Ribbon onOpen={openPrompt}/>
-      <details className="src"><summary>原帖:{it.title}(这一帖的原料)· {it.platform}{videoUrl?" · 视频":""}</summary>
+      <details className="src" open><summary>原帖:{it.title}(这一帖的原料)· {it.platform}{videoUrl?" · 视频":(imgs.length?` · ${imgs.length} 图`:"")}</summary>
         <div className="srcbody"><a href={it.url} target="_blank" rel="noreferrer">{it.url}</a>
           {videoUrl
             ? <div style={{marginTop:8}}><video src={videoUrl} controls style={{maxWidth:"380px",maxHeight:"320px",borderRadius:"6px",border:"1px solid #e2e8f0"}}/></div>
-            : <div className="srcimgs">{imgs.map((u,i)=><img key={i} src={u} onClick={()=>setZoom(u)} onError={e=>e.target.style.display='none'}/>)}</div>}
+            : <div className="srcimgs">{imgs.map((u,i)=><img key={i} src={u} title={u} onClick={()=>setZoom(u)} onError={e=>{var ph="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><rect width='80' height='80' fill='%23f1f5f9' stroke='%23cbd5e1' stroke-dasharray='4'/></svg>"; if(e.target.src.slice(0,4)!=='data')e.target.src=ph;}}/>)}</div>}
         </div>
       </details>
       <div className="barhint" style={{display:"flex",gap:8,alignItems:"center"}}>