mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
c
This commit is contained in:
parent
15afd7c14a
commit
e09507755f
2 changed files with 18 additions and 18 deletions
|
@ -1321,14 +1321,14 @@ function modal_open(url, num)
|
||||||
var iframe = document.querySelector("#iframe-wrapper > iframe");
|
var iframe = document.querySelector("#iframe-wrapper > iframe");
|
||||||
if(num=='pdf')
|
if(num=='pdf')
|
||||||
{
|
{
|
||||||
new Promise((resolve, reject) => {
|
let startTime = Date.now();
|
||||||
const interval = setInterval(() => {
|
let stopLoop = false;
|
||||||
if (iframe.contentWindow.PDFViewerApplication.pdfDocument !== null) {
|
|
||||||
clearInterval(interval);
|
while (!stopLoop && iframe.contentWindow.PDFViewerApplication.pdfDocument==null) {
|
||||||
resolve(1);
|
if (Date.now() - startTime > 30000) {
|
||||||
}
|
stopLoop = true;
|
||||||
}, 1000); // 定期检查 numPages 是否不为 null,这里是每隔1秒检查一次
|
modalele = ['这是一个PDF文档,加载失败了']
|
||||||
}).then( function foo(){
|
}
|
||||||
var pdf = iframe.contentWindow.PDFViewerApplication.pdfDocument;
|
var pdf = iframe.contentWindow.PDFViewerApplication.pdfDocument;
|
||||||
var numPages = pdf.numPages; //获取总页数
|
var numPages = pdf.numPages; //获取总页数
|
||||||
var promises = []; //用来存放每一页的Promise对象
|
var promises = []; //用来存放每一页的Promise对象
|
||||||
|
@ -1485,7 +1485,7 @@ function modal_open(url, num)
|
||||||
sentencesContent += sentences[i][1];
|
sentencesContent += sentences[i][1];
|
||||||
}
|
}
|
||||||
article = {'textContent':sentencesContent,'title':iframe.contentWindow.PDFViewerApplication._title}
|
article = {'textContent':sentencesContent,'title':iframe.contentWindow.PDFViewerApplication._title}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1321,14 +1321,14 @@ function modal_open(url, num)
|
||||||
var iframe = document.querySelector("#iframe-wrapper > iframe");
|
var iframe = document.querySelector("#iframe-wrapper > iframe");
|
||||||
if(num=='pdf')
|
if(num=='pdf')
|
||||||
{
|
{
|
||||||
new Promise((resolve, reject) => {
|
let startTime = Date.now();
|
||||||
const interval = setInterval(() => {
|
let stopLoop = false;
|
||||||
if (iframe.contentWindow.PDFViewerApplication.pdfDocument !== null) {
|
|
||||||
clearInterval(interval);
|
while (!stopLoop && iframe.contentWindow.PDFViewerApplication.pdfDocument==null) {
|
||||||
resolve(1);
|
if (Date.now() - startTime > 30000) {
|
||||||
}
|
stopLoop = true;
|
||||||
}, 1000); // 定期检查 numPages 是否不为 null,这里是每隔1秒检查一次
|
modalele = ['这是一个PDF文档,加载失败了']
|
||||||
}).then( function foo(){
|
}
|
||||||
var pdf = iframe.contentWindow.PDFViewerApplication.pdfDocument;
|
var pdf = iframe.contentWindow.PDFViewerApplication.pdfDocument;
|
||||||
var numPages = pdf.numPages; //获取总页数
|
var numPages = pdf.numPages; //获取总页数
|
||||||
var promises = []; //用来存放每一页的Promise对象
|
var promises = []; //用来存放每一页的Promise对象
|
||||||
|
@ -1485,7 +1485,7 @@ function modal_open(url, num)
|
||||||
sentencesContent += sentences[i][1];
|
sentencesContent += sentences[i][1];
|
||||||
}
|
}
|
||||||
article = {'textContent':sentencesContent,'title':iframe.contentWindow.PDFViewerApplication._title}
|
article = {'textContent':sentencesContent,'title':iframe.contentWindow.PDFViewerApplication._title}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue