68

GitHub - btzr-io/Villain: An open source web-based comic book reader.

 4 years ago
source link: https://github.com/btzr-io/Villain
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

59959492-854cd400-9475-11e9-9149-4d21baa5591c.png

npm 68747470733a2f2f64617669642d646d2e6f72672f62747a722d696f2f56696c6c61696e2f7374617475732e737667 GitHub contributors

An open source web-based comic book reader.


Installation

$ yarn add villain-react

WebWorker

This component uses the libarchivejs for the extraction process, so you will need to provide the path of webworker:

The webworker bundle lives in libarchive.js/dist folder so you need to make sure that it is available in your public folder since it will not get bundled if you're using bundler (it's all bundled up already)

const opts = {
  workerUrl: 'path to ../build/worker-bundle.js',
  ...
}

Usage

Import the component and the css styles

// Component
import Villain from 'villain-react'

// Css styles
import 'villain-react/dist/style.min.css'

// Path of the comicbook archive
const url = '/files/test.cbz'

//...

<Villain file={url} options={opts} />

Options

Available options to customize the reader component:

Name Type Default Description workerUrl string null path to libarchive.js worker-bundle. allowFullScreen bool true Show full screen button. autoHideControls bool false Set inital auto hide state of toolbar. preview number null Load and render only the provided number of images.

Development

Run yarn command to install the dependencies.

To start the development run yarn start, this will open up localhost:8080 on your default browser:

  • This uses webpack-dev-server and includes hot-reloading.

An example archive has been provided to play around inside ./build/testFile

  • A good resource for archives can be found here: https://archive.org/details/comics.
  • Alternative, any compressed folder (zip, rar, tar, etc) with a few images will also do the job.

Credits


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK