Skip to content

Commit

Permalink
Update DownloadAllContentSavaAsZIP.user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
hoothin committed Oct 15, 2023
1 parent 5b3db53 commit 7bdf6d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DownloadAllContent/DownloadAllContentSavaAsZIP.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @name:zh-CN 怠惰小说下载器 ZIP 扩展
// @name:zh-TW 怠惰小説下載器 ZIP 擴充
// @namespace hoothin
// @version 0.1
// @version 0.2
// @description Save content as ZIP for DownloadAllContent
// @description:zh-CN 下载时分章节保存 TXT 并打包为 ZIP
// @description:zh-TW 下載時分章節儲存 TXT 並打包為 ZIP
Expand Down Expand Up @@ -36,7 +36,7 @@
let catTitle = cat.match(/.*?\r\n/);
if (!catTitle) return;
catTitle = catTitle[0].trim();
zip.file(index++ + " - " + catTitle.replace(/[\*\/:<>\?\\\|\r\n]/g, "") + ".txt", cat.replace(catTitle, "").trim());
zip.file(index++ + " - " + catTitle.replace(/[\*\/:<>\?\\\|\r\n]/g, "").slice(0, 50) + ".txt", cat.replace(catTitle, "").trim());
});
zip.generateAsync({type: "blob", compression: "DEFLATE"}, meta => {zipTips.innerText = "percent: " + ((meta && meta.percent && meta.percent.toFixed(2)) || "100") + "%"}).then(function(content){
callback(content);
Expand Down

0 comments on commit 7bdf6d2

Please sign in to comment.