### Install Project Dependencies Source: https://github.com/404-novel-project/novel-downloader/blob/master/README.md Install the necessary dependencies for the project using yarn. ```bash yarn install ``` -------------------------------- ### Development Server Command Source: https://github.com/404-novel-project/novel-downloader/blob/master/docs/superpowers/plans/2026-05-16-sbxh-cf-shadow-dom.md This command starts the development server, allowing for smoke checks of the application's functionality in a browser. ```bash yarn dev ``` -------------------------------- ### Run E2E Test Suite Source: https://github.com/404-novel-project/novel-downloader/blob/master/docs/superpowers/plans/2026-05-16-sbxh-cf-shadow-dom.md Execute the E2E test suite after starting the development server. Ensure the E2E profile is initialized. This verifies that all test cases, including the new sbxh1-novel-page, pass. ```bash yarn dev # in one terminal yarn test:e2e # in another ``` -------------------------------- ### Clean Build and Verify Bundle Source: https://github.com/404-novel-project/novel-downloader/blob/master/docs/superpowers/plans/2026-05-16-sbxh-cf-shadow-dom.md Perform a clean build by removing distribution files and cache, then lint and build the project. Verify that exactly one `.user.js` file is generated in the `dist/` directory. ```bash rm -rf dist node_modules/.cache yarn lint yarn build ls dist/*.user.js ``` -------------------------------- ### Lint and Build Project Source: https://github.com/404-novel-project/novel-downloader/blob/master/docs/superpowers/plans/2026-05-16-sbxh-cf-shadow-dom.md Run these commands to lint the project and build the distribution files. This step ensures code quality and prepares the project for testing. ```bash yarn lint yarn build ``` -------------------------------- ### Build the Project Source: https://github.com/404-novel-project/novel-downloader/blob/master/README.md Compile the project to generate the final script file 'dist/bundle.user.js'. ```bash yarn run build ``` -------------------------------- ### Custom Finish Callback Function Source: https://github.com/404-novel-project/novel-downloader/blob/master/README.md Defines a function that executes after the download is complete and the ZIP file is generated. This example closes the current browser window. ```javascript function customFinishCallback(book) { window.close(); } window.customFinishCallback = customFinishCallback; ``` -------------------------------- ### Custom HTML Style for ZIP Chapters Source: https://github.com/404-novel-project/novel-downloader/blob/master/README.md Applies custom CSS styles to the HTML files within the ZIP archive. This example sets paragraph indentation, display, and line height. ```javascript const saveOptions = { mainStyleText: `p { text-indent: 4em; display: block; line-height: 1.3em; margin-top: 0.4em; margin-bottom: 0.4em; }`, }; window.saveOptions = saveOptions; ``` -------------------------------- ### Build and Lint Commands Source: https://github.com/404-novel-project/novel-downloader/blob/master/docs/superpowers/plans/2026-05-16-sbxh-cf-shadow-dom.md These bash commands are used to lint the codebase and build the project. The `ls dist/*.user.js` command verifies that a single bundle file is produced. ```bash yarn lint yarn build ls dist/*.user.js ``` -------------------------------- ### Complete Settings User Script Source: https://github.com/404-novel-project/novel-downloader/blob/master/README.md A comprehensive user script that injects token options, chapter filtering, and save options into the novel downloader. It allows for centralized configuration of multiple downloader features. ```javascript // ==UserScript== // @name Noveldownloader Settings // @namespace http://tampermonkey.net/ // @version 0.1 // @description Noveldownloader Settings // @author You // @match *://*/* // @grant none // ==/UserScript== (function () { "use strict"; // token 设置开始 const tokenOptions = { Jjwxc: { token:"11111111_750afc84c839aaaaafccd841fffd11f1", //填入token,形如客户号+下划线'_'+字母与数字混合的字符串 user_key:"11ffffff-11ff-11ff-11ff-111111111fff",//填入user_key }, Xrzww: { deviceIdentify: "webh517657567560", //填入 header中的deviceIdentify值 Authorization: "Bearer 453453453e03ee546456546754756756", //填入 header中的Authorization值 }, }; //token 设置结束 // 章节过滤筛选开始 function chapterFilter(chapter) { return chapter.chapterNumber <= 100; } //章节过滤筛选结束 //保存设置开始 const saveOptions = { getchapterName: (chapter) => { if (chapter.chapterName) { return `第${chapter.chapterNumber.toString()}章 ${chapter.chapterName}`; } else { return `第${chapter.chapterNumber.toString()}章`; } // 按 第i章 XXX 命名章节名字 }, genChapterEpub: (contentXHTML) => { return contentXHTML.replaceAll("
", "");
},
};
//保存设置结束
if(saveOptions)
window.saveOptions = saveOptions;
if(tokenOptions)
window.tokenOptions = tokenOptions;
if(chapterFilter)
window.chapterFilter = chapterFilter;
})();
```
--------------------------------
### Clone the Project Repository
Source: https://github.com/404-novel-project/novel-downloader/blob/master/README.md
Clone the novel-downloader project from GitHub. Access to GitHub may require a proxy.
```bash
git clone https://github.com/yingziwu/novel-downloader.git
```