diff --git a/public-api.js b/public-api.js index c820378..06af502 100644 --- a/public-api.js +++ b/public-api.js @@ -228,12 +228,43 @@ function htmlSegments(h) { return out; } const tplHtmlOf = (t) => (t && String(t.html || '').trim() ? cleanTplHtml(t.html) : ''); +// 详情图片里的 HTML 片段(原样显示,网站上放在隔离的 iframe 里):detailHtml = [{ id, html, pos }],pos = 排在第几张图后面(0 = 最上面) +const tplDetailBlocks = (t) => arr(t && t.detailHtml).filter((b) => b && String(b.html || '').trim()); +function tplDetailSeq(t) { + const imgs = tplImagesOf(t), blocks = tplDetailBlocks(t); + const out = []; + for (let i = 0; i <= imgs.length; i++) { + for (const b of blocks) if (Math.min(Math.max(0, Math.round(+b.pos || 0)), imgs.length) === i) out.push({ html: String(b.html).replace(/\s*\[cite:[^\]]*\]/gi, '') }); + if (i < imgs.length) out.push({ img: imgs[i] }); + } + return out; +} +// 原样 HTML 的翻译:只翻译正文文字,