How systemmin/kill-doc works
Project type and purpose
• This is a browser userscript toolkit (written in JavaScript) designed to be installed via Tampermonkey (or any userscript manager).
• Its goal is to automate document preview and download workflows on many online document‐hosting sites (e.g., Baidu Wenku, Docin, Renrendoc, Feishu, etc.), leveraging canvas screenshots, HTML-to-PDF conversion, and ZIP packaging.
File structure
• package.json + main.js at the root suggest a Node/npm‐managed repo, though there is no complex build—scripts are plain JS for Tampermonkey.
• Top‐level modules (folders):
• autox/ – two “auto” scripts for specific sites
• bookmark/ – per-site bookmarklet‐style scripts
• e-book/ – e-book download helper (index.js + URL list)
• script/ – a generic script runner (index.js + URL list)
• up.woozooo.com/ – custom scripts for up.woozooo.com
• AMOUNT.md, LICENSE, multiple README.md files – documentation.
README
• Describes supported platforms, feature pipeline (0→1→2→3→4), underlying technologies:
• jspdf (PDF generation)
• @html2canvas (DOM→canvas screenshot)
• @zip.js (create zip archives)
• Workflow steps: auto-preview (scroll), stop preview, download images, generate PDF, extract text, package HTML+TXT, etc.
Diagramming strategy
a. Main components:
• Developer Environment
– Git repo / npm
– Local editor, commits → GitHub
• Userscript Packaging
– main.js orchestrator
– Module folders (autox, bookmark, e-book, script, up.woozooo.com)
– 3rd-party libraries (jspdf, html2canvas, zip.js)
• Delivery & Installation
– Published on GreasyFork / GitHub Releases
– Installed into Tampermonkey
• Runtime Environment
– Browser + Tampermonkey
– Script injector matching URL patterns
• Target Websites
– Set of document portals (e.g., Baidu Wenku, Doc88, Feishu, etc.)
• Processing Pipeline
1. DOM Manipulation & Scrolling (auto-preview)
2. Canvas/Image Capture
3. Binary/Text Extraction
4. PDF Generation
5. ZIP Packaging
6. Download Trigger via GM_download or browser “Save as”
b. Relationships & Interactions:
– User installs script → Tampermonkey
– Tampermonkey injects main.js
– main.js loads the appropriate module based on current URL
– Module runs its pipeline: interacts with page DOM, calls html2canvas/jspdf/zip.js
– Output is handed to Tampermonkey API (GM_download) → Browser Download
c. Architectural patterns & principles:
– Modular plugin pattern: one folder per site/feature
– Sequential pipeline: discrete, ordered steps (preview → capture → package)
– Dependency injection: core libs (jspdf, html2canvas, zip.js) are shared across modules
– URL-based routing: modules register handlers for specific domain patterns
d. Technologies & libraries:
– JavaScript (ES6)
– Tampermonkey API (GM_download, GM_xmlhttpRequest, etc.)
– jspdf v2.4.0
– @html2canvas v1.4.1
– @zip.js v2.7.34