Skip to content

Commit e483cd9

Browse files
committed
fix
1 parent ce07edd commit e483cd9

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

DownloadAllContent/DownloadAllContent.user.js

Lines changed: 17 additions & 5 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.22
7+
// @version 1.23
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文檔
@@ -37,7 +37,8 @@
3737
error:"该段内容获取失败",
3838
downloading:"已下载完成 %s 段,剩余 %s 段<br>正在下载 %s",
3939
complete:"已全部下载完成,共 %s 段",
40-
del:"设置小说干扰码"
40+
del:"设置小说干扰码",
41+
setting:"懒人小说下载设置"
4142
};
4243
break;
4344
default:
@@ -47,7 +48,8 @@
4748
error:"Failed in downloading current chapter",
4849
downloading:"%s pages are downloaded, there are still %s pages left<br>Downloading %s ......",
4950
complete:"Completed! The pages totalled %s",
50-
del:"Set css selectors for delete"
51+
del:"Set css selectors for delete",
52+
setting:"DownloadAllContent Setting"
5153
};
5254
break;
5355
}
@@ -250,6 +252,11 @@
250252
}
251253
}
252254
if(list.length>2){
255+
if(GM_getValue("contentSort")){
256+
list.sort(function(a,b){
257+
return parseInt(a.innerText.replace(/[^0-9]/ig,"")) - parseInt(b.innerText.replace(/[^0-9]/ig,""));
258+
});
259+
}
253260
indexDownload(list);
254261
}else{
255262
var blob = new Blob([i18n.info+"\r\n"+document.title+"\r\n\r\n"+getPageContent(document)], {type: "text/plain;charset=utf-8"});
@@ -264,9 +271,14 @@
264271
});
265272
function setDel(){
266273
var selValue=GM_getValue("selectors");
267-
var selectors=prompt("设置小说干扰码的选择器:",selValue?selValue:"");
274+
var selectors=prompt(i18n.del,selValue?selValue:"");
268275
GM_setValue("selectors",selectors);
276+
if(window.confirm("重新排序")){
277+
GM_setValue("contentSort", true);
278+
}else{
279+
GM_setValue("contentSort", false);
280+
}
269281
}
270282
GM_registerMenuCommand(i18n.fetch, fetch);
271-
GM_registerMenuCommand(i18n.del, setDel);
283+
GM_registerMenuCommand(i18n.setting, setDel);
272284
})();

0 commit comments

Comments
 (0)