Skip to content

Commit b805819

Browse files
committed
fix
1 parent 4fc0fb9 commit b805819

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

DownloadAllContent/DownloadAllContent.user.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// @name:zh-TW 懶人小説下載器
55
// @name:ja 怠惰者小説ダウンロードツール
66
// @namespace hoothin
7-
// @version 1.18
7+
// @version 1.19
88
// @description Fetch and download main content on current page, provide special support for chinese novel
99
// @description:zh-CN 通用网站内容抓取工具,可批量抓取小说、论坛内容等并保存为TXT文档
1010
// @description:zh-TW 通用網站內容抓取工具,可批量抓取小說、論壇內容等並保存為TXT文檔
@@ -193,10 +193,10 @@
193193
let childNode=childNodes[j];
194194
if(childNode.nodeType==3 && childNode.data && !/^\s*$/.test(childNode.data))hasText=true;
195195
if(childNode.innerHTML){
196-
childNode.innerHTML=childNode.innerHTML.replace(/\<\s*br\s*\>/gi,"\r\n");
196+
childNode.innerHTML=childNode.innerHTML.replace(/\<\s*br\s*\>/gi,"\r\n").replace(/\n+/gi,"\n").replace(/\r+/gi,"\r");
197197
}
198198
if(childNode.textContent){
199-
cStr+=childNode.textContent.replace(/ +/g," ");
199+
cStr+=childNode.textContent.replace(/ +/g," ").replace(/([^\r]|^)\n([^\r]|$)/gi,"$1\r\n$2");
200200
}
201201
if(childNode.nodeType!=3 && !/^(I|A|STRONG|B|FONT)$/.test(childNode.tagName))cStr+="\r\n";
202202
}
@@ -238,7 +238,7 @@
238238
var aEles=document.querySelectorAll("a"),list=[];
239239
for(var i=0;i<aEles.length;i++){
240240
var aEle=aEles[i];
241-
if(aEle.href && /PART\b|Prologue|Chapter\s*\d+|.+[|||||||]|^$|\s*|\s*|\s*|\s*|\s*|\s*|\s*|\s*|\s*|\s*|[\d|||||||||||||||||-]+(|)/i.test(aEle.innerHTML)){
241+
if(aEle.href && /^http/.test(aEle.href) && /PART\b|Prologue|Chapter\s*\d+|.+[|||||||]|^$|\s*|\s*|\s*|\s*|\s*|\s*|\s*|\s*|\s*|\s*|[\d|||||||||||||||||-]+(|)/i.test(aEle.innerHTML)){
242242
list.push(aEle);
243243
}
244244
}

0 commit comments

Comments
 (0)