GithubHelp home page GithubHelp logo

ledyba / minobi Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 17.82 MB

HTML5 Book Player

License: MIT License

Makefile 0.24% Go 1.28% CSS 1.28% HTML 4.03% JavaScript 93.17%
manga-reader book-reader html5 js

minobi's Introduction

Minobi(蓑火) - A HTML5 Book Player

Minobi is a HTML5 book player.

Sample

Here: https://ledyba.github.io/Minobi/

screenshot

All artworks come from 妖精⊸ロケット(fairy⊸rocket), painted by @ledyba and @momiji-san. Licensed under CC-BY-SA 4.0.

Requirement

Supported browsers

  • iOS8 or later.
  • Latest Chrome.

Dependencies

For client

Minobi does not depend on any external libraries or frameworks.

For development

Minobi uses npm, babel, webpack to transpile from es6 to es4.

To install,

npm install --save-dev webpack babel-loader babel-preset-es2015
# or
make inst

How to use

Compile

If you modify sources, you need to recompile sources for browsers.

To recompile,

`npm bin`/webpack
# or, just
make

Load a book

Please see example. In a nutshell, you need to prepare "chapter" object that contains information about the book.

Event handling

Viewer

pageenter / finish

This event will be fired when a user enters pages or finishes reading book. The 'pages' argument is a list of page numbers, and it may consist of more than one page numbers, since Minobi displays more than one pages in the screen if applicable.

var chapter = {/* page catalog in json */}/
Minobi.init(document.getElementById("minobi"), chapter, function(viewer) {
      //...

      /**
       * @param {[number]} pages
       * @param {string} cause
       */
      var pageenterHandler = function(pages, cause) {
        // ...
        // cause := 'swipe' | 'touch' | 'mouse' | 'keyboard' | 'init' | 'resize' | 'reload' | '?';
      };
      viewer.addEventListener('pageenter', pageenterHandler);
      viewer.removeEventListener('pageenter', pageenterHandler);

      /**
       * @param {string} cause
       */
      var finishHandler = function(pages, cause) {
        // ...
        // cause is the same as pageenter
      };
      viewer.addEventListener('finish', finishHandler);
      viewer.removeEventListener('finish', finishHandler);
    });

Seekbar

activated/deactivated

This event will be fired when a seekbar is activated or deactivated.

var seekbar = new Minobi.Seekbar(/* ... */);

seekbar.addEventListener('activated', function(cause) {
  console.log("seekbar activated, by ", cause);
  //cause := 'mouse' | 'touch' | '?'
});
seekbar.addEventListener('deactivated', function(cause) {
  console.log("seekbar deactivated, by " cause);
  //cause := 'mouse' | 'touch' | '?'
});

Customizing behaviour

Viewer

transitionAreaRatio

/** @type {Minobi.Viewer} */
var viewer;
/**
 * @type {number} transitionAreaRatioForTouch
 * [non-dimension] MUST BE IN [0, 0.5]
 * Tap actions will be treated as page transition actions
 * when the user released their finger in this range from left/right.
 */
viewer.transitionAreaRatioForTouch = 0.35;

/**
 * @type {number} transitionAreaRatioForTouch
 * [non-dimension] MUST BE IN [0, 0.5]
 * Click actions will be treated as page transition actions
 * when the user released their cursor in this range from left/right.
 */
viewer.transitionAreaRatioForMouse = 0.35;

Seekbar

activationPeriod

A seekbar will automatically disappear after this period.

When set to 0, the seekbar won't automatically disappear at all.

var seekbar = new Minobi.Seekbar(/* ... */);
seekbar.activePeriod = 1000;

License

MIT

What 'Minobi' means?

Minobi is a Japanese creature.

minobi's People

Contributors

ledyba avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

minobi's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.