janpio / ionic-epubjs

Ionic 3 app using Epub.js
https://janpio.github.io/ionic-epubjs/
31 stars 20 forks source link

Links are not working #50

Open lgme opened 6 years ago

lgme commented 6 years ago

From the screenshot below if I click the "Genesis 1" it should open the next page. The link is valid and it works in epub readers on desktop (I use Microsoft Edge 42.17134). However, it doesn't do anything in testing mode (ionic serve) or after publishing the app, on mobile.

I've sent you the epub file in the zip archive.

image

The full epub file can be downloaded from crossway.org

esv_bible.zip

janpio commented 6 years ago

Interesting. Do you get any errors in the console or doesn't just anything happen?

lgme commented 6 years ago

Silly me, I'm doing it wrong. Ionic has its own navigation system and I need it to navigate one page to another, similar to the chapter navigation in the _subscribeToEvents() method

image

The problem is how do I convert <a>...</a>tags in <ion-item>elements? Any ideas please?

janpio commented 6 years ago

I would try to hook into the existing onclick handlers for those links. Maybe just overwrite h1? Any idea what nav.wait() does?

lgme commented 6 years ago

The js code is is the OEBPS/Text/js/tooltip.js file. Below is a screenshot of the code. I sent you the unpacked epub archive.

image

esv_genesis_unpacked.zip

janpio commented 6 years ago

Whoah.

Any idea where h1() comes from and what it does? Seems to me that this then should switch the location?

lgme commented 6 years ago

All the js functions are available in the tooltip.js file. tooltip.zip

Each paragraph in the page is uniquely identified by an id (ie 01001001). "01" - book number, "001" - chapter number, "001" - verse number. If you look at my first comment, when I click the "Genesis 1" link it should send me to the "b01.00.Genesis.text.xhtml" page, at the header element wit the id=v01001001

image

janpio commented 6 years ago

I couldn't find a h1 method in that file.

lgme commented 6 years ago

I couldn't find a h1 method in that file.

It's not h1, its hl

janpio commented 6 years ago

Ahhh, it's hl, not h1 ;)

janpio commented 6 years ago

Hmmm, I have no idea how one could handle those "internal" navigation functions, especially if the params and target have no relation to what epubjs knows as navigation targets etc. Maybe epubjs has some logic to handle those that I never saw and touched?

lgme commented 6 years ago

Would it be possible to include ionic elements in epub files? After all, ionic elements are xml elements.

janpio commented 6 years ago

No idea if those would be included in the rendering process of Ionic.

But if you control the content of the epub, you could just replace the function calls with the appropriate ones (see the TOC).

lgme commented 6 years ago

I'm not sure I'm quite following you. What TOC are you referring to?

janpio commented 6 years ago

How the TOC of the ebook handles navigation to pages. You posted a screenshot of it above.