Giter VIP home page Giter VIP logo

Comments (13)

isimmons avatar isimmons commented on August 26, 2024

BTW here is what I have loaded now but not sure what order the scripts should be in. I moved it all to the bottom of the file where I think it should be.

        <script src="js/libs/jquery-1.9.0.min.js"></script>
        <script src="js/libs/loader_filesystem.min.js"></script>
        <script src="js/libs/inflate.min.js"></script>
        <script src="js/libs/zip.min.js"></script>



        <!-- Render -->
        <script src="js/epub.min.js"></script>

        <!-- Hooks -->
        <script async src="js/hooks.min.js"></script>

        <!-- Reader -->
        <script src="js/reader.min.js"></script>

        <!-- fileStorage -->
        <script src="js/libs/fileStorage.min.js"></script>

        <script>
            "use strict";

            document.onreadystatechange = function () {  
              if (document.readyState == "complete") {
                EPUBJS.VERSION = "0.1.6";

                EPUBJS.filePath = "js/";
                fileStorage.filePath = EPUBJS.filePath + "libs/";

                EPUBJSR.app.init("book/backbone_fundamentals.epub");
              }  
            };

          </script>

from epub.js.

fchasen avatar fchasen commented on August 26, 2024

Sorry for the lack of documentation... working on getting it setup.

The zip library is:
http://gildas-lormeau.github.io/zip.js/
I should warn you that compressed epubs are not yet working in Safari either.

In regards the "Uncaught ReferenceError", Grunt was creating the minified version of the zip.js library out of order, which is now update in the latest commit.

Also, I believe the EPUBJS.filePath should be:

EPUBJS.filePath = "js/libs/";

Finally you shouldn't need to include inflate.min.js, as it is loaded by the zip worker.

from epub.js.

isimmons avatar isimmons commented on August 26, 2024

No problem on the docs. I appreciate it. This got me a little farther along but now zip.min.js is trying to load libs/zip/inflate.js resulting in a 404. If I copy inflate.js into libs/zip it gets past that and then gives me a type error

TypeError {} epub.min.js:1
(anonymous function) epub.min.js:1
y epub.min.js:1
(anonymous function) epub.min.js:1
v.trigger epub.min.js:1
(anonymous function) epub.min.js:1
(anonymous function) epub.min.js:1
(anonymous function) epub.min.js:1

I should clarify I just copied the demo directory to myproject hoping to be able to use it and just swap out the mobi-dick for my .epub so not sure if that may be the problem. I should really spend some time with the un-built source to learn more how this works I guess :-)

from epub.js.

shenzhuxi avatar shenzhuxi commented on August 26, 2024

I find that epub.js looks for http://localhost/epubjs/inflate.js 404 (Not Found) for the file rather than the location of inflate.js I put in the html.
I also find the example http://fchasen.github.io/epub.js/examples/contained.html is not working.

from epub.js.

shenzhuxi avatar shenzhuxi commented on August 26, 2024

It took me a while to figure out that EPUBJS.filePath = "../build/libs/" need to be set for the right location of inflate.js.

from epub.js.

AJRenold avatar AJRenold commented on August 26, 2024

zip.js requires the path to inflate.js and deflate.js to be set like so zip.workerScriptsPath = '/libs/'. See the zip.js docs

Epub.js does this in src/unarchiver.js which comes from EPUBJS.filePath.

There are two changes I think we could make to make this less confusing:

  1. Rename EPUBJS.filePath to EPUBJS.libsPath to make it more clear that this needs to be the libs directory
  2. Find a way to parse the loaded scripts tags to find inflate.js and deflate.js and use this to set zip.workerScriptsPath, eliminating the need to use EPUBJS.filePath

from epub.js.

shenzhuxi avatar shenzhuxi commented on August 26, 2024

Seems EPUBJS.cssPath can't use absolute path. EPUBJS.filePath also needs to be checked.

from epub.js.

fchasen avatar fchasen commented on August 26, 2024

Using JSZip mean we no longer need to include EPUBJS.filePath.
Only need to include the following now.
<script src="zip.min.js"></script>

from epub.js.

shenzhuxi avatar shenzhuxi commented on August 26, 2024

What's the advantage of JSZip?

from epub.js.

fchasen avatar fchasen commented on August 26, 2024

Glad you asked! I tried to update to the latest zip.js and ran into the issue you reported: gildas-lormeau/zip.js#115

JSZip is a little simpler to implement since it doesn't have to find a worker file, is under active development and heavily in use (at least by node libraries.)

from epub.js.

fchasen avatar fchasen commented on August 26, 2024

Which isn't to say that I'm opposed to switching back to zip.js at somepoint - it is a great library and has worked well with epubs so far. Moving between the two is a small tweak, but for the moment JSZIP simplifies fixing some of the zip related issues that have been coming up.

from epub.js.

shenzhuxi avatar shenzhuxi commented on August 26, 2024

I'm thinking that it may be better to keep epub.js as a simple epub parser lib and leave unzip, file storage, pagination and etc. to the application layer of the readers.

from epub.js.

Bahar1978 avatar Bahar1978 commented on August 26, 2024

Hi @fchasen,
I use JSZIP to zip my unzipped epub file. But the output is not valid epub. I have all files in the output epub but when I use epubcheck for validating my epub it gives me the following errors:

ERROR(RSC-001): file.epub/file.epub(-1,-1): File 'OEBPS/image/3904.png' could not be found.
ERROR(RSC-001): file.epub/file.epub(-1,-1): File 'OEBPS/image/backoffice.jpg' could not be found.
ERROR(RSC-001): file.epub/file.epub(-1,-1): File 'OEBPS/image/cvr-cm-berichten.jpg' could not be found.
ERROR(RSC-001): file.epub/file.epub(-1,-1): File 'OEBPS/image/icon-author.png' could not be found.
ERROR(RSC-001): file.epub/file.epub(-1,-1): File 'OEBPS/image/macro-after.jpg' could not be found.
ERROR(RSC-001): file.epub/file.epub(-1,-1): File 'OEBPS/image/macro-before.jpg' could not be found.
ERROR(RSC-001): file.epub/file.epub(-1,-1): File 'OEBPS/image/pdf-output.jpg' could not be found.
ERROR(RSC-001): file.epub/file.epub(-1,-1): File 'OEBPS/image/print-centric-wf.jpg' could not be found.
ERROR(RSC-001): file.epub/file.epub(-1,-1): File 'OEBPS/image/xml-centric-wf.jpg' could not be found.
ERROR(RSC-001): file.epub/file.epub(-1,-1): File 'OEBPS/image/xml-input.jpg' could not be found.

I have all of them in my book. Could you please help me with your thought?
Thanks in advance,
Hajar

from epub.js.

Related Issues (20)

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.