fix: 译文直接打开iframe,不再预检HEAD
This commit is contained in:
@@ -174,13 +174,11 @@ function getPdfLink(p) {
|
||||
|
||||
function openPdfBtn(btn) { openPdf(btn.dataset.pdf, btn.dataset.title); }
|
||||
|
||||
async function openTrans(btn) {
|
||||
function openTrans(btn) {
|
||||
const url = btn.dataset.pdf;
|
||||
try {
|
||||
const resp = await fetch(url, { method: 'HEAD' });
|
||||
if (resp.ok) { openPdf(url, btn.dataset.title); return; }
|
||||
} catch(e) {}
|
||||
alert('该论文译文尚未生成,请稍后再试');
|
||||
const title = btn.dataset.title;
|
||||
openPdf(url, title);
|
||||
// If translation doesn't exist, the iframe will show error - user can see it
|
||||
}
|
||||
|
||||
// ═══════════════ PDF VIEWER (状态条驱动) ═══════════════
|
||||
|
||||
@@ -207,13 +207,11 @@ function getPdfLink(p) {
|
||||
|
||||
function openPdfBtn(btn) { openPdf(btn.dataset.pdf, btn.dataset.title); }
|
||||
|
||||
async function openTrans(btn) {
|
||||
function openTrans(btn) {
|
||||
const url = btn.dataset.pdf;
|
||||
try {
|
||||
const resp = await fetch(url, { method: 'HEAD' });
|
||||
if (resp.ok) { openPdf(url, btn.dataset.title); return; }
|
||||
} catch(e) {}
|
||||
alert('该论文译文尚未生成,请稍后再试');
|
||||
const title = btn.dataset.title;
|
||||
openPdf(url, title);
|
||||
// If translation doesn't exist, the iframe will show error - user can see it
|
||||
}
|
||||
|
||||
// ═══════════════ PDF VIEWER (状态条驱动) ═══════════════
|
||||
|
||||
Reference in New Issue
Block a user