Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart
3.7 KB
Raw Blame
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>EPUB</title>
    <!-- <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script> -->
    <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/detect_swipe/2.1.1/jquery.detect_swipe.min.js"></script> -->
    <script src="../dist/jszip.min.js"></script>
    <script src="../dist/epub.js"></script>

    <link rel="stylesheet" type="text/css" href="examples.css" />

    <style type="text/css">
      body {
        display: flex;
        -webkit-align-items: center;
        -webkit-justify-content: center;
      }

      /* Absorb patch: examples.css gives the body a min-height of 800px, so a
         shorter page (landscape, or under a pinned top bar) was taller than
         the screen and could be dragged up and down. The book scrolls inside
         epub.js's own container, never the page itself. */
      html,
      body {
        height: 100%;
        min-height: 0;
        overflow: hidden;
      }

      #viewer {
        width: 100%;
        height: 100%;
        /* width: 400px;
      height: 580px; */
        /* box-shadow: 0 0 4px #ccc; */
        /* padding: 10px 10px 0px 10px; */
        margin: 5px auto;
        background: white;
      }

      /* Absorb patch: in scroll mode epub.js shifts the scroll itself when it
         adds the chapter above (manager counter()). Chrome's scroll anchoring
         made the same shift on top, so scrolling up across a chapter jumped
         the page down by that chapter's height. */
      .epub-container {
        overflow-anchor: none;
      }

      /* Absorb patch: scroll mode only moves up and down. A drag that drifted
         sideways nudged the text to the side. */
      body.absorb-scrolled,
      body.absorb-scrolled .epub-container {
        overflow-x: hidden !important;
        touch-action: pan-y;
      }

      #viewerNext {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        pointer-events: none;
        z-index: 2;
      }

      #blindLine {
        display: none;
        position: fixed;
        height: 2px;
        /* above the blind and the touch pad - nothing should cover it */
        z-index: 4;
        pointer-events: none;
        background: rgba(150, 150, 150, 0.9);
        box-shadow: 0 0 3px rgba(0, 0, 0, 0.35);
      }

      #autoScrollTouch {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 3;
        background: transparent;
        touch-action: none;
      }

      @media only screen and (min-device-width: 320px) and (max-device-width: 667px) {
        .arrow {
          position: inherit;
          display: none;
        }
      }
    </style>
  </head>
  <body>
    <div id="viewer"></div>
    <!-- Auto-scroll blind: the next page, stacked over the live one and
         revealed top-down. Never interactive - the live rendition below owns
         every touch, selection and highlight. -->
    <div id="viewerNext"></div>
    <!-- Swallows every touch while auto-scroll runs. A Flutter overlay cannot
         do this job: the WebView is a platform view and claims touches first,
         so taps fell through to the live page underneath the blind. -->
    <div id="autoScrollTouch"></div>
    <!-- Subtle rule at the blind's leading edge, so the boundary is findable
         once the incoming page matches the current one exactly. -->
    <div id="blindLine"></div>
    <script src="epubView.js"></script>
  </body>
</html>