This commit is contained in:
Joseph Cheung 2023-03-06 11:23:26 +08:00
parent 56bc7a2687
commit 86f6650ec7
2 changed files with 630 additions and 612 deletions

View file

@ -1288,6 +1288,10 @@ let keytextres = []
let fulltext=[] let fulltext=[]
let article let article
let sentences=[] let sentences=[]
var articlePromise = new Promise((resolve, reject) => {
});
function modal_open(url, num) function modal_open(url, num)
{ {
if(lock_chat==1) return; if(lock_chat==1) return;
@ -1484,22 +1488,27 @@ function modal_open(url, num)
return 0; return 0;
}); });
}).catch(function(error) {
console.error(error); //处理错误情况
});
modalele = ['这是一个PDF文档'] modalele = ['这是一个PDF文档']
sentencesContent = '' sentencesContent = ''
for (let i = 0; i < sentences.length; i++) { for (let i = 0; i < sentences.length; i++) {
sentencesContent += sentences[i][1]; sentencesContent += sentences[i][1];
} }
article = {'textContent':sentencesContent,'title':iframe.contentWindow.PDFViewerApplication._title} article = {'textContent':sentencesContent,'title':iframe.contentWindow.PDFViewerApplication._title}
}).catch(function(error) {
console.error(error); //处理错误情况
});
} }
else else
{ {
modalele = eleparse(iframe.contentDocument); modalele = eleparse(iframe.contentDocument);
article = new Readability(iframe.contentDocument.cloneNode(true)).parse(); article = new Readability(iframe.contentDocument.cloneNode(true)).parse();
} }
}).then(
() => {
fulltext = article.textContent; fulltext = article.textContent;
fulltext = fulltext.replaceAll("\n\n","\n").replaceAll("\n\n","\n"); fulltext = fulltext.replaceAll("\n\n","\n").replaceAll("\n\n","\n");
const delimiter = /[?!;\?\n]/g const delimiter = /[?!;\?\n]/g

View file

@ -1288,6 +1288,10 @@ let keytextres = []
let fulltext=[] let fulltext=[]
let article let article
let sentences=[] let sentences=[]
var articlePromise = new Promise((resolve, reject) => {
});
function modal_open(url, num) function modal_open(url, num)
{ {
if(lock_chat==1) return; if(lock_chat==1) return;
@ -1484,22 +1488,27 @@ function modal_open(url, num)
return 0; return 0;
}); });
}).catch(function(error) {
console.error(error); //处理错误情况
});
modalele = ['这是一个PDF文档'] modalele = ['这是一个PDF文档']
sentencesContent = '' sentencesContent = ''
for (let i = 0; i < sentences.length; i++) { for (let i = 0; i < sentences.length; i++) {
sentencesContent += sentences[i][1]; sentencesContent += sentences[i][1];
} }
article = {'textContent':sentencesContent,'title':iframe.contentWindow.PDFViewerApplication._title} article = {'textContent':sentencesContent,'title':iframe.contentWindow.PDFViewerApplication._title}
}).catch(function(error) {
console.error(error); //处理错误情况
});
} }
else else
{ {
modalele = eleparse(iframe.contentDocument); modalele = eleparse(iframe.contentDocument);
article = new Readability(iframe.contentDocument.cloneNode(true)).parse(); article = new Readability(iframe.contentDocument.cloneNode(true)).parse();
} }
}).then(
() => {
fulltext = article.textContent; fulltext = article.textContent;
fulltext = fulltext.replaceAll("\n\n","\n").replaceAll("\n\n","\n"); fulltext = fulltext.replaceAll("\n\n","\n").replaceAll("\n\n","\n");
const delimiter = /[?!;\?\n]/g const delimiter = /[?!;\?\n]/g