mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
c
This commit is contained in:
parent
56bc7a2687
commit
86f6650ec7
2 changed files with 630 additions and 612 deletions
|
@ -1288,8 +1288,12 @@ let keytextres = []
|
||||||
let fulltext=[]
|
let fulltext=[]
|
||||||
let article
|
let article
|
||||||
let sentences=[]
|
let sentences=[]
|
||||||
function modal_open(url, num)
|
var articlePromise = new Promise((resolve, reject) => {
|
||||||
{
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function modal_open(url, num)
|
||||||
|
{
|
||||||
if(lock_chat==1) return;
|
if(lock_chat==1) return;
|
||||||
prev_chat = document.getElementById('chat_talk').innerHTML;
|
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>";}
|
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;
|
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
|
||||||
|
@ -1609,7 +1618,7 @@ function modal_open(url, num)
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function eleparse(doc)
|
function eleparse(doc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1288,8 +1288,12 @@ let keytextres = []
|
||||||
let fulltext=[]
|
let fulltext=[]
|
||||||
let article
|
let article
|
||||||
let sentences=[]
|
let sentences=[]
|
||||||
function modal_open(url, num)
|
var articlePromise = new Promise((resolve, reject) => {
|
||||||
{
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function modal_open(url, num)
|
||||||
|
{
|
||||||
if(lock_chat==1) return;
|
if(lock_chat==1) return;
|
||||||
prev_chat = document.getElementById('chat_talk').innerHTML;
|
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>";}
|
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;
|
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
|
||||||
|
@ -1609,7 +1618,7 @@ function modal_open(url, num)
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function eleparse(doc)
|
function eleparse(doc)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue