7.0k sao GitHub và vẫn tăng — futurepress/epub.js là dự án JavaScript mà TopGit đang theo dõi trên nền tảng. Enhanced eBooks in the browser.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Epub.js is a JavaScript library for rendering ePub documents in the browser, across many devices.
Epub.js provides an interface for common ebook functions (such as rendering, persistence and pagination) without the need to develop a dedicated application or plugin. Importantly, it has an incredibly permissive Free BSD license.
Try it while reading Moby Dick
Why EPUB
The EPUB standard is a widely used and easily convertible format. Many books are currently in this format, and it is convertible to many other formats (such as PDF, Mobi and iBooks).
An unzipped EPUB3 is a collection of HTML5 files, CSS, images and other media – just like any other website. However, it enforces a schema of book components, which allows us to render a book and its parts based on a controlled vocabulary.
More specifically, the EPUB schema standardizes the table of contents, provides a manifest that enables the caching of the entire book, and separates the storage of the content from how it’s displayed.
Getting Started
If using archived .epub files include JSZip (this must precede inclusion of epub.js):
Create the new ePub, and then render it to that element:
<script>
var book = ePub("url/to/book/package.opf");
var rendition = book.renderTo("area", {width: 600, height: 400});
var displayed = rendition.display();
</script>
The continuous manager will display as many sections as need to fill the screen, and preload the next section offscreen. This enables seamless swiping / scrolling between pages on mobile and desktop, but is less performant than the default method.
This will allow the sandboxed content to run scripts, but currently makes the sandbox insecure.
Documentation
API documentation is available at epubjs.org/documentation/0.3/
A Markdown version is included in the repo at documentation/API.md
Running Locally
install node.js
Then install the project dependences with npm
npm install
You can run the reader locally with the command
npm start
Examples
Spreads
Scrolled
Swipe
Input
Highlights
View All Examples
Testing
Test can be run by Karma from NPM
npm test
Building for Distribution
Builds are concatenated and minified using webpack and babel
To generate a new build run
npm run prepare
or to continuously build run
npm run watch
Hooks
Similar to a plugins, Epub.js implements events that can be "hooked" into. Thus you can interact with and manipulate the contents of the book.
Examples of this functionality is loading videos from YouTube links before displaying a chapter's contents or implementing annotation.
Hooks require an event to register to and a can return a promise to block until they are finished.
Example hook:
rendition.hooks.content.register(function(contents, view) {
var elements = contents.document.querySelectorAll('[video]');
var items = Array.prototype.slice.call(elements);
items.forEach(function(item){
// do something with the video item
});
})
The parts of the rendering process that can be hooked into are below.
book.spine.hooks.serialize // Section is being converted to text
book.spine.hooks.content // Section has been loaded and parsed
rendition.hooks.render // Section is rendered to the screen
rendition.hooks.content // Section contents have been loaded
rendition.hooks.unloaded // Section contents are being unloaded
Reader
The reader has moved to its own repo at: https://github.com/futurepress/epubjs-reader/
futurepress/epub.js có 7.0k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/futurepress/epub.js. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
futurepress/epub.js có những chủ đề gì?
GitHub topics của futurepress/epub.js: "epub". TopGit xếp repo vào nhóm mã nguồn mở.
futurepress/epub.js còn đang phát triển không?
Commit gần nhất trên futurepress/epub.js là 7 tháng trước (theo timestamp GitHub). Repo có 1.2k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
futurepress/epub.js là gì?
futurepress/epub.js (futurepress/epub.js) là dự án JavaScript trên GitHub. Theo mô tả gốc: Enhanced eBooks in the browser.
futurepress/epub.js viết bằng ngôn ngữ gì?
futurepress/epub.js chủ yếu viết bằng JavaScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
epub.js có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về epub.js.