From 15afd7c14ac7200a46eb8ff6cab1b6b4d65d15e8 Mon Sep 17 00:00:00 2001 From: Joseph Cheung Date: Mon, 6 Mar 2023 01:33:24 +0800 Subject: [PATCH] c --- searx/webapp.py | 6 +++--- searx/webapp1.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/searx/webapp.py b/searx/webapp.py index 3da0df8b4..4459820e8 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -1321,15 +1321,15 @@ function modal_open(url, num) var iframe = document.querySelector("#iframe-wrapper > iframe"); if(num=='pdf') { - var pdf = iframe.contentWindow.PDFViewerApplication.pdfDocument; new Promise((resolve, reject) => { const interval = setInterval(() => { - if (pdf.numPages) { + if (iframe.contentWindow.PDFViewerApplication.pdfDocument !== null) { clearInterval(interval); - resolve(pdf.numPages); + resolve(1); } }, 1000); // 定期检查 numPages 是否不为 null,这里是每隔1秒检查一次 }).then( function foo(){ + var pdf = iframe.contentWindow.PDFViewerApplication.pdfDocument; var numPages = pdf.numPages; //获取总页数 var promises = []; //用来存放每一页的Promise对象 sentences=[] diff --git a/searx/webapp1.py b/searx/webapp1.py index 3da0df8b4..4459820e8 100644 --- a/searx/webapp1.py +++ b/searx/webapp1.py @@ -1321,15 +1321,15 @@ function modal_open(url, num) var iframe = document.querySelector("#iframe-wrapper > iframe"); if(num=='pdf') { - var pdf = iframe.contentWindow.PDFViewerApplication.pdfDocument; new Promise((resolve, reject) => { const interval = setInterval(() => { - if (pdf.numPages) { + if (iframe.contentWindow.PDFViewerApplication.pdfDocument !== null) { clearInterval(interval); - resolve(pdf.numPages); + resolve(1); } }, 1000); // 定期检查 numPages 是否不为 null,这里是每隔1秒检查一次 }).then( function foo(){ + var pdf = iframe.contentWindow.PDFViewerApplication.pdfDocument; var numPages = pdf.numPages; //获取总页数 var promises = []; //用来存放每一页的Promise对象 sentences=[]