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,8 +1288,12 @@ let keytextres = []
let fulltext=[]
let article
let sentences=[]
function modal_open(url, num)
{
var articlePromise = new Promise((resolve, reject) => {
});
function modal_open(url, num)
{
if(lock_chat==1) return;
prev_chat = document.getElementById('chat_talk').innerHTML;
if(num == 'pdf') { document.getElementById('chat_talk').innerHTML = prev_chat+'<div class="chat_question">'+'打开链接'+'<a class="footnote">'+ 'PDF' +'</a>'+"</div>";}
@ -1484,22 +1488,27 @@ function modal_open(url, num)
return 0;
});
}).catch(function(error) {
console.error(error); //处理错误情况
});
modalele = ['这是一个PDF文档']
sentencesContent = ''
for (let i = 0; i < sentences.length; i++) {
sentencesContent += sentences[i][1];
}
article = {'textContent':sentencesContent,'title':iframe.contentWindow.PDFViewerApplication._title}
}).catch(function(error) {
console.error(error); //处理错误情况
});
}
else
{
modalele = eleparse(iframe.contentDocument);
article = new Readability(iframe.contentDocument.cloneNode(true)).parse();
}
}).then(
() => {
fulltext = article.textContent;
fulltext = fulltext.replaceAll("\n\n","\n").replaceAll("\n\n","\n");
const delimiter = /[?!;\?\n]/g
@ -1609,7 +1618,7 @@ function modal_open(url, num)
console.log(error);
}
);
}
}
function eleparse(doc)
{

View file

@ -1288,8 +1288,12 @@ let keytextres = []
let fulltext=[]
let article
let sentences=[]
function modal_open(url, num)
{
var articlePromise = new Promise((resolve, reject) => {
});
function modal_open(url, num)
{
if(lock_chat==1) return;
prev_chat = document.getElementById('chat_talk').innerHTML;
if(num == 'pdf') { document.getElementById('chat_talk').innerHTML = prev_chat+'<div class="chat_question">'+'打开链接'+'<a class="footnote">'+ 'PDF' +'</a>'+"</div>";}
@ -1484,22 +1488,27 @@ function modal_open(url, num)
return 0;
});
}).catch(function(error) {
console.error(error); //处理错误情况
});
modalele = ['这是一个PDF文档']
sentencesContent = ''
for (let i = 0; i < sentences.length; i++) {
sentencesContent += sentences[i][1];
}
article = {'textContent':sentencesContent,'title':iframe.contentWindow.PDFViewerApplication._title}
}).catch(function(error) {
console.error(error); //处理错误情况
});
}
else
{
modalele = eleparse(iframe.contentDocument);
article = new Readability(iframe.contentDocument.cloneNode(true)).parse();
}
}).then(
() => {
fulltext = article.textContent;
fulltext = fulltext.replaceAll("\n\n","\n").replaceAll("\n\n","\n");
const delimiter = /[?!;\?\n]/g
@ -1609,7 +1618,7 @@ function modal_open(url, num)
console.log(error);
}
);
}
}
function eleparse(doc)
{