mikespub/epubjs-reader
Composer 安装命令:
composer require mikespub/epubjs-reader
包简介
Epub.js Reader with zipfs.php
README 文档
README
This fork is only used to re-package and integrate epubjs-reader with COPS
Please see https://github.com/intity/epubreader-js for the original fork - with thanks to @intity and the alpha/beta testers :-)
This fork is meant for a web-based epub reader, where the initial bookPath is set via template variable in assets/template.html, e.g. with PHP Twig or Python Jinja2, and the epub content is served from the original .epub file via a PHP or Python script like app/zipfs.php, e.g. with bookPath = http://localhost:8000/app/zipfs.php/{bookId}/
The dist/ files are available as:
- PHP composer package: mikespub/epubjs-reader, or
- NPM javascript package: @mikespub/epubjs-reader.
Epub.js Reader
About the Reader
The epubreader-js application is based on the epub.js library and is a fork of the epubjs-reader repository.
Getting Started
Open up epubreader-js in a browser.
You can change the ePub it opens by passing a link to bookPath in the url:
?bookPath=https://s3.amazonaws.com/epubjs/books/alice.epub
Running Locally
Install node.js
Then install the project dependences with npm
npm install
You can run the reader locally with the command
npm run serve
Builds are concatenated and minified using webpack
To generate a new build run
npm run build
or rebuilding all *.js files
npm run prepare
Pre-configuration
The epubreader-js application settings is a JavaScript object that you pass as an argument to the Reader constructor. You can make preliminary settings in the file index.html. For example, this is what the default Reader initialization looks like:
<script type="module"> import { Reader } from "./js/epubreader.min.js" const url = new URL(window.location) const path = url.searchParams.get("bookPath") || "https://s3.amazonaws.com/moby-dick/" window.onload = (e) => new Reader(path) </script>
Let's say we want to disable the openbook feature, which is designed to open an epub file on a personal computer. This can be useful for integrating a public library into your site. Let's do this:
<script type="module"> import { Reader } from "./js/epubreader.min.js" const url = "{{bookPath}}" window.onload = (e) => new Reader(url, { openbook: false }) </script>
Note that the
{{bookPath}}replacement token is used to define theurlstring variable. This simple solution will allow you to set up a route to pass the target URL.
Features
The epubreader-js application supports the following features:
- Initial support for mobile devices
- Saving settings in the browser’s local storage
- Opening a book file from the device’s file system
- Bookmarks
- Annotations
- Search by sections of the book
- Output epub metadata
- Keybindings
mikespub/epubjs-reader 适用场景与选型建议
mikespub/epubjs-reader 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 1.48k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mikespub/epubjs-reader 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mikespub/epubjs-reader 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 26
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-04
