mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
v
This commit is contained in:
parent
322023ed09
commit
df1ca11251
2 changed files with 18 additions and 0 deletions
|
@ -1321,6 +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) => {
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
if (numPages !== null) {
|
||||||
|
clearInterval(interval);
|
||||||
|
resolve(numPages);
|
||||||
|
}
|
||||||
|
}, 1000); // 定期检查 numPages 是否不为 null,这里是每隔1秒检查一次
|
||||||
|
}).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对象
|
||||||
|
@ -1477,6 +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,6 +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) => {
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
if (numPages !== null) {
|
||||||
|
clearInterval(interval);
|
||||||
|
resolve(numPages);
|
||||||
|
}
|
||||||
|
}, 1000); // 定期检查 numPages 是否不为 null,这里是每隔1秒检查一次
|
||||||
|
}).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对象
|
||||||
|
@ -1477,6 +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